diff --git a/client/clientspace/service.go b/client/clientspace/service.go index 26497d94..fdb90e51 100644 --- a/client/clientspace/service.go +++ b/client/clientspace/service.go @@ -42,7 +42,7 @@ func (s *service) Init(a *app.App) (err error) { s.spaceStorageProvider = a.MustComponent(storage.CName).(storage.SpaceStorageProvider) s.spaceCache = ocache.New( func(ctx context.Context, id string) (value ocache.Object, err error) { - return s.commonSpace.GetSpace(ctx, id) + return s.commonSpace.NewSpace(ctx, id) }, ocache.WithLogger(log.Sugar()), ocache.WithGCPeriod(time.Minute), diff --git a/common/commonspace/service.go b/common/commonspace/service.go index 19c4bd40..e8b7b4a4 100644 --- a/common/commonspace/service.go +++ b/common/commonspace/service.go @@ -25,7 +25,7 @@ func New() Service { type Service interface { DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (string, error) CreateSpace(ctx context.Context, payload SpaceCreatePayload) (string, error) - GetSpace(ctx context.Context, id string) (sp Space, err error) + NewSpace(ctx context.Context, id string) (sp Space, err error) app.Component } @@ -78,7 +78,7 @@ func (s *service) DeriveSpace(ctx context.Context, payload SpaceDerivePayload) ( return store.Id(), nil } -func (s *service) GetSpace(ctx context.Context, id string) (Space, error) { +func (s *service) NewSpace(ctx context.Context, id string) (Space, error) { st, err := s.storageProvider.SpaceStorage(id) if err != nil { return nil, err @@ -97,8 +97,5 @@ func (s *service) GetSpace(ctx context.Context, id string) (Space, error) { configuration: lastConfiguration, storage: st, } - if err := sp.Init(ctx); err != nil { - return nil, err - } return sp, nil } diff --git a/common/commonspace/space.go b/common/commonspace/space.go index 367c1296..8b72008d 100644 --- a/common/commonspace/space.go +++ b/common/commonspace/space.go @@ -15,9 +15,10 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list" - tree "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey" + "github.com/zeebo/errs" "go.uber.org/zap" "sync" "sync/atomic" @@ -58,6 +59,8 @@ func NewSpaceId(id string, repKey uint64) string { type Space interface { Id() string + Init(ctx context.Context) error + StoredIds() []string Description() SpaceDescription @@ -206,7 +209,18 @@ func (s *space) Close() error { s.isClosed.Store(true) log.With(zap.String("id", s.id)).Debug("space closed") }() - s.diffService.Close() - s.syncService.Close() - return s.storage.Close() + var mError errs.Group + if err := s.diffService.Close(); err != nil { + mError.Add(err) + } + if err := s.syncService.Close(); err != nil { + mError.Add(err) + } + if err := s.aclList.Close(); err != nil { + mError.Add(err) + } + if err := s.storage.Close(); err != nil { + mError.Add(err) + } + return mError.Err() } diff --git a/common/pkg/acl/aclrecordproto/aclrecord.pb.go b/common/pkg/acl/aclrecordproto/aclrecord.pb.go index d0e583fa..ab92d212 100644 --- a/common/pkg/acl/aclrecordproto/aclrecord.pb.go +++ b/common/pkg/acl/aclrecordproto/aclrecord.pb.go @@ -51,8 +51,10 @@ func (ACLUserPermissions) EnumDescriptor() ([]byte, []int) { } type RawACLRecord struct { - Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + AcceptorIdentity []byte `protobuf:"bytes,3,opt,name=acceptorIdentity,proto3" json:"acceptorIdentity,omitempty"` + AcceptorSignature []byte `protobuf:"bytes,4,opt,name=acceptorSignature,proto3" json:"acceptorSignature,omitempty"` } func (m *RawACLRecord) Reset() { *m = RawACLRecord{} } @@ -102,11 +104,23 @@ func (m *RawACLRecord) GetSignature() []byte { return nil } +func (m *RawACLRecord) GetAcceptorIdentity() []byte { + if m != nil { + return m.AcceptorIdentity + } + return nil +} + +func (m *RawACLRecord) GetAcceptorSignature() []byte { + if m != nil { + return m.AcceptorSignature + } + return nil +} + type RawACLRecordWithId struct { - Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - AcceptorIdentity []byte `protobuf:"bytes,3,opt,name=acceptorIdentity,proto3" json:"acceptorIdentity,omitempty"` - AcceptorSignature []byte `protobuf:"bytes,4,opt,name=acceptorSignature,proto3" json:"acceptorSignature,omitempty"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` } func (m *RawACLRecordWithId) Reset() { *m = RawACLRecordWithId{} } @@ -156,20 +170,6 @@ func (m *RawACLRecordWithId) GetId() string { return "" } -func (m *RawACLRecordWithId) GetAcceptorIdentity() []byte { - if m != nil { - return m.AcceptorIdentity - } - return nil -} - -func (m *RawACLRecordWithId) GetAcceptorSignature() []byte { - if m != nil { - return m.AcceptorSignature - } - return nil -} - type ACLRecord struct { PrevId string `protobuf:"bytes,1,opt,name=prevId,proto3" json:"prevId,omitempty"` Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` @@ -1203,66 +1203,66 @@ func init() { var fileDescriptor_14abe0d1b4206d54 = []byte{ // 959 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xac, 0x9d, 0x38, 0x7e, 0x76, 0x13, 0x67, 0x80, 0xd4, 0x8a, 0x8a, 0x15, 0xad, 0x38, - 0x44, 0x55, 0x71, 0xc1, 0x20, 0xa5, 0xca, 0x05, 0xb9, 0xa6, 0x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- 0x08, 0x5a, 0x59, 0x82, 0x7b, 0xb0, 0x19, 0x09, 0xb6, 0x9c, 0x5a, 0x42, 0x2d, 0x12, 0xaf, 0xf0, - 0x3e, 0x6c, 0xf1, 0xe4, 0xbd, 0x36, 0xbb, 0x74, 0x8d, 0x31, 0x34, 0x7c, 0xaa, 0x68, 0xcc, 0xc7, - 0x3c, 0xe3, 0x01, 0x60, 0x6f, 0x21, 0x04, 0x0b, 0x14, 0x61, 0xd4, 0x3f, 0x61, 0xab, 0x09, 0x95, - 0x17, 0x86, 0x44, 0x83, 0xac, 0xf1, 0x68, 0xf9, 0x14, 0x9f, 0x33, 0xa9, 0xe8, 0x3c, 0xea, 0x6d, - 0x1c, 0xa0, 0xc3, 0x3a, 0xc9, 0x0c, 0xee, 0x8f, 0x0e, 0x34, 0x35, 0xc7, 0x30, 0x54, 0x05, 0x26, - 0xa8, 0xc4, 0xe4, 0x23, 0xb8, 0xc3, 0x02, 0x4f, 0xac, 0x22, 0xc5, 0xc3, 0xe0, 0x84, 0x25, 0x54, - 0x8b, 0x46, 0xad, 0xba, 0x8c, 0xa8, 0xc7, 0xa6, 0xbe, 0xa1, 0xdc, 0x22, 0xc9, 0x52, 0xab, 0x1c, - 0x43, 0x99, 0x1f, 0xb3, 0x8b, 0x85, 0xab, 0xd8, 0x35, 0xd6, 0x67, 0x82, 0x2f, 0xa9, 0x0e, 0x7b, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xac, 0x9d, 0x38, 0x7e, 0x76, 0x13, 0x67, 0x80, 0xd4, 0x8a, 0x8a, 0x15, 0xad, 0x38, + 0x44, 0x55, 0x71, 0xc1, 0x20, 0xa5, 0xca, 0x01, 0xe4, 0x9a, 0x22, 0xbb, 0x09, 0x52, 0x35, 0x01, + 0x8a, 0x7a, 0x9b, 0xee, 0x8e, 0x92, 0x51, 0xed, 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, 0xe1, 0x4d, 0x3d, 0x26, 0x49, 0x7e, 0x87, 0xfb, 0x1b, 0x02, 0xc8, 0xce, 0xc0, 0x2d, 0x30, - 0x7a, 0x00, 0xbb, 0xe5, 0x79, 0x60, 0x0b, 0xd0, 0x21, 0x55, 0x47, 0x99, 0x7f, 0xe3, 0xad, 0xf9, - 0xff, 0x83, 0xe0, 0x4e, 0x41, 0x70, 0x7c, 0x08, 0x3b, 0x76, 0x92, 0x3f, 0x5f, 0xbc, 0x9a, 0x71, - 0xef, 0x84, 0x25, 0x99, 0x94, 0xcd, 0xb9, 0x91, 0x96, 0x41, 0x9d, 0xc2, 0x48, 0xcb, 0xb0, 0xef, - 0x36, 0x2d, 0x53, 0x07, 0x93, 0xce, 0xd4, 0x8f, 0x27, 0x67, 0xba, 0x76, 0x7f, 0x47, 0xd0, 0xce, - 0x1d, 0xd8, 0x5b, 0xa8, 0x59, 0x2a, 0x59, 0x76, 0x27, 0xd6, 0xf3, 0x92, 0xa5, 0xe6, 0x02, 0xaf, - 0x46, 0x91, 0xd7, 0x7a, 0x89, 0x36, 0xae, 0x91, 0xc8, 0x95, 0x69, 0xdd, 0xe2, 0xb9, 0x79, 0x53, - 0x1a, 0x4f, 0x61, 0x27, 0x9e, 0x0a, 0x84, 0x45, 0x33, 0xea, 0xa5, 0x67, 0xfa, 0x5e, 0x51, 0x53, - 0x52, 0x00, 0x91, 0xf2, 0x26, 0xf7, 0x07, 0x04, 0xbb, 0x15, 0xd8, 0x2d, 0x08, 0xb8, 0xee, 0x72, - 0xac, 0xaf, 0xbf, 0x1c, 0xdd, 0x25, 0xdc, 0xbd, 0x66, 0xf0, 0xdf, 0x48, 0xa4, 0xd4, 0x52, 0xce, - 0x5b, 0x9f, 0x94, 0x67, 0xb0, 0xad, 0xa7, 0xde, 0x2a, 0xf0, 0xbe, 0x62, 0x52, 0xd2, 0x73, 0x86, - 0x1f, 0x41, 0xd3, 0x8b, 0xc7, 0xb8, 0x9d, 0x62, 0xfd, 0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, 0xca, 0xd0, 0xd9, 0x53, 0x33, 0x31, 0x8d, 0x91, + 0xe1, 0xf0, 0x11, 0x34, 0x45, 0x7a, 0xa4, 0x2e, 0x7a, 0x3e, 0xeb, 0xea, 0xf7, 0x1d, 0x49, 0xd0, 0xf7, 0x8f, 0x00, 0x57, 0x45, 0xc1, 0x2d, 0xd8, 0x18, 0xf9, 0x73, 0x1e, 0x74, 0x6b, 0x18, 0x60, - 0xf3, 0x85, 0xe0, 0x8a, 0x89, 0x2e, 0xd2, 0xcf, 0xba, 0x42, 0x4c, 0x74, 0x9d, 0xc7, 0x9f, 0xfc, - 0x71, 0xd9, 0x47, 0x6f, 0x2e, 0xfb, 0xe8, 0xef, 0xcb, 0x3e, 0xfa, 0xe9, 0xaa, 0x5f, 0x7b, 0x73, - 0xd5, 0xaf, 0xfd, 0x75, 0xd5, 0xaf, 0xbd, 0xdc, 0x5b, 0xff, 0xb9, 0xfc, 0x6a, 0xd3, 0xfc, 0x7c, - 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x6d, 0x2c, 0x1d, 0x4f, 0x0b, 0x00, 0x00, + 0xf3, 0xb9, 0xe0, 0x8a, 0x89, 0x2e, 0xd2, 0x6b, 0x5d, 0x21, 0x26, 0xba, 0xce, 0xe3, 0x8f, 0xfe, + 0xb8, 0xec, 0xa3, 0xd7, 0x97, 0x7d, 0xf4, 0xf7, 0x65, 0x1f, 0xfd, 0x74, 0xd5, 0xaf, 0xbd, 0xbe, + 0xea, 0xd7, 0xfe, 0xba, 0xea, 0xd7, 0x5e, 0xec, 0xad, 0xff, 0x5c, 0x7e, 0xb9, 0x69, 0xfe, 0x7c, + 0xf2, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x9d, 0x20, 0x5d, 0x4f, 0x0b, 0x00, 0x00, } func (m *RawACLRecord) Marshal() (dAtA []byte, err error) { @@ -1285,6 +1285,20 @@ func (m *RawACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AcceptorSignature) > 0 { + i -= len(m.AcceptorSignature) + copy(dAtA[i:], m.AcceptorSignature) + i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorSignature))) + i-- + dAtA[i] = 0x22 + } + if len(m.AcceptorIdentity) > 0 { + i -= len(m.AcceptorIdentity) + copy(dAtA[i:], m.AcceptorIdentity) + i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorIdentity))) + i-- + dAtA[i] = 0x1a + } if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -1322,20 +1336,6 @@ func (m *RawACLRecordWithId) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AcceptorSignature) > 0 { - i -= len(m.AcceptorSignature) - copy(dAtA[i:], m.AcceptorSignature) - i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorSignature))) - i-- - dAtA[i] = 0x22 - } - if len(m.AcceptorIdentity) > 0 { - i -= len(m.AcceptorIdentity) - copy(dAtA[i:], m.AcceptorIdentity) - i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorIdentity))) - i-- - dAtA[i] = 0x1a - } if len(m.Id) > 0 { i -= len(m.Id) copy(dAtA[i:], m.Id) @@ -2214,6 +2214,14 @@ func (m *RawACLRecord) Size() (n int) { if l > 0 { n += 1 + l + sovAclrecord(uint64(l)) } + l = len(m.AcceptorIdentity) + if l > 0 { + n += 1 + l + sovAclrecord(uint64(l)) + } + l = len(m.AcceptorSignature) + if l > 0 { + n += 1 + l + sovAclrecord(uint64(l)) + } return n } @@ -2231,14 +2239,6 @@ func (m *RawACLRecordWithId) Size() (n int) { if l > 0 { n += 1 + l + sovAclrecord(uint64(l)) } - l = len(m.AcceptorIdentity) - if l > 0 { - n += 1 + l + sovAclrecord(uint64(l)) - } - l = len(m.AcceptorSignature) - if l > 0 { - n += 1 + l + sovAclrecord(uint64(l)) - } return n } @@ -2744,6 +2744,74 @@ func (m *RawACLRecord) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptorIdentity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclrecord + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclrecord + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclrecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AcceptorIdentity = append(m.AcceptorIdentity[:0], dAtA[iNdEx:postIndex]...) + if m.AcceptorIdentity == nil { + m.AcceptorIdentity = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptorSignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclrecord + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclrecord + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclrecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AcceptorSignature = append(m.AcceptorSignature[:0], dAtA[iNdEx:postIndex]...) + if m.AcceptorSignature == nil { + m.AcceptorSignature = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAclrecord(dAtA[iNdEx:]) @@ -2860,74 +2928,6 @@ func (m *RawACLRecordWithId) Unmarshal(dAtA []byte) error { } m.Id = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AcceptorIdentity", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclrecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclrecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclrecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AcceptorIdentity = append(m.AcceptorIdentity[:0], dAtA[iNdEx:postIndex]...) - if m.AcceptorIdentity == nil { - m.AcceptorIdentity = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AcceptorSignature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclrecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclrecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclrecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AcceptorSignature = append(m.AcceptorSignature[:0], dAtA[iNdEx:postIndex]...) - if m.AcceptorSignature == nil { - m.AcceptorSignature = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAclrecord(dAtA[iNdEx:]) diff --git a/common/pkg/acl/aclrecordproto/protos/aclrecord.proto b/common/pkg/acl/aclrecordproto/protos/aclrecord.proto index cf0afcfa..ca527e04 100644 --- a/common/pkg/acl/aclrecordproto/protos/aclrecord.proto +++ b/common/pkg/acl/aclrecordproto/protos/aclrecord.proto @@ -5,13 +5,13 @@ option go_package = "pkg/acl/aclrecordproto"; message RawACLRecord { bytes payload = 1; bytes signature = 2; + bytes acceptorIdentity = 3; + bytes acceptorSignature = 4; } message RawACLRecordWithId { bytes payload = 1; string id = 2; - bytes acceptorIdentity = 3; - bytes acceptorSignature = 4; } message ACLRecord { diff --git a/common/pkg/acl/tree/changevalidator.go b/common/pkg/acl/tree/changevalidator.go index 617e610d..b4d63ea9 100644 --- a/common/pkg/acl/tree/changevalidator.go +++ b/common/pkg/acl/tree/changevalidator.go @@ -3,14 +3,14 @@ package tree import ( "fmt" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto" - list2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list" ) type ObjectTreeValidator interface { // ValidateFullTree should always be entered while holding a read lock on ACLList - ValidateFullTree(tree *Tree, aclList list2.ACLList) error + ValidateFullTree(tree *Tree, aclList list.ACLList) error // ValidateNewChanges should always be entered while holding a read lock on ACLList - ValidateNewChanges(tree *Tree, aclList list2.ACLList, newChanges []*Change) error + ValidateNewChanges(tree *Tree, aclList list.ACLList, newChanges []*Change) error } type objectTreeValidator struct{} @@ -19,7 +19,7 @@ func newTreeValidator() ObjectTreeValidator { return &objectTreeValidator{} } -func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list2.ACLList) (err error) { +func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list.ACLList) (err error) { tree.Iterate(tree.RootId(), func(c *Change) (isContinue bool) { err = v.validateChange(tree, aclList, c) return err == nil @@ -27,7 +27,7 @@ func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list2.ACLList return err } -func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list2.ACLList, newChanges []*Change) (err error) { +func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list.ACLList, newChanges []*Change) (err error) { for _, c := range newChanges { err = v.validateChange(tree, aclList, c) if err != nil { @@ -37,9 +37,9 @@ func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list2.ACLLi return } -func (v *objectTreeValidator) validateChange(tree *Tree, aclList list2.ACLList, c *Change) (err error) { +func (v *objectTreeValidator) validateChange(tree *Tree, aclList list.ACLList, c *Change) (err error) { var ( - perm list2.UserPermissionPair + perm list.UserPermissionPair state = aclList.ACLState() ) // checking if the user could write @@ -49,7 +49,7 @@ func (v *objectTreeValidator) validateChange(tree *Tree, aclList list2.ACLList, } if perm.Permission != aclrecordproto.ACLUserPermissions_Writer && perm.Permission != aclrecordproto.ACLUserPermissions_Admin { - err = list2.ErrInsufficientPermissions + err = list.ErrInsufficientPermissions return } diff --git a/node/acl/service.go b/node/acl/service.go index c6099cb9..5227a8ab 100644 --- a/node/acl/service.go +++ b/node/acl/service.go @@ -44,11 +44,6 @@ func (s *service) CreateLog(ctx context.Context, aclId string, rec *aclrecordpro if err != nil { return } - acc := s.account.Account() - rec.AcceptorIdentity = acc.Identity - if rec.AcceptorSignature, err = acc.SignKey.Sign(rec.Payload); err != nil { - return - } recPayload, err := rec.Marshal() if err != nil { return @@ -74,11 +69,7 @@ func (s *service) AddRecord(ctx context.Context, aclId string, rec *aclrecordpro if err != nil { return } - acc := s.account.Account() - rec.AcceptorIdentity = acc.Identity - if rec.AcceptorSignature, err = acc.SignKey.Sign(rec.Payload); err != nil { - return - } + recPayload, err := rec.Marshal() if err != nil { return diff --git a/node/nodespace/rpchandler.go b/node/nodespace/rpchandler.go index da8deca1..a05b5efc 100644 --- a/node/nodespace/rpchandler.go +++ b/node/nodespace/rpchandler.go @@ -2,43 +2,42 @@ package nodespace import ( "context" - "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto" ) type rpcHandler struct { s *service } -func (r *rpcHandler) PullSpace(ctx context.Context, request *spacesyncproto.PullSpaceRequest) (resp *spacesyncproto.PullSpaceResponse, err error) { - sp, err := r.s.GetSpace(ctx, request.Id) +func (r *rpcHandler) PushSpace(ctx context.Context, req *spacesyncproto.PushSpaceRequest) (resp *spacesyncproto.PushSpaceResponse, err error) { + _, err = r.s.GetSpace(ctx, req.SpaceHeader.Id) + if err == nil { + err = spacesyncproto.ErrSpaceExists + return + } + if err != storage.ErrSpaceStorageMissing { + err = spacesyncproto.ErrUnexpected + return + } + + payload := storage.SpaceStorageCreatePayload{ + RecWithId: &aclrecordproto.RawACLRecordWithId{ + Payload: req.AclPayload, + Id: req.AclPayloadId, + }, + SpaceHeaderWithId: req.SpaceHeader, + } + st, err := r.s.spaceStorageProvider.CreateSpaceStorage(payload) if err != nil { - if err != spacesyncproto.ErrSpaceMissing { - err = spacesyncproto.ErrUnexpected + err = spacesyncproto.ErrUnexpected + if err == storage.ErrSpaceStorageExists { + err = spacesyncproto.ErrSpaceExists } return } - - description := sp.Description() - resp = &spacesyncproto.PullSpaceResponse{ - SpaceHeader: description.SpaceHeader, - AclPayload: description.AclPayload, - AclPayloadId: description.AclId, - } - return -} - -func (r *rpcHandler) PushSpace(ctx context.Context, req *spacesyncproto.PushSpaceRequest) (resp *spacesyncproto.PushSpaceResponse, err error) { - description := commonspace.SpaceDescription{ - SpaceHeader: req.SpaceHeader, - AclId: req.AclPayloadId, - AclPayload: req.AclPayload, - } - err = r.s.AddSpace(ctx, description) - if err != nil { - return - } - resp = &spacesyncproto.PushSpaceResponse{} + err = st.Close() return } diff --git a/node/nodespace/service.go b/node/nodespace/service.go index fdfa97a2..82faa71f 100644 --- a/node/nodespace/service.go +++ b/node/nodespace/service.go @@ -7,7 +7,7 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage" - config2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/config" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/config" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache" "time" @@ -22,26 +22,23 @@ func New() Service { } type Service interface { - AddSpace(ctx context.Context, description commonspace.SpaceDescription) (err error) GetSpace(ctx context.Context, id string) (commonspace.Space, error) app.ComponentRunnable } type service struct { - conf config2.Space + conf config.Space spaceCache ocache.OCache commonSpace commonspace.Service spaceStorageProvider storage.SpaceStorageProvider } func (s *service) Init(a *app.App) (err error) { - s.conf = a.MustComponent(config2.CName).(*config2.Config).Space + s.conf = a.MustComponent(config.CName).(*config.Config).Space s.commonSpace = a.MustComponent(commonspace.CName).(commonspace.Service) s.spaceStorageProvider = a.MustComponent(storage.CName).(storage.SpaceStorageProvider) s.spaceCache = ocache.New( - func(ctx context.Context, id string) (value ocache.Object, err error) { - return s.commonSpace.GetSpace(ctx, id) - }, + s.loadSpace, ocache.WithLogger(log.Sugar()), ocache.WithGCPeriod(time.Minute), ocache.WithTTL(time.Duration(s.conf.GCTTL)*time.Second), @@ -54,10 +51,6 @@ func (s *service) Name() (name string) { } func (s *service) Run(ctx context.Context) (err error) { - go func() { - time.Sleep(time.Second * 5) - _, _ = s.GetSpace(ctx, "testDSpace") - }() return } @@ -69,8 +62,19 @@ func (s *service) GetSpace(ctx context.Context, id string) (commonspace.Space, e return v.(commonspace.Space), nil } -func (s *service) AddSpace(ctx context.Context, description commonspace.SpaceDescription) (err error) { - return s.commonSpace.AddSpace(ctx, description) +func (s *service) loadSpace(ctx context.Context, id string) (value ocache.Object, err error) { + cc, err := s.commonSpace.NewSpace(ctx, id) + if err != nil { + return + } + ns, err := newNodeSpace(cc) + if err != nil { + return + } + if err = ns.Init(ctx); err != nil { + return + } + return ns, nil } func (s *service) Close(ctx context.Context) (err error) { diff --git a/node/nodespace/space.go b/node/nodespace/space.go new file mode 100644 index 00000000..a1ffe43f --- /dev/null +++ b/node/nodespace/space.go @@ -0,0 +1,24 @@ +package nodespace + +import ( + "context" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace" +) + +func newNodeSpace(cc commonspace.Space) (commonspace.Space, error) { + return &nodeSpace{cc}, nil +} + +type nodeSpace struct { + commonspace.Space +} + +func (s *nodeSpace) Init(ctx context.Context) (err error) { + // try to push acl to consensus node + // + return s.Space.Init(ctx) +} + +func (s *nodeSpace) Close() (err error) { + return s.Space.Close() +}