3 Commits

Author SHA1 Message Date
86e131779a feat: log the state file size on load and save
Log the raw file size in addition to the number of clusters, affiliates etc.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-05-29 10:15:59 +02:00
417251c0ba fix: fix the panic in loading state from storage
When importing clusters from a file, grow the used buffer to the correct size of the next cluster, so that it does not panic when unmarshaling it.

Handle panics on the storage's save & load, so that it will never crash the discovery service when it fails.

Additionally:
- fix the slice growing logic when exporting clusters so that we avoid over-growing the slices for the affiliates and the endpoints.
- modify the storage tests to use the real state instead of a mock, replace the assertions to ignore the order accordingly.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-05-28 18:45:28 +02:00
ea8b8f1493 feat: implement state storage
On a best-effort basis, store the state on the disk periodically and on shutdown & restore it from the disk on startup.

Additionally, bump Go version, deps & rekres.

Closes siderolabs/discovery-service#54.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-05-22 12:00:13 +02:00