Files
Wallenc/Report/puml/fig_35_sync_merge_algorithm.puml

45 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@startuml fig_35_sync_merge_algorithm
scale 2.5
title Wallenc — алгоритм согласования журналов синхронизации (StorageSyncEngine)
skinparam defaultFontName "DejaVu Sans"
skinparam activity {
BackgroundColor #F8F8F8
BorderColor #333333
DiamondBackgroundColor #E8F4FF
}
start
:Группа Storage (≥ 2 UUID из DbStorageSyncGroup);
:Захват блокировок sync (lease);
:Параллельно: flush + readSyncJournal\nдля каждого Storage;
partition "Слияние (StorageSyncJournalMerge)" {
:Для каждого пути — запись\nс максимальной ревизией;
note right
compare: sequence → actorId → createdAt
end note
}
while (Есть необработанный путь?) is (да)
:winnerEntry = победитель по пути;
:sourceStorage = findSourceStorage(winnerEntry);
if (operation == UPSERT\nи source == null?) then (да)
:пропуск пути;
else (нет)
while (Есть target Storage?) is (да)
if (ревизия target ≥ winner?) then (да)
:пропуск target;
else (нет)
:applyEntry:\nUPSERT — copy stream\nDELETE/TRASH — на target\n(recordSyncJournal = false);
endif
endwhile (нет)
endif
endwhile (нет)
:Снятие блокировок;
stop
@enduml