1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

Fix diff set store

This commit is contained in:
Mikhail Rakhmanov 2025-04-15 13:09:56 +02:00
parent f108cbc8c6
commit 76256022c1
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -32,6 +32,7 @@ type storage struct {
headStorage headstorage.HeadStorage
collection anystore.Collection
store anystore.DB
storageName string
}
func New(ctx context.Context, storageName string, headStorage headstorage.HeadStorage, store anystore.DB) (kv KeyValueStorage, err error) {
@ -51,6 +52,7 @@ func New(ctx context.Context, storageName string, headStorage headstorage.HeadSt
}
}()
storage := &storage{
storageName: storageName,
headStorage: headStorage,
collection: collection,
store: store,
@ -201,6 +203,10 @@ func (s *storage) Set(ctx context.Context, values ...KeyValue) (err error) {
return
}
s.diff.Set(elements...)
err = s.headStorage.UpdateEntryTx(ctx, headstorage.HeadsUpdate{
Id: s.storageName,
Heads: []string{s.diff.Hash()},
})
return
}