mycognosist / solar

A minimal Secure Scuttlebutt replication node.
Other
20 stars 2 forks source link

Load and persist peer vector clocks #86

Closed mycognosist closed 5 months ago

mycognosist commented 5 months ago

Following the same approach taken by ssb-ebt (used in Manyverse), we persist peer vector clocks to the ebt directory in the application's root configuration directory (~/.local/share/solar in the case of solar).

Each file is created using the @-prefixed SSB ID of the author as the filename; all instances of / are replaced with - and the = before .ed25519 is removed. For example: @HIYqoOhH6U-muCXsnvXzRQmoPpPXrELnJlqSjId2Fg8.ed25519

The file then contains a JSON string of the vector clock for that peer. For example: {"@HIYqoOhH6U+muCXsnvXzRQmoPpPXrELnJlqSjId2Fg8=.ed25519":32,"@HZnU6wM+F17J0RSLXP05x3Lag2jGv3F3LzHMjh72coE=.ed25519":7712}

Clocks are loaded from file when the EBT manager starts and persisted to file just before it shuts down.