mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 14:07:02 +09:00
write space hash on open
This commit is contained in:
parent
ccfcc2f399
commit
11d50d087a
3 changed files with 8 additions and 2 deletions
|
@ -126,6 +126,9 @@ func (d *headSync) fillDiff(objectIds []string) {
|
|||
})
|
||||
}
|
||||
d.diff.Set(els...)
|
||||
if err := d.storage.WriteSpaceHash(d.diff.Hash()); err != nil {
|
||||
d.log.Error("can't write space hash", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
func concatStrings(strs []string) string {
|
||||
|
|
|
@ -46,6 +46,9 @@ func TestDiffService(t *testing.T) {
|
|||
Id: initId,
|
||||
Head: "h1h2",
|
||||
})
|
||||
hash := "123"
|
||||
diffMock.EXPECT().Hash().Return(hash)
|
||||
storageMock.EXPECT().WriteSpaceHash(hash)
|
||||
pSyncMock.EXPECT().Run()
|
||||
service.Init([]string{initId}, delState)
|
||||
})
|
||||
|
|
|
@ -37,7 +37,7 @@ type SpaceStorage interface {
|
|||
TreeRoot(id string) (*treechangeproto.RawTreeChangeWithId, error)
|
||||
TreeStorage(id string) (treestorage.TreeStorage, error)
|
||||
CreateTreeStorage(payload treestorage.TreeStorageCreatePayload) (treestorage.TreeStorage, error)
|
||||
WriteSpaceHash(head string) error
|
||||
WriteSpaceHash(hash string) error
|
||||
ReadSpaceHash() (hash string, err error)
|
||||
|
||||
Close() error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue