Allow repair from ok torrent
This commit is contained in:
46
fsm notes.txt
Normal file
46
fsm notes.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
break_torrent
|
||||
- TriggerRepair
|
||||
|
||||
repair_torrent
|
||||
- Repair: started repair process
|
||||
|
||||
mark_as_repaired
|
||||
- convertToTorrent: if all links are intact
|
||||
- mergeTorrents: file statistics brokenCount==0, okCount > 0
|
||||
- repair: after reinsert the whole torrent, progress == 100, checked broken links
|
||||
- assignLinks: when the only link is a rar, then it's not really broken (just unplayable)
|
||||
|
||||
-----------------------------
|
||||
|
||||
break_file
|
||||
- DownloadFile: cannot be unrestricted
|
||||
- streamFileToResponse: error downloading the url
|
||||
- streamFileToResponse: status code != 2xx
|
||||
|
||||
repair_file
|
||||
- convertToTorrent: if all links are intact
|
||||
- assignLinks: when we find the matching file
|
||||
- isStillBroken: same approach as convertToTorrent (all links are intact), this is only called on repair method no.1 and progress == 100 immediately
|
||||
|
||||
delete_file
|
||||
- HandleDeleteFile: when only the file is deleted, not the whole torrent
|
||||
|
||||
-----------------------------
|
||||
|
||||
break_torrent
|
||||
- ok_torrent --> broken_torrent
|
||||
|
||||
repair_torrent
|
||||
- broken_torrent --> under_repair_torrent
|
||||
|
||||
mark_as_repaired
|
||||
- broken_torrent, under_repair_torrent --> ok_torrent
|
||||
|
||||
break_file
|
||||
- ok_file --> broken_file
|
||||
|
||||
repair_file
|
||||
- broken_file --> ok_file
|
||||
|
||||
delete_file
|
||||
- ok_file, broken_file --> deleted_file
|
||||
@@ -9,7 +9,7 @@ func NewTorrentState(initial string) *fsm.FSM {
|
||||
initial,
|
||||
fsm.Events{
|
||||
{Name: "break_torrent", Src: []string{"ok_torrent"}, Dst: "broken_torrent"},
|
||||
{Name: "repair_torrent", Src: []string{"broken_torrent"}, Dst: "under_repair_torrent"},
|
||||
{Name: "repair_torrent", Src: []string{"ok_torrent", "broken_torrent"}, Dst: "under_repair_torrent"},
|
||||
{Name: "mark_as_repaired", Src: []string{"broken_torrent", "under_repair_torrent"}, Dst: "ok_torrent"},
|
||||
},
|
||||
fsm.Callbacks{},
|
||||
|
||||
Reference in New Issue
Block a user