Add space/tree creation and derivation and push space protocol changes

This commit is contained in:
mcrakhman authored and Mikhail Iudin committed 2022-09-27 21:06:49 +02:00
1 parent 830fe45487
commit f7b330985d
15 files changed
+858 -82

No files matched your search

+4
View File
@@ -9,6 +9,10 @@ type rpcHandler struct {
s *service
}
func (r *rpcHandler) PushSpace(ctx context.Context, request *spacesyncproto.PushSpaceRequest) (*spacesyncproto.PushSpaceResponse, error) {
return nil, nil
}
func (r *rpcHandler) HeadSync(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (*spacesyncproto.HeadSyncResponse, error) {
sp, err := r.s.GetSpace(ctx, req.SpaceId)
if err != nil {
+1 -6
View File
@@ -9,7 +9,6 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server"
"github.com/anytypeio/go-anytype-infrastructure-experiments/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/node/nodespace/nodecache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/ocache"
"time"
)
@@ -38,11 +37,7 @@ func (s *service) Init(a *app.App) (err error) {
s.commonSpace = a.MustComponent(commonspace.CName).(commonspace.Service)
s.spaceCache = ocache.New(
func(ctx context.Context, id string) (value ocache.Object, err error) {
deps := commonspace.SpaceDeps{
Cache: nodecache.NewNodeCache(s.conf.GCTTL),
Storage: storage.NewInMemoryTreeStorageProvider(),
}
return s.commonSpace.CreateSpace(ctx, id, deps)
return s.commonSpace.GetSpace(ctx, id, nodecache.NewNodeCache(s.conf.GCTTL))
},
ocache.WithLogger(log.Sugar()),
ocache.WithGCPeriod(time.Minute),