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

Remove old inmemory list storage

This commit is contained in:
mcrakhman 2024-12-02 21:23:40 +01:00
parent d8edabf9cd
commit cef4f8e5b4
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
4 changed files with 8 additions and 11 deletions

View file

@ -6,11 +6,11 @@ import (
"sync"
"time"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/commonspace/object/acl/liststorage"
"github.com/anyproto/any-sync/consensus/consensusproto"
"go.uber.org/atomic"
"go.uber.org/zap"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/consensus/consensusproto"
)
func (as *aclService) newAclObject(ctx context.Context, id string) (*aclObject, error) {
@ -38,7 +38,7 @@ func (as *aclService) newAclObject(ctx context.Context, id string) (*aclObject,
type aclObject struct {
id string
aclService *aclService
store liststorage.ListStorage
store list.Storage
list.AclList
ready chan struct{}
@ -55,7 +55,7 @@ func (a *aclObject) AddConsensusRecords(recs []*consensusproto.RawRecordWithId)
slices.Reverse(recs)
if a.store == nil {
defer close(a.ready)
if a.store, a.consErr = liststorage.NewInMemoryAclListStorage(a.id, recs); a.consErr != nil {
if a.store, a.consErr = list.NewInMemoryStorage(a.id, recs); a.consErr != nil {
return
}
if a.AclList, a.consErr = list.BuildAclListWithIdentity(a.aclService.accountService.Account(), a.store, list.NoOpAcceptorVerifier{}); a.consErr != nil {

View file

@ -9,7 +9,6 @@ import (
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/commonspace/object/accountdata"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/commonspace/object/acl/liststorage"
"github.com/anyproto/any-sync/consensus/consensusproto"
"github.com/anyproto/any-sync/node/nodeclient"
)
@ -56,7 +55,7 @@ func (c *aclJoiningClient) getAcl(ctx context.Context, spaceId string) (l list.A
err = fmt.Errorf("acl not found")
return
}
storage, err := liststorage.NewInMemoryAclListStorage(res[0].Id, res)
storage, err := list.NewInMemoryStorage(res[0].Id, res)
if err != nil {
return
}

View file

@ -14,7 +14,6 @@ import (
"github.com/anyproto/any-sync/commonspace/acl/aclclient"
"github.com/anyproto/any-sync/commonspace/object/accountdata"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/commonspace/object/acl/liststorage"
"github.com/anyproto/any-sync/util/periodicsync"
)
@ -79,7 +78,7 @@ func (a *aclWaiter) loop(ctx context.Context) error {
if len(res) == 0 {
return fmt.Errorf("acl not found")
}
storage, err := liststorage.NewInMemoryAclListStorage(res[0].Id, res)
storage, err := list.NewInMemoryStorage(res[0].Id, res)
if err != nil {
return err
}

View file

@ -20,7 +20,6 @@ import (
"github.com/anyproto/any-sync/commonspace/object/accountdata"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/commonspace/object/acl/liststorage"
"github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
"github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
)
@ -466,7 +465,7 @@ func TestObjectTree(t *testing.T) {
// copying old version of storage
prevAclRecs, err := bAccount.Acl.RecordsAfter(ctx, "")
require.NoError(t, err)
storage, err := liststorage.NewInMemoryAclListStorage(prevAclRecs[0].Id, prevAclRecs)
storage, err := list.NewInMemoryStorage(prevAclRecs[0].Id, prevAclRecs)
require.NoError(t, err)
acl, err := list.BuildAclListWithIdentity(bAccount.Keys, storage, list.NoOpAcceptorVerifier{})
require.NoError(t, err)