Commit 678016db authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

algorithm sketch

parent 241d2106
archive serial: last found version of a file
sync serial: the last synced version
decision serial: specifies which archive is being / should be synced
failed serials: marks failed syncs to avoid replay (eg collision in upload)
in runtime -- in a new process replay will fail again
heartbeat: blocks probe while syncing, but candidates are kept for later
blocks new sync action while syncing
if active heartbeat for file found:
abort (file is being synced)
if archive serial != sync serial:
abort (already probed)
if file changed:
get new info
update file state
if active heartbeat found with different id:
if previous decision serial found:
use decision unless serial marked as failed
make decision with priority to master
add file/current id in heartbeat
sync file (in new thread)
source handle <- stage source file
target pull file from source handle
call back ack_file_sync
ack_file_sync (synced source state, synced target state):
update source state
update target state using source serial
update sync state (merging source & target info) using source serial
set decision state equal to sync state
remove file from heartbeat
remove file from heartbeat
include (serial, file) in failed serials
main loop:
for every archive probe candidate files
for every file with updated serial, decide sync
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment