change ids
All checks were successful
Build and Publish / Metadata (push) Successful in 3s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 50s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m25s

This commit is contained in:
matst80
2025-10-10 21:50:18 +00:00
parent b0e6c8eca8
commit e48a2590bd
13 changed files with 312 additions and 510 deletions

View File

@@ -7,16 +7,21 @@ import (
"time"
)
func init() {
gob.Register(map[uint64]int64{})
}
type DiskStorage struct {
stateFile string
lastSave int64
LastSaves map[CartId]int64
LastSaves map[uint64]int64
}
func NewDiskStorage(stateFile string) (*DiskStorage, error) {
ret := &DiskStorage{
stateFile: stateFile,
LastSaves: make(map[CartId]int64),
LastSaves: make(map[uint64]int64),
}
err := ret.loadState()
return ret, err
@@ -64,7 +69,7 @@ func (s *DiskStorage) loadState() error {
func (s *DiskStorage) Store(id CartId, _ *CartGrain) error {
// With the removal of the legacy message log, we only update the timestamp.
ts := time.Now().Unix()
s.LastSaves[id] = ts
s.LastSaves[uint64(id)] = ts
s.lastSave = ts
return nil
}