mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
Rework threadbuilder for new change format
This commit is contained in:
parent
53a9bb5fc5
commit
4ac1f633d4
19 changed files with 1407 additions and 519 deletions
5
Makefile
5
Makefile
|
@ -16,7 +16,8 @@ protos-go:
|
|||
@echo 'Generating protobuf packages (Go)...'
|
||||
$(eval P_TIMESTAMP := Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types)
|
||||
$(eval P_STRUCT := Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types)
|
||||
@$(eval P_PROTOS := Mdata/pb/protos/aclchanges.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb)
|
||||
@$(eval P_ACL_CHANGES := Mdata/pb/protos/aclchanges.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb)
|
||||
@$(eval P_PLAINTEXT_CHANGES := Mdata/pb/protos/plaintextchanges.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb)
|
||||
|
||||
$(eval PKGMAP := $$(P_TIMESTAMP),$$(P_STRUCT),$$(P_PROTOS))
|
||||
$(eval PKGMAP := $$(P_TIMESTAMP),$$(P_STRUCT),$$(P_ACL_CHANGES),$$(P_PLAINTEXT_CHANGES))
|
||||
GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1 protoc --gogofaster_out=$(PKGMAP):./data/pb data/pb/protos/*.*; mv data/pb/data/pb/protos/*.go data/pb; rm -rf data/pb/data
|
||||
|
|
|
@ -4,10 +4,11 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/textileio/go-threads/crypto/symmetric"
|
||||
"hash/fnv"
|
||||
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/textileio/go-threads/crypto/symmetric"
|
||||
)
|
||||
|
||||
var ErrNoSuchUser = errors.New("no such user")
|
||||
|
|
|
@ -2,8 +2,9 @@ package data
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
)
|
||||
|
||||
type ACLStateBuilder struct {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package data
|
||||
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadbuilder"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
|
|
@ -3,8 +3,8 @@ package data
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/textileio/go-threads/core/thread"
|
||||
|
@ -41,7 +41,7 @@ func (tb *ACLTreeBuilder) loadChange(id string) (ch *Change, err error) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
|
||||
defer cancel()
|
||||
|
||||
record, err := tb.thread.GetRecord(ctx, id)
|
||||
record, err := tb.thread.GetChange(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package data
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/textileio/go-threads/crypto/symmetric"
|
||||
)
|
||||
|
|
|
@ -64,7 +64,6 @@ type ACLChange struct {
|
|||
CurrentReadKeyHash uint64 `protobuf:"varint,6,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"`
|
||||
Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Identity string `protobuf:"bytes,8,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||
LogHeads map[string]string `protobuf:"bytes,9,rep,name=logHeads,proto3" json:"logHeads,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (m *ACLChange) Reset() { *m = ACLChange{} }
|
||||
|
@ -156,13 +155,6 @@ func (m *ACLChange) GetIdentity() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *ACLChange) GetLogHeads() map[string]string {
|
||||
if m != nil {
|
||||
return m.LogHeads
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ACLChangeACLContentValue struct {
|
||||
// Types that are valid to be assigned to Value:
|
||||
// *ACLChangeACLContentValueValueOfUserAdd
|
||||
|
@ -178,7 +170,7 @@ func (m *ACLChangeACLContentValue) Reset() { *m = ACLChangeACLContentVal
|
|||
func (m *ACLChangeACLContentValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeACLContentValue) ProtoMessage() {}
|
||||
func (*ACLChangeACLContentValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 1}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 0}
|
||||
}
|
||||
func (m *ACLChangeACLContentValue) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -309,7 +301,7 @@ func (m *ACLChangeACLData) Reset() { *m = ACLChangeACLData{} }
|
|||
func (m *ACLChangeACLData) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeACLData) ProtoMessage() {}
|
||||
func (*ACLChangeACLData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 2}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 1}
|
||||
}
|
||||
func (m *ACLChangeACLData) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -361,7 +353,7 @@ func (m *ACLChangeACLSnapshot) Reset() { *m = ACLChangeACLSnapshot{} }
|
|||
func (m *ACLChangeACLSnapshot) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeACLSnapshot) ProtoMessage() {}
|
||||
func (*ACLChangeACLSnapshot) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 3}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 2}
|
||||
}
|
||||
func (m *ACLChangeACLSnapshot) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -407,7 +399,7 @@ func (m *ACLChangeACLState) Reset() { *m = ACLChangeACLState{} }
|
|||
func (m *ACLChangeACLState) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeACLState) ProtoMessage() {}
|
||||
func (*ACLChangeACLState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 4}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 3}
|
||||
}
|
||||
func (m *ACLChangeACLState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -469,7 +461,7 @@ func (m *ACLChangeUserState) Reset() { *m = ACLChangeUserState{} }
|
|||
func (m *ACLChangeUserState) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserState) ProtoMessage() {}
|
||||
func (*ACLChangeUserState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 5}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 4}
|
||||
}
|
||||
func (m *ACLChangeUserState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -545,7 +537,7 @@ func (m *ACLChangeUserAdd) Reset() { *m = ACLChangeUserAdd{} }
|
|||
func (m *ACLChangeUserAdd) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserAdd) ProtoMessage() {}
|
||||
func (*ACLChangeUserAdd) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 6}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 5}
|
||||
}
|
||||
func (m *ACLChangeUserAdd) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -612,7 +604,7 @@ func (m *ACLChangeUserConfirm) Reset() { *m = ACLChangeUserConfirm{} }
|
|||
func (m *ACLChangeUserConfirm) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserConfirm) ProtoMessage() {}
|
||||
func (*ACLChangeUserConfirm) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 7}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 6}
|
||||
}
|
||||
func (m *ACLChangeUserConfirm) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -666,7 +658,7 @@ func (m *ACLChangeUserInvite) Reset() { *m = ACLChangeUserInvite{} }
|
|||
func (m *ACLChangeUserInvite) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserInvite) ProtoMessage() {}
|
||||
func (*ACLChangeUserInvite) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 8}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 7}
|
||||
}
|
||||
func (m *ACLChangeUserInvite) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -735,7 +727,7 @@ func (m *ACLChangeUserJoin) Reset() { *m = ACLChangeUserJoin{} }
|
|||
func (m *ACLChangeUserJoin) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserJoin) ProtoMessage() {}
|
||||
func (*ACLChangeUserJoin) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 9}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 8}
|
||||
}
|
||||
func (m *ACLChangeUserJoin) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -808,7 +800,7 @@ func (m *ACLChangeUserRemove) Reset() { *m = ACLChangeUserRemove{} }
|
|||
func (m *ACLChangeUserRemove) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserRemove) ProtoMessage() {}
|
||||
func (*ACLChangeUserRemove) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 10}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 9}
|
||||
}
|
||||
func (m *ACLChangeUserRemove) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -861,7 +853,7 @@ func (m *ACLChangeReadKeyReplace) Reset() { *m = ACLChangeReadKeyReplace
|
|||
func (m *ACLChangeReadKeyReplace) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeReadKeyReplace) ProtoMessage() {}
|
||||
func (*ACLChangeReadKeyReplace) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 11}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 10}
|
||||
}
|
||||
func (m *ACLChangeReadKeyReplace) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -920,7 +912,7 @@ func (m *ACLChangeUserPermissionChange) Reset() { *m = ACLChangeUserPerm
|
|||
func (m *ACLChangeUserPermissionChange) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLChangeUserPermissionChange) ProtoMessage() {}
|
||||
func (*ACLChangeUserPermissionChange) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 12}
|
||||
return fileDescriptor_5a15109171a9dc49, []int{0, 11}
|
||||
}
|
||||
func (m *ACLChangeUserPermissionChange) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -966,7 +958,6 @@ func (m *ACLChangeUserPermissionChange) GetPermissions() ACLChangeUserPermission
|
|||
func init() {
|
||||
proto.RegisterEnum("anytype.ACLChangeUserPermissions", ACLChangeUserPermissions_name, ACLChangeUserPermissions_value)
|
||||
proto.RegisterType((*ACLChange)(nil), "anytype.ACLChange")
|
||||
proto.RegisterMapType((map[string]string)(nil), "anytype.ACLChange.LogHeadsEntry")
|
||||
proto.RegisterType((*ACLChangeACLContentValue)(nil), "anytype.ACLChange.ACLContentValue")
|
||||
proto.RegisterType((*ACLChangeACLData)(nil), "anytype.ACLChange.ACLData")
|
||||
proto.RegisterType((*ACLChangeACLSnapshot)(nil), "anytype.ACLChange.ACLSnapshot")
|
||||
|
@ -985,66 +976,64 @@ func init() {
|
|||
func init() { proto.RegisterFile("data/pb/protos/aclchanges.proto", fileDescriptor_5a15109171a9dc49) }
|
||||
|
||||
var fileDescriptor_5a15109171a9dc49 = []byte{
|
||||
// 938 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdd, 0x6e, 0xe3, 0x44,
|
||||
0x14, 0xce, 0x24, 0x6d, 0x1d, 0x1f, 0xa7, 0x6d, 0x18, 0x15, 0xc9, 0xf2, 0x16, 0x63, 0xaa, 0x15,
|
||||
0x58, 0x08, 0xa5, 0x52, 0x16, 0xf1, 0xbb, 0x12, 0x34, 0x5d, 0x20, 0xa1, 0x7b, 0xb1, 0x9a, 0x15,
|
||||
0x20, 0x90, 0xb8, 0x98, 0xda, 0x43, 0x6b, 0x91, 0xd8, 0x96, 0x67, 0x52, 0x91, 0x1b, 0xde, 0x00,
|
||||
0xc1, 0x53, 0xf0, 0x00, 0xbc, 0x00, 0xb7, 0x5c, 0xee, 0x05, 0x42, 0x5c, 0xa2, 0xf6, 0x45, 0xd0,
|
||||
0xfc, 0xd8, 0x71, 0x52, 0xa7, 0x48, 0x68, 0x25, 0xc4, 0xdd, 0xcc, 0x37, 0xdf, 0x99, 0x39, 0x3f,
|
||||
0xdf, 0x39, 0x36, 0xbc, 0x1c, 0x53, 0x41, 0x8f, 0xf3, 0xf3, 0xe3, 0xbc, 0xc8, 0x44, 0xc6, 0x8f,
|
||||
0x69, 0x34, 0x8d, 0x2e, 0x69, 0x7a, 0xc1, 0xf8, 0x40, 0x21, 0xd8, 0xa2, 0xe9, 0x42, 0x2c, 0x72,
|
||||
0x76, 0xf4, 0xf3, 0x8b, 0x60, 0x9f, 0x9c, 0x3e, 0x3e, 0x55, 0xa7, 0x38, 0x00, 0x47, 0x14, 0x8c,
|
||||
0x8d, 0x19, 0x8d, 0x27, 0x31, 0x77, 0x51, 0xd0, 0x09, 0x6d, 0x52, 0x87, 0xb0, 0x0f, 0x40, 0xa3,
|
||||
0x69, 0x49, 0x68, 0x2b, 0x42, 0x0d, 0xc1, 0xaf, 0xc2, 0x1e, 0x4f, 0x69, 0xce, 0x2f, 0x33, 0x31,
|
||||
0xa2, 0x9c, 0x4d, 0x62, 0xb7, 0x13, 0xa0, 0xd0, 0x26, 0x6b, 0x28, 0x7e, 0x13, 0x2c, 0x1a, 0x4d,
|
||||
0x1f, 0x51, 0x41, 0xdd, 0xad, 0x00, 0x85, 0xce, 0xd0, 0x1b, 0x18, 0x97, 0x06, 0x95, 0x3b, 0x72,
|
||||
0x25, 0x19, 0xa4, 0xa4, 0x4a, 0xff, 0x4c, 0x1c, 0xca, 0x72, 0x3b,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0x13, 0x56, 0xcc, 0x12, 0xce, 0x93, 0x2c,
|
||||
0xd5, 0x06, 0xaa, 0xee, 0xce, 0xf0, 0xb5, 0x0d, 0x57, 0xad, 0xd3, 0xc7, 0x2d, 0xd2, 0x78, 0x4d,
|
||||
0xe9, 0xdf, 0x24, 0xbd, 0x4a, 0x04, 0x33, 0x5a, 0xd9, 0xe4, 0x9f, 0x26, 0x95, 0xfe, 0xe9, 0x1d,
|
||||
0x7e, 0x17, 0xba, 0x72, 0xf7, 0x69, 0x96, 0xa4, 0x4a, 0x30, 0xce, 0xf0, 0xde, 0x06, 0x73, 0x49,
|
||||
0x19, 0xb7, 0x48, 0x45, 0xc7, 0x23, 0x70, 0xe4, 0xfa, 0x34, 0x4b, 0xbf, 0x49, 0x8a, 0x99, 0x52,
|
||||
0x91, 0x33, 0xf4, 0x37, 0x58, 0x1b, 0xd6, 0xb8, 0x45, 0xea, 0x46, 0x23, 0xcb, 0x54, 0xd1, 0xfb,
|
||||
0x11, 0x81, 0x65, 0x04, 0x8d, 0x3f, 0x04, 0x87, 0x46, 0xd3, 0xa7, 0xa6, 0x25, 0x4c, 0xc1, 0xfc,
|
||||
0xe6, 0x0e, 0x28, 0x59, 0xa4, 0x6e, 0x82, 0x47, 0xaa, 0x0f, 0x8d, 0x02, 0x54, 0x1f, 0x3a, 0xc3,
|
||||
0xa3, 0xe6, 0x0b, 0xea, 0x32, 0x21, 0x35, 0x2b, 0xef, 0x63, 0x70, 0x6a, 0xf7, 0xe3, 0xb7, 0xa1,
|
||||
0x2b, 0x5f, 0x10, 0x54, 0x30, 0xe3, 0xd1, 0xbd, 0x0d, 0x1e, 0x49, 0x0a, 0xa9, 0xc8, 0xde, 0x0f,
|
||||
0x6d, 0xe8, 0x96, 0x30, 0xbe, 0x0f, 0xbb, 0xc5, 0xb2, 0xbf, 0x98, 0x1e, 0x22, 0x5b, 0x64, 0x15,
|
||||
0xc4, 0x0f, 0x75, 0x55, 0x95, 0x09, 0x37, 0xee, 0x1f, 0x6e, 0x48, 0xac, 0x7e, 0xae, 0xc6, 0xc7,
|
||||
0x23, 0xb0, 0x12, 0x55, 0x5c, 0xee, 0x76, 0x94, 0x69, 0x78, 0x87, 0xa3, 0x03, 0xad, 0x03, 0xd3,
|
||||
0x81, 0xa5, 0xa1, 0xf7, 0x25, 0xf4, 0xea, 0x07, 0x0d, 0xfd, 0xf7, 0xa0, 0xde, 0x7f, 0xff, 0x24,
|
||||
0xba, 0x7a, 0x7b, 0xde, 0x20, 0xb0, 0x2b, 0xc7, 0x57, 0x66, 0x08, 0x5a, 0x9b, 0x21, 0xf7, 0x61,
|
||||
0x97, 0xa5, 0x51, 0xb1, 0xc8, 0x45, 0x92, 0xa5, 0x67, 0x6c, 0xa1, 0x9e, 0xea, 0x91, 0x55, 0x10,
|
||||
0xbf, 0x01, 0x2f, 0x18, 0x80, 0xc5, 0x66, 0x76, 0xe9, 0xc0, 0x7b, 0xe4, 0xf6, 0x01, 0x7e, 0x04,
|
||||
0x4e, 0x5e, 0x35, 0x11, 0x57, 0x1d, 0xb3, 0xd7, 0x28, 0x8d, 0xd5, 0x36, 0xe4, 0xa4, 0x6e, 0x26,
|
||||
0x27, 0xed, 0x84, 0x1b, 0x0d, 0xb3, 0x58, 0x35, 0x4e, 0x97, 0xd4, 0x21, 0xef, 0x57, 0x04, 0x96,
|
||||
0x99, 0x27, 0xff, 0xcf, 0x18, 0xbd, 0x4f, 0xc0, 0xa9, 0x35, 0xee, 0x9d, 0x41, 0x1c, 0x82, 0x6d,
|
||||
0x06, 0xe6, 0x24, 0x36, 0xf3, 0x78, 0x09, 0x78, 0x7f, 0x20, 0x80, 0xa5, 0x14, 0x70, 0x08, 0xfb,
|
||||
0x34, 0x8a, 0x58, 0x2e, 0x9e, 0xcc, 0xcf, 0xa7, 0x49, 0x74, 0x66, 0x64, 0xd5, 0x23, 0xeb, 0x30,
|
||||
0x7e, 0x1d, 0xfa, 0x26, 0xb8, 0x25, 0x55, 0xa7, 0xe7, 0x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x8e, 0xfa, 0xad, 0x7d, 0xf0, 0x77, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x14, 0x6d, 0x36, 0xcd, 0xf9, 0x0a, 0x00, 0x00,
|
||||
// 898 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4d, 0x6f, 0xe3, 0x44,
|
||||
0x18, 0xf6, 0x24, 0x6d, 0x1d, 0xbf, 0x0e, 0x6d, 0x18, 0xf5, 0x60, 0x79, 0x8b, 0x09, 0x15, 0x82,
|
||||
0x08, 0xa1, 0x54, 0xca, 0x22, 0xbe, 0x84, 0x04, 0x4d, 0x17, 0x48, 0x28, 0x87, 0xd5, 0xac, 0x00,
|
||||
0x81, 0xc4, 0x61, 0x6a, 0x0f, 0x5b, 0x8b, 0xc4, 0xb6, 0x3c, 0x93, 0x0a, 0x5f, 0xf8, 0x07, 0x08,
|
||||
0xfe, 0x07, 0x37, 0xfe, 0x00, 0x57, 0x8e, 0x7b, 0x40, 0x88, 0x23, 0x6a, 0xff, 0x08, 0x9a, 0x0f,
|
||||
0x3b, 0x4e, 0x6a, 0x17, 0x09, 0x55, 0x42, 0xdc, 0x66, 0x9e, 0x79, 0xde, 0xf1, 0xf3, 0x7e, 0x8e,
|
||||
0xe1, 0xc5, 0x88, 0x0a, 0x7a, 0x92, 0x5d, 0x9c, 0x64, 0x79, 0x2a, 0x52, 0x7e, 0x42, 0xc3, 0x45,
|
||||
0x78, 0x49, 0x93, 0xa7, 0x8c, 0x8f, 0x15, 0x82, 0x6d, 0x9a, 0x14, 0xa2, 0xc8, 0xd8, 0xf1, 0xcf,
|
||||
0x87, 0xe0, 0x9c, 0x9e, 0x7d, 0x7a, 0xa6, 0x4e, 0xf1, 0x10, 0x5c, 0x91, 0x33, 0x36, 0x63, 0x34,
|
||||
0x9a, 0x47, 0xdc, 0x43, 0xc3, 0xee, 0xc8, 0x21, 0x75, 0x08, 0x07, 0x00, 0x34, 0x5c, 0x94, 0x84,
|
||||
0x8e, 0x22, 0xd4, 0x10, 0xfc, 0x0a, 0xec, 0xf3, 0x84, 0x66, 0xfc, 0x32, 0x15, 0x53, 0xca, 0xd9,
|
||||
0x3c, 0xf2, 0xba, 0x43, 0x34, 0x72, 0xc8, 0x16, 0x8a, 0xdf, 0x00, 0x9b, 0x86, 0x8b, 0x47, 0x54,
|
||||
0x50, 0x6f, 0x67, 0x88, 0x46, 0xee, 0xc4, 0x1f, 0x1b, 0x49, 0xe3, 0x4a, 0x8e, 0x5c, 0x49, 0x06,
|
||||
0x29, 0xa9, 0x52, 0x9f, 0xf1, 0x43, 0x59, 0xee, 0x0e, 0xd1, 0xa8, 0x4f, 0xea, 0x10, 0x1e, 0x03,
|
||||
0x0e, 0x57, 0x79, 0xce, 0x12, 0x41, 0x18, 0x8d, 0xce, 0x59, 0x31, 0xa3, 0xfc, 0xd2, 0xdb, 0x1b,
|
||||
0xa2, 0xd1, 0x0e, 0x69, 0x38, 0xc1, 0x47, 0xe0, 0x88, 0x78, 0xc9, 0xb8, 0xa0, 0xcb, 0xcc, 0xb3,
|
||||
0x87, 0x68, 0xd4, 0x25, 0x6b, 0x00, 0xfb, 0xd0, 0x8b, 0x23, 0x96, 0x88, 0x58, 0x14, 0x5e, 0x4f,
|
||||
0xf9, 0x51, 0xed, 0xfd, 0x5f, 0xba, 0x70, 0x20, 0xa5, 0xa6, 0x89, 0x60, 0x89, 0xf8, 0x9c, 0x2e,
|
||||
0x56, 0x0c, 0xbf, 0x09, 0xf6, 0x8a, 0xb3, 0xfc, 0x34, 0x8a, 0x3c, 0xd4, 0xea, 0xd5, 0x67, 0x9a,
|
||||
0x31, 0xb3, 0x48, 0x49, 0xc6, 0xef, 0x03, 0xc8, 0x25, 0x61, 0xcb, 0xf4, 0x8a, 0x79, 0x1d, 0x65,
|
||||
0xfa, 0x42, 0x8b, 0xa9, 0x26, 0xcd, 0x2c, 0x52, 0x33,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0x9d, 0x1e, 0xfd, 0x76, 0x1d, 0xa0, 0x67, 0xd7, 0x01, 0xfa, 0xeb, 0x3a, 0x40, 0x3f,
|
||||
0xdd, 0x04, 0xd6, 0xb3, 0x9b, 0xc0, 0xfa, 0xf3, 0x26, 0xb0, 0xbe, 0xea, 0x64, 0x17, 0x17, 0x7b,
|
||||
0xea, 0xdf, 0xf2, 0xe1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x2f, 0x29, 0xef, 0x7e, 0x0a,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ACLChange) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -1067,25 +1056,6 @@ func (m *ACLChange) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.LogHeads) > 0 {
|
||||
for k := range m.LogHeads {
|
||||
v := m.LogHeads[k]
|
||||
baseI := i
|
||||
i -= len(v)
|
||||
copy(dAtA[i:], v)
|
||||
i = encodeVarintAclchanges(dAtA, i, uint64(len(v)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
i -= len(k)
|
||||
copy(dAtA[i:], k)
|
||||
i = encodeVarintAclchanges(dAtA, i, uint64(len(k)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
i = encodeVarintAclchanges(dAtA, i, uint64(baseI-i))
|
||||
i--
|
||||
dAtA[i] = 0x4a
|
||||
}
|
||||
}
|
||||
if len(m.Identity) > 0 {
|
||||
i -= len(m.Identity)
|
||||
copy(dAtA[i:], m.Identity)
|
||||
|
@ -1907,14 +1877,6 @@ func (m *ACLChange) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovAclchanges(uint64(l))
|
||||
}
|
||||
if len(m.LogHeads) > 0 {
|
||||
for k, v := range m.LogHeads {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + len(k) + sovAclchanges(uint64(len(k))) + 1 + len(v) + sovAclchanges(uint64(len(v)))
|
||||
n += mapEntrySize + 1 + sovAclchanges(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -2525,133 +2487,6 @@ func (m *ACLChange) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
m.Identity = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LogHeads", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclchanges
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.LogHeads == nil {
|
||||
m.LogHeads = make(map[string]string)
|
||||
}
|
||||
var mapkey string
|
||||
var mapvalue string
|
||||
for iNdEx < postIndex {
|
||||
entryPreIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclchanges
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
if fieldNum == 1 {
|
||||
var stringLenmapkey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclchanges
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapkey |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapkey := int(stringLenmapkey)
|
||||
if intStringLenmapkey < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
postStringIndexmapkey := iNdEx + intStringLenmapkey
|
||||
if postStringIndexmapkey < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
if postStringIndexmapkey > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
|
||||
iNdEx = postStringIndexmapkey
|
||||
} else if fieldNum == 2 {
|
||||
var stringLenmapvalue uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclchanges
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapvalue |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapvalue := int(stringLenmapvalue)
|
||||
if intStringLenmapvalue < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
|
||||
if postStringIndexmapvalue < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
if postStringIndexmapvalue > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
|
||||
iNdEx = postStringIndexmapvalue
|
||||
} else {
|
||||
iNdEx = entryPreIndex
|
||||
skippy, err := skipAclchanges(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthAclchanges
|
||||
}
|
||||
if (iNdEx + skippy) > postIndex {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
m.LogHeads[mapkey] = mapvalue
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAclchanges(dAtA[iNdEx:])
|
||||
|
|
1088
data/pb/plaintextchanges.pb.go
Normal file
1088
data/pb/plaintextchanges.pb.go
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,6 @@ message ACLChange {
|
|||
uint64 currentReadKeyHash = 6;
|
||||
int64 timestamp = 7;
|
||||
string identity = 8;
|
||||
map<string, string> logHeads = 9;
|
||||
|
||||
message ACLContentValue {
|
||||
oneof value {
|
||||
|
|
24
data/pb/protos/plaintextchanges.proto
Normal file
24
data/pb/protos/plaintextchanges.proto
Normal file
|
@ -0,0 +1,24 @@
|
|||
syntax = "proto3";
|
||||
package anytype;
|
||||
option go_package = "pb";
|
||||
|
||||
message PlainTextChange {
|
||||
message Content {
|
||||
oneof value {
|
||||
TextAppend textAppend = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message TextAppend {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message Snapshot {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message Data {
|
||||
repeated Content content = 1;
|
||||
Snapshot snapshot = 2;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
thread:
|
||||
author: A
|
||||
logs:
|
||||
- id: A.1
|
||||
identity: A
|
||||
records:
|
||||
changes:
|
||||
- id: A.1.1
|
||||
identity: A
|
||||
aclSnapshot:
|
||||
userStates:
|
||||
- identity: A
|
||||
|
@ -31,6 +29,7 @@ logs:
|
|||
encryptedReadKeys: [key.Read.1]
|
||||
readKey: key.Read.1
|
||||
- id: A.1.2
|
||||
identity: A
|
||||
aclSnapshot:
|
||||
userStates:
|
||||
- identity: A
|
||||
|
@ -56,6 +55,7 @@ logs:
|
|||
encryptedReadKeys: [key.Read.1]
|
||||
readKey: key.Read.1
|
||||
- id: A.1.3
|
||||
identity: A
|
||||
aclChanges:
|
||||
- userAdd:
|
||||
identity: E
|
||||
|
@ -63,10 +63,8 @@ logs:
|
|||
encryptionKey: key.Enc.E
|
||||
encryptedReadKeys: [key.Read.1]
|
||||
readKey: key.Read.1
|
||||
- id: B.1
|
||||
identity: B
|
||||
records:
|
||||
- id: B.1.1
|
||||
identity: B
|
||||
aclChanges:
|
||||
- userAdd:
|
||||
identity: C
|
||||
|
@ -75,6 +73,7 @@ logs:
|
|||
encryptedReadKeys: [ key.Read.1 ]
|
||||
readKey: key.Read.1
|
||||
- id: B.1.2
|
||||
identity: B
|
||||
aclChanges:
|
||||
- userAdd:
|
||||
identity: F
|
||||
|
@ -120,3 +119,6 @@ graph:
|
|||
baseSnapshot: A.1.2
|
||||
aclHeads: [A.1.2]
|
||||
treeHeads: [A.1.2]
|
||||
heads:
|
||||
- A.1.3
|
||||
- B.1.2
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package threadbuilder
|
||||
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/textileio/go-threads/crypto/symmetric"
|
||||
"hash/fnv"
|
||||
"strings"
|
||||
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/textileio/go-threads/crypto/symmetric"
|
||||
)
|
||||
|
||||
type SymKey struct {
|
||||
|
|
|
@ -3,43 +3,36 @@ package threadbuilder
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/lib/core/smartblock"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/lib/pb/model"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
)
|
||||
|
||||
type threadRecord struct {
|
||||
const plainTextDocType uint16 = 1
|
||||
|
||||
type threadChange struct {
|
||||
*pb.ACLChange
|
||||
id string
|
||||
logId string
|
||||
readKey *SymKey
|
||||
signKey threadmodels.SigningPrivKey
|
||||
|
||||
prevRecord *threadRecord
|
||||
changesData *pb.ACLChangeChangeData
|
||||
}
|
||||
|
||||
type threadLog struct {
|
||||
id string
|
||||
owner string
|
||||
records []*threadRecord
|
||||
changesData *pb.PlainTextChangeData
|
||||
}
|
||||
|
||||
type ThreadBuilder struct {
|
||||
threadId string
|
||||
logs map[string]*threadLog
|
||||
allRecords map[string]*threadRecord
|
||||
allChanges map[string]*threadChange
|
||||
heads []string
|
||||
keychain *Keychain
|
||||
}
|
||||
|
||||
func NewThreadBuilder(keychain *Keychain) *ThreadBuilder {
|
||||
return &ThreadBuilder{
|
||||
logs: make(map[string]*threadLog),
|
||||
allRecords: make(map[string]*threadRecord),
|
||||
allChanges: make(map[string]*threadChange),
|
||||
keychain: keychain,
|
||||
}
|
||||
}
|
||||
|
@ -70,27 +63,13 @@ func (t *ThreadBuilder) GetKeychain() *Keychain {
|
|||
return t.keychain
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) GetLogs() ([]threadmodels.ThreadLog, error) {
|
||||
var logs []threadmodels.ThreadLog
|
||||
for _, l := range t.logs {
|
||||
logs = append(logs, threadmodels.ThreadLog{
|
||||
ID: l.id,
|
||||
Head: l.records[len(l.records)-1].id,
|
||||
Counter: int64(len(l.records)),
|
||||
})
|
||||
}
|
||||
sort.Slice(logs, func(i, j int) bool {
|
||||
return logs[i].ID < logs[j].ID
|
||||
})
|
||||
return logs, nil
|
||||
}
|
||||
// writer can create docs -> id can create writer permissions
|
||||
// by id we can check who created
|
||||
// at the same time this guy can add some random folks which are not in space
|
||||
// but we should compare this against space in the future
|
||||
|
||||
func (t *ThreadBuilder) GetRecord(ctx context.Context, recordID string) (*threadmodels.ThreadRecord, error) {
|
||||
rec := t.allRecords[recordID]
|
||||
prevId := ""
|
||||
if rec.prevRecord != nil {
|
||||
prevId = rec.prevRecord.id
|
||||
}
|
||||
func (t *ThreadBuilder) GetChange(ctx context.Context, recordID string) (*threadmodels.RawChange, error) {
|
||||
rec := t.allChanges[recordID]
|
||||
|
||||
var encrypted []byte
|
||||
if rec.changesData != nil {
|
||||
|
@ -117,19 +96,15 @@ func (t *ThreadBuilder) GetRecord(ctx context.Context, recordID string) (*thread
|
|||
panic("should be able to sign final acl message!")
|
||||
}
|
||||
|
||||
transformedRec := &threadmodels.ThreadRecord{
|
||||
PrevId: prevId,
|
||||
Id: rec.id,
|
||||
LogId: rec.logId,
|
||||
Signed: &threadmodels.SignedPayload{
|
||||
transformedRec := &threadmodels.RawChange{
|
||||
Payload: aclMarshaled,
|
||||
Signature: signature,
|
||||
},
|
||||
Id: recordID,
|
||||
}
|
||||
return transformedRec, nil
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) PushRecord(payload proto.Marshaler) (id string, err error) {
|
||||
func (t *ThreadBuilder) PushChange(payload proto.Marshaler) (id string, err error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
|
@ -139,63 +114,49 @@ func (t *ThreadBuilder) Parse(thread *YMLThread) {
|
|||
// the same thing is happening for the encryption keys
|
||||
t.keychain.ParseKeys(&thread.Keys)
|
||||
t.threadId = t.parseThreadId(thread.Description)
|
||||
for _, l := range thread.Logs {
|
||||
newLog := &threadLog{
|
||||
id: l.Id,
|
||||
owner: t.keychain.GetIdentity(l.Identity),
|
||||
for _, ch := range thread.Changes {
|
||||
newChange := &threadChange{
|
||||
id: ch.Id,
|
||||
}
|
||||
var records []*threadRecord
|
||||
for _, r := range l.Records {
|
||||
newRecord := &threadRecord{
|
||||
id: r.Id,
|
||||
logId: newLog.id,
|
||||
}
|
||||
if len(records) > 0 {
|
||||
newRecord.prevRecord = records[len(records)-1]
|
||||
}
|
||||
k := t.keychain.GetKey(r.ReadKey).(*SymKey)
|
||||
newRecord.readKey = k
|
||||
newRecord.signKey = t.keychain.SigningKeys[l.Identity]
|
||||
|
||||
k := t.keychain.GetKey(ch.ReadKey).(*SymKey)
|
||||
newChange.readKey = k
|
||||
newChange.signKey = t.keychain.SigningKeys[ch.Identity]
|
||||
aclChange := &pb.ACLChange{}
|
||||
aclChange.Identity = newLog.owner
|
||||
if len(r.AclChanges) > 0 || r.AclSnapshot != nil {
|
||||
aclChange.Identity = newChange.Identity
|
||||
if len(ch.AclChanges) > 0 || ch.AclSnapshot != nil {
|
||||
aclChange.AclData = &pb.ACLChangeACLData{}
|
||||
if r.AclSnapshot != nil {
|
||||
aclChange.AclData.AclSnapshot = t.parseACLSnapshot(r.AclSnapshot)
|
||||
if ch.AclSnapshot != nil {
|
||||
aclChange.AclData.AclSnapshot = t.parseACLSnapshot(ch.AclSnapshot)
|
||||
}
|
||||
if r.AclChanges != nil {
|
||||
if ch.AclChanges != nil {
|
||||
var aclChangeContents []*pb.ACLChangeACLContentValue
|
||||
for _, ch := range r.AclChanges {
|
||||
for _, ch := range ch.AclChanges {
|
||||
aclChangeContent := t.parseACLChange(ch)
|
||||
aclChangeContents = append(aclChangeContents, aclChangeContent)
|
||||
}
|
||||
aclChange.AclData.AclContent = aclChangeContents
|
||||
}
|
||||
}
|
||||
if len(r.Changes) > 0 || r.Snapshot != nil {
|
||||
newRecord.changesData = &pb.ACLChangeChangeData{}
|
||||
if r.Snapshot != nil {
|
||||
newRecord.changesData.Snapshot = t.parseChangeSnapshot(r.Snapshot)
|
||||
if len(ch.Changes) > 0 || ch.Snapshot != nil {
|
||||
newChange.changesData = &pb.PlainTextChangeData{}
|
||||
if ch.Snapshot != nil {
|
||||
newChange.changesData.Snapshot = t.parseChangeSnapshot(ch.Snapshot)
|
||||
}
|
||||
if len(r.Changes) > 0 {
|
||||
var changeContents []*pb.ChangeContent
|
||||
for _, ch := range r.Changes {
|
||||
if len(ch.Changes) > 0 {
|
||||
var changeContents []*pb.PlainTextChangeContent
|
||||
for _, ch := range ch.Changes {
|
||||
aclChangeContent := t.parseDocumentChange(ch)
|
||||
changeContents = append(changeContents, aclChangeContent)
|
||||
}
|
||||
newRecord.changesData.Content = changeContents
|
||||
newChange.changesData.Content = changeContents
|
||||
}
|
||||
}
|
||||
aclChange.CurrentReadKeyHash = k.Hash
|
||||
newRecord.ACLChange = aclChange
|
||||
t.allRecords[newRecord.id] = newRecord
|
||||
records = append(records, newRecord)
|
||||
}
|
||||
newLog.records = records
|
||||
t.logs[newLog.id] = newLog
|
||||
newChange.ACLChange = aclChange
|
||||
t.allChanges[newChange.id] = newChange
|
||||
}
|
||||
t.parseGraph(thread)
|
||||
t.parseHeads(thread)
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
|
||||
|
@ -203,7 +164,7 @@ func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
|
|||
panic("no author in thread")
|
||||
}
|
||||
key := t.keychain.SigningKeys[description.Author]
|
||||
id, err := threadmodels.CreateACLThreadID(key.GetPublic(), smartblock.SmartBlockTypeWorkspace)
|
||||
id, err := threadmodels.CreateACLThreadID(key.GetPublic(), plainTextDocType)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -211,16 +172,9 @@ func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
|
|||
return id.String()
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) parseChangeSnapshot(s *ChangeSnapshot) *pb.ChangeSnapshot {
|
||||
data := &model.SmartBlockSnapshotBase{}
|
||||
var blocks []*model.Block
|
||||
for _, b := range s.Blocks {
|
||||
modelBlock := &model.Block{Id: b.Id, ChildrenIds: b.ChildrenIds}
|
||||
blocks = append(blocks, modelBlock)
|
||||
}
|
||||
data.Blocks = blocks
|
||||
return &pb.ChangeSnapshot{
|
||||
Data: data,
|
||||
func (t *ThreadBuilder) parseChangeSnapshot(s *PlainTextSnapshot) *pb.PlainTextChangeSnapshot {
|
||||
return &pb.PlainTextChangeSnapshot{
|
||||
Text: s.Text,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,18 +198,16 @@ func (t *ThreadBuilder) parseACLSnapshot(s *ACLSnapshot) *pb.ACLChangeACLSnapsho
|
|||
}
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) parseDocumentChange(ch *DocumentChange) (convCh *pb.ChangeContent) {
|
||||
func (t *ThreadBuilder) parseDocumentChange(ch *PlainTextChange) (convCh *pb.PlainTextChangeContent) {
|
||||
switch {
|
||||
case ch.BlockAdd != nil:
|
||||
blockAdd := ch.BlockAdd
|
||||
|
||||
convCh = &pb.ChangeContent{
|
||||
Value: &pb.ChangeContentValueOfBlockCreate{
|
||||
BlockCreate: &pb.ChangeBlockCreate{
|
||||
TargetId: blockAdd.TargetId,
|
||||
Position: model.Block_Inner,
|
||||
Blocks: []*model.Block{&model.Block{Id: blockAdd.Id}},
|
||||
}}}
|
||||
case ch.TextAppend != nil:
|
||||
convCh = &pb.PlainTextChangeContent{
|
||||
Value: &pb.PlainTextChangeContentValueOfTextAppend{
|
||||
TextAppend: &pb.PlainTextChangeTextAppend{
|
||||
Text: ch.TextAppend.Text,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
if convCh == nil {
|
||||
panic("cannot have empty document change")
|
||||
|
@ -410,25 +362,24 @@ func (t *ThreadBuilder) convertPermission(perm string) pb.ACLChangeUserPermissio
|
|||
}
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) traverseFromHeads(f func(t *threadRecord) error) error {
|
||||
allLogs, err := t.GetLogs()
|
||||
if err != nil {
|
||||
func (t *ThreadBuilder) traverseFromHeads(f func(t *threadChange) error) error {
|
||||
uniqMap := map[string]struct{}{}
|
||||
stack := t.heads
|
||||
for len(stack) > 0 {
|
||||
id := stack[len(stack)-1]
|
||||
stack = stack[:len(stack)-1]
|
||||
if _, exists := uniqMap[id]; exists {
|
||||
continue
|
||||
}
|
||||
|
||||
ch := t.allChanges[id]
|
||||
uniqMap[id] = struct{}{}
|
||||
if err := f(ch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, log := range allLogs {
|
||||
head := t.allRecords[log.Head]
|
||||
err = f(head)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for head.prevRecord != nil {
|
||||
head = head.prevRecord
|
||||
err = f(head)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, prev := range ch.ACLChange.TreeHeadIds {
|
||||
stack = append(stack, prev)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -436,9 +387,13 @@ func (t *ThreadBuilder) traverseFromHeads(f func(t *threadRecord) error) error {
|
|||
|
||||
func (t *ThreadBuilder) parseGraph(thread *YMLThread) {
|
||||
for _, node := range thread.Graph {
|
||||
rec := t.allRecords[node.Id]
|
||||
rec := t.allChanges[node.Id]
|
||||
rec.AclHeadIds = node.ACLHeads
|
||||
rec.TreeHeadIds = node.TreeHeads
|
||||
rec.SnapshotBaseId = node.BaseSnapshot
|
||||
}
|
||||
}
|
||||
|
||||
func (t *ThreadBuilder) parseHeads(thread *YMLThread) {
|
||||
t.heads = thread.Heads
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ func (t *ThreadBuilder) Graph() (string, error) {
|
|||
graph.SetDir(true)
|
||||
var nodes = make(map[string]struct{})
|
||||
|
||||
var addNodes = func(r *threadRecord) error {
|
||||
var addNodes = func(r *threadChange) error {
|
||||
// TODO: revisit function after checking
|
||||
|
||||
style := "solid"
|
||||
|
@ -105,7 +105,7 @@ func (t *ThreadBuilder) Graph() (string, error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
var addLinks = func(t *threadRecord) error {
|
||||
var addLinks = func(t *threadChange) error {
|
||||
for _, prevId := range t.AclHeadIds {
|
||||
err := createEdge(t.id, prevId, EdgeParameters{
|
||||
style: "dashed",
|
||||
|
|
|
@ -20,11 +20,8 @@ type ACLSnapshot struct {
|
|||
} `yaml:"userStates"`
|
||||
}
|
||||
|
||||
type ChangeSnapshot struct {
|
||||
Blocks []struct {
|
||||
Id string `yaml:"id"`
|
||||
ChildrenIds []string `yaml:"childrenIds"`
|
||||
} `yaml:"blocks"`
|
||||
type PlainTextSnapshot struct {
|
||||
Text string `yaml:"text"`
|
||||
}
|
||||
|
||||
type ACLChange struct {
|
||||
|
@ -67,29 +64,25 @@ type ACLChange struct {
|
|||
}
|
||||
}
|
||||
|
||||
type DocumentChange struct {
|
||||
BlockAdd *struct {
|
||||
Id string `yaml:"id"`
|
||||
TargetId string `yaml:"targetId"`
|
||||
type PlainTextChange struct {
|
||||
TextAppend *struct {
|
||||
Text string `yaml:"text"`
|
||||
} `yaml:"blockAdd"`
|
||||
}
|
||||
|
||||
type YMLThread struct {
|
||||
Description *ThreadDescription `yaml:"thread"`
|
||||
Logs []struct {
|
||||
Changes []struct {
|
||||
Id string `yaml:"id"`
|
||||
Identity string `yaml:"identity"`
|
||||
Records []struct {
|
||||
Id string `yaml:"id"`
|
||||
|
||||
AclSnapshot *ACLSnapshot `yaml:"aclSnapshot"`
|
||||
Snapshot *ChangeSnapshot `yaml:"snapshot"`
|
||||
Snapshot *PlainTextSnapshot `yaml:"snapshot"`
|
||||
AclChanges []*ACLChange `yaml:"aclChanges"`
|
||||
Changes []*DocumentChange `yaml:"changes"`
|
||||
Changes []*PlainTextChange `yaml:"changes"`
|
||||
|
||||
ReadKey string `yaml:"readKey"`
|
||||
} `yaml:"records"`
|
||||
} `yaml:"logs"`
|
||||
} `yaml:"changes"`
|
||||
|
||||
Keys Keys `yaml:"keys"`
|
||||
|
||||
|
@ -100,4 +93,6 @@ type YMLThread struct {
|
|||
ACLHeads []string `yaml:"aclHeads"`
|
||||
TreeHeads []string `yaml:"treeHeads"`
|
||||
} `yaml:"graph"`
|
||||
|
||||
Heads []string `yaml:"heads"`
|
||||
}
|
||||
|
|
|
@ -2,33 +2,17 @@ package threadmodels
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type Thread interface {
|
||||
ID() string
|
||||
GetLogs() ([]ThreadLog, error)
|
||||
GetRecord(ctx context.Context, recordID string) (*ThreadRecord, error)
|
||||
PushRecord(payload proto.Marshaler) (id string, err error)
|
||||
|
||||
// SubscribeForRecords()
|
||||
GetChange(ctx context.Context, recordID string) (*RawChange, error)
|
||||
PushChange(payload proto.Marshaler) (id string, err error)
|
||||
}
|
||||
|
||||
type SignedPayload struct {
|
||||
type RawChange struct {
|
||||
Payload []byte
|
||||
Signature []byte
|
||||
}
|
||||
|
||||
type ThreadRecord struct {
|
||||
PrevId string
|
||||
Id string
|
||||
LogId string
|
||||
Signed *SignedPayload
|
||||
}
|
||||
|
||||
type ThreadLog struct {
|
||||
ID string
|
||||
Head string
|
||||
Counter int64
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/lib/core/smartblock"
|
||||
"github.com/textileio/go-threads/core/thread"
|
||||
"hash/fnv"
|
||||
|
||||
"github.com/textileio/go-threads/core/thread"
|
||||
)
|
||||
|
||||
func CreateACLThreadID(k SigningPubKey, blockType smartblock.SmartBlockType) (thread.ID, error) {
|
||||
func CreateACLThreadID(k SigningPubKey, docType uint16) (thread.ID, error) {
|
||||
rndlen := 32
|
||||
buf := make([]byte, 8+rndlen)
|
||||
|
||||
|
@ -31,7 +31,7 @@ func CreateACLThreadID(k SigningPubKey, blockType smartblock.SmartBlockType) (th
|
|||
// putting hash of the pubkey in the beginning
|
||||
binary.LittleEndian.PutUint64(buf[:8], res)
|
||||
|
||||
return threadIDFromBytes(blockType, buf)
|
||||
return threadIDFromBytes(docType, buf)
|
||||
}
|
||||
|
||||
func VerifyACLThreadID(k SigningPubKey, threadId thread.ID) (bool, error) {
|
||||
|
@ -52,7 +52,7 @@ func VerifyACLThreadID(k SigningPubKey, threadId thread.ID) (bool, error) {
|
|||
}
|
||||
|
||||
func threadIDFromBytes(
|
||||
blockType smartblock.SmartBlockType,
|
||||
docType uint16,
|
||||
b []byte) (thread.ID, error) {
|
||||
blen := len(b)
|
||||
|
||||
|
@ -60,7 +60,7 @@ func threadIDFromBytes(
|
|||
buf := make([]byte, 2*binary.MaxVarintLen64+blen)
|
||||
n := binary.PutUvarint(buf, thread.V1)
|
||||
n += binary.PutUvarint(buf[n:], uint64(thread.AccessControlled))
|
||||
n += binary.PutUvarint(buf[n:], uint64(blockType))
|
||||
n += binary.PutUvarint(buf[n:], uint64(docType))
|
||||
|
||||
cn := copy(buf[n:], b)
|
||||
if cn != blen {
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/lib/logging"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
@ -48,7 +48,7 @@ func (tb *TreeBuilder) loadChange(id string) (ch *Change, err error) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
|
||||
defer cancel()
|
||||
|
||||
record, err := tb.thread.GetRecord(ctx, id)
|
||||
record, err := tb.thread.GetChange(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,6 +4,8 @@ go 1.18
|
|||
|
||||
require (
|
||||
github.com/textileio/go-threads v1.0.2-0.20210304072541-d0f91da84404
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
||||
)
|
||||
|
||||
replace github.com/textileio/go-threads => github.com/anytypeio/go-threads v1.1.0-rc1.0.20220223104843-a67245cee80e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue