write space hash on open
This commit is contained in:
parent
ccfcc2f399
commit
11d50d087a
@ -23,7 +23,7 @@ type TreeHeads struct {
|
|||||||
|
|
||||||
type HeadSync interface {
|
type HeadSync interface {
|
||||||
Init(objectIds []string, deletionState deletionstate.DeletionState)
|
Init(objectIds []string, deletionState deletionstate.DeletionState)
|
||||||
|
|
||||||
UpdateHeads(id string, heads []string)
|
UpdateHeads(id string, heads []string)
|
||||||
HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)
|
HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)
|
||||||
RemoveObjects(ids []string)
|
RemoveObjects(ids []string)
|
||||||
@ -126,6 +126,9 @@ func (d *headSync) fillDiff(objectIds []string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
d.diff.Set(els...)
|
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 {
|
func concatStrings(strs []string) string {
|
||||||
|
|||||||
@ -46,6 +46,9 @@ func TestDiffService(t *testing.T) {
|
|||||||
Id: initId,
|
Id: initId,
|
||||||
Head: "h1h2",
|
Head: "h1h2",
|
||||||
})
|
})
|
||||||
|
hash := "123"
|
||||||
|
diffMock.EXPECT().Hash().Return(hash)
|
||||||
|
storageMock.EXPECT().WriteSpaceHash(hash)
|
||||||
pSyncMock.EXPECT().Run()
|
pSyncMock.EXPECT().Run()
|
||||||
service.Init([]string{initId}, delState)
|
service.Init([]string{initId}, delState)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,7 +37,7 @@ type SpaceStorage interface {
|
|||||||
TreeRoot(id string) (*treechangeproto.RawTreeChangeWithId, error)
|
TreeRoot(id string) (*treechangeproto.RawTreeChangeWithId, error)
|
||||||
TreeStorage(id string) (treestorage.TreeStorage, error)
|
TreeStorage(id string) (treestorage.TreeStorage, error)
|
||||||
CreateTreeStorage(payload treestorage.TreeStorageCreatePayload) (treestorage.TreeStorage, error)
|
CreateTreeStorage(payload treestorage.TreeStorageCreatePayload) (treestorage.TreeStorage, error)
|
||||||
WriteSpaceHash(head string) error
|
WriteSpaceHash(hash string) error
|
||||||
ReadSpaceHash() (hash string, err error)
|
ReadSpaceHash() (hash string, err error)
|
||||||
|
|
||||||
Close() error
|
Close() error
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user