sync code

This commit is contained in:
Ned Wright
2026-01-03 18:59:01 +00:00
parent c1058db57d
commit 2105628f05
188 changed files with 8272 additions and 2723 deletions

View File

@@ -19,6 +19,8 @@
USE_DEBUG_FLAG(D_WAAP);
// TODO PHASE3: remove inheritance from SerializeToLocalAndRemoteSyncBase
// this class is responsible for logging trusted sources indicators matches (without validation)
class TrustedSourcesConfidenceCalculator : public SerializeToLocalAndRemoteSyncBase
{
@@ -31,27 +33,35 @@ public:
typedef std::unordered_map<Val, SourcesSet> SourcesCounter;
typedef std::unordered_map<Key, SourcesCounter> KeyValSourceLogger;
TrustedSourcesConfidenceCalculator(std::string path, const std::string& remotePath,
const std::string& assetId);
TrustedSourcesConfidenceCalculator(std::string path, const std::string &remotePath,
const std::string &assetId);
bool is_confident(Key key, Val value, size_t minSources) const;
virtual bool postData();
virtual void pullData(const std::vector<std::string>& files);
virtual void pullData(const std::vector<std::string> &files);
virtual void processData();
virtual void postProcessedData();
virtual void pullProcessedData(const std::vector<std::string>& files);
virtual void updateState(const std::vector<std::string>& files);
virtual void pullProcessedData(const std::vector<std::string> &files);
virtual void updateState(const std::vector<std::string> &files);
virtual Maybe<std::string> getRemoteStateFilePath() const override;
ValuesSet getConfidenceValues(const Key& key, size_t minSources) const;
ValuesSet getConfidenceValues(const Key &key, size_t minSources) const;
virtual void serialize(std::ostream& stream);
virtual void deserialize(std::istream& stream);
virtual void serialize(std::ostream &stream);
virtual void deserialize(std::istream &stream);
void mergeFromRemote(const KeyValSourceLogger& logs);
void mergeFromRemote(const KeyValSourceLogger &logs);
void log(Key key, Val value, Source source);
void reset();
// Helper method for testing - merges incremental data to persistent state without network operations
void mergeIncrementalToPersistent();
private:
KeyValSourceLogger m_logger;
// Persistent state - accumulated trusted sources data across sync cycles
KeyValSourceLogger m_persistent_state;
// Incremental logger - only new data since last sync (gets moved during postData)
std::shared_ptr<KeyValSourceLogger> m_incremental_logger;
};