Rework threadbuilder for new change format

This commit is contained in:
mcrakhman 2022-06-30 18:52:20 +02:00 committed by Mikhail Iudin
parent 53a9bb5fc5
commit 4ac1f633d4
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
19 changed files with 1407 additions and 519 deletions

View File

@ -16,7 +16,8 @@ protos-go:
@echo 'Generating protobuf packages (Go)...' @echo 'Generating protobuf packages (Go)...'
$(eval P_TIMESTAMP := Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types) $(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_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 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

View File

@ -4,10 +4,11 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "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" "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") var ErrNoSuchUser = errors.New("no such user")

View File

@ -2,8 +2,9 @@ package data
import ( import (
"fmt" "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/data/threadmodels"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
) )
type ACLStateBuilder struct { type ACLStateBuilder struct {

View File

@ -1,9 +1,9 @@
package data package data
import ( 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/threadbuilder"
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels" "github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing" "testing"
) )

View File

@ -3,8 +3,8 @@ package data
import ( import (
"context" "context"
"fmt" "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/data/threadmodels"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pb"
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/textileio/go-threads/core/thread" "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) ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel() defer cancel()
record, err := tb.thread.GetRecord(ctx, id) record, err := tb.thread.GetChange(ctx, id)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -3,7 +3,7 @@ package data
import ( import (
"fmt" "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/gogo/protobuf/proto"
"github.com/textileio/go-threads/crypto/symmetric" "github.com/textileio/go-threads/crypto/symmetric"
) )

View File

@ -60,11 +60,10 @@ type ACLChange struct {
SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"` SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"`
AclData *ACLChangeACLData `protobuf:"bytes,4,opt,name=aclData,proto3" json:"aclData,omitempty"` AclData *ACLChangeACLData `protobuf:"bytes,4,opt,name=aclData,proto3" json:"aclData,omitempty"`
// the data is encoded with read key and should be read in ChangesData format // the data is encoded with read key and should be read in ChangesData format
ChangesData []byte `protobuf:"bytes,5,opt,name=changesData,proto3" json:"changesData,omitempty"` ChangesData []byte `protobuf:"bytes,5,opt,name=changesData,proto3" json:"changesData,omitempty"`
CurrentReadKeyHash uint64 `protobuf:"varint,6,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` CurrentReadKeyHash uint64 `protobuf:"varint,6,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"`
Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,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"` 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{} } func (m *ACLChange) Reset() { *m = ACLChange{} }
@ -156,13 +155,6 @@ func (m *ACLChange) GetIdentity() string {
return "" return ""
} }
func (m *ACLChange) GetLogHeads() map[string]string {
if m != nil {
return m.LogHeads
}
return nil
}
type ACLChangeACLContentValue struct { type ACLChangeACLContentValue struct {
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// *ACLChangeACLContentValueValueOfUserAdd // *ACLChangeACLContentValueValueOfUserAdd
@ -178,7 +170,7 @@ func (m *ACLChangeACLContentValue) Reset() { *m = ACLChangeACLContentVal
func (m *ACLChangeACLContentValue) String() string { return proto.CompactTextString(m) } func (m *ACLChangeACLContentValue) String() string { return proto.CompactTextString(m) }
func (*ACLChangeACLContentValue) ProtoMessage() {} func (*ACLChangeACLContentValue) ProtoMessage() {}
func (*ACLChangeACLContentValue) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeACLContentValue) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -309,7 +301,7 @@ func (m *ACLChangeACLData) Reset() { *m = ACLChangeACLData{} }
func (m *ACLChangeACLData) String() string { return proto.CompactTextString(m) } func (m *ACLChangeACLData) String() string { return proto.CompactTextString(m) }
func (*ACLChangeACLData) ProtoMessage() {} func (*ACLChangeACLData) ProtoMessage() {}
func (*ACLChangeACLData) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeACLData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -361,7 +353,7 @@ func (m *ACLChangeACLSnapshot) Reset() { *m = ACLChangeACLSnapshot{} }
func (m *ACLChangeACLSnapshot) String() string { return proto.CompactTextString(m) } func (m *ACLChangeACLSnapshot) String() string { return proto.CompactTextString(m) }
func (*ACLChangeACLSnapshot) ProtoMessage() {} func (*ACLChangeACLSnapshot) ProtoMessage() {}
func (*ACLChangeACLSnapshot) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeACLSnapshot) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -407,7 +399,7 @@ func (m *ACLChangeACLState) Reset() { *m = ACLChangeACLState{} }
func (m *ACLChangeACLState) String() string { return proto.CompactTextString(m) } func (m *ACLChangeACLState) String() string { return proto.CompactTextString(m) }
func (*ACLChangeACLState) ProtoMessage() {} func (*ACLChangeACLState) ProtoMessage() {}
func (*ACLChangeACLState) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeACLState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -469,7 +461,7 @@ func (m *ACLChangeUserState) Reset() { *m = ACLChangeUserState{} }
func (m *ACLChangeUserState) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserState) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserState) ProtoMessage() {} func (*ACLChangeUserState) ProtoMessage() {}
func (*ACLChangeUserState) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -545,7 +537,7 @@ func (m *ACLChangeUserAdd) Reset() { *m = ACLChangeUserAdd{} }
func (m *ACLChangeUserAdd) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserAdd) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserAdd) ProtoMessage() {} func (*ACLChangeUserAdd) ProtoMessage() {}
func (*ACLChangeUserAdd) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserAdd) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -612,7 +604,7 @@ func (m *ACLChangeUserConfirm) Reset() { *m = ACLChangeUserConfirm{} }
func (m *ACLChangeUserConfirm) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserConfirm) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserConfirm) ProtoMessage() {} func (*ACLChangeUserConfirm) ProtoMessage() {}
func (*ACLChangeUserConfirm) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserConfirm) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -666,7 +658,7 @@ func (m *ACLChangeUserInvite) Reset() { *m = ACLChangeUserInvite{} }
func (m *ACLChangeUserInvite) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserInvite) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserInvite) ProtoMessage() {} func (*ACLChangeUserInvite) ProtoMessage() {}
func (*ACLChangeUserInvite) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserInvite) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -735,7 +727,7 @@ func (m *ACLChangeUserJoin) Reset() { *m = ACLChangeUserJoin{} }
func (m *ACLChangeUserJoin) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserJoin) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserJoin) ProtoMessage() {} func (*ACLChangeUserJoin) ProtoMessage() {}
func (*ACLChangeUserJoin) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserJoin) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -808,7 +800,7 @@ func (m *ACLChangeUserRemove) Reset() { *m = ACLChangeUserRemove{} }
func (m *ACLChangeUserRemove) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserRemove) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserRemove) ProtoMessage() {} func (*ACLChangeUserRemove) ProtoMessage() {}
func (*ACLChangeUserRemove) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserRemove) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -861,7 +853,7 @@ func (m *ACLChangeReadKeyReplace) Reset() { *m = ACLChangeReadKeyReplace
func (m *ACLChangeReadKeyReplace) String() string { return proto.CompactTextString(m) } func (m *ACLChangeReadKeyReplace) String() string { return proto.CompactTextString(m) }
func (*ACLChangeReadKeyReplace) ProtoMessage() {} func (*ACLChangeReadKeyReplace) ProtoMessage() {}
func (*ACLChangeReadKeyReplace) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeReadKeyReplace) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -920,7 +912,7 @@ func (m *ACLChangeUserPermissionChange) Reset() { *m = ACLChangeUserPerm
func (m *ACLChangeUserPermissionChange) String() string { return proto.CompactTextString(m) } func (m *ACLChangeUserPermissionChange) String() string { return proto.CompactTextString(m) }
func (*ACLChangeUserPermissionChange) ProtoMessage() {} func (*ACLChangeUserPermissionChange) ProtoMessage() {}
func (*ACLChangeUserPermissionChange) Descriptor() ([]byte, []int) { 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 { func (m *ACLChangeUserPermissionChange) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -966,7 +958,6 @@ func (m *ACLChangeUserPermissionChange) GetPermissions() ACLChangeUserPermission
func init() { func init() {
proto.RegisterEnum("anytype.ACLChangeUserPermissions", ACLChangeUserPermissions_name, ACLChangeUserPermissions_value) proto.RegisterEnum("anytype.ACLChangeUserPermissions", ACLChangeUserPermissions_name, ACLChangeUserPermissions_value)
proto.RegisterType((*ACLChange)(nil), "anytype.ACLChange") proto.RegisterType((*ACLChange)(nil), "anytype.ACLChange")
proto.RegisterMapType((map[string]string)(nil), "anytype.ACLChange.LogHeadsEntry")
proto.RegisterType((*ACLChangeACLContentValue)(nil), "anytype.ACLChange.ACLContentValue") proto.RegisterType((*ACLChangeACLContentValue)(nil), "anytype.ACLChange.ACLContentValue")
proto.RegisterType((*ACLChangeACLData)(nil), "anytype.ACLChange.ACLData") proto.RegisterType((*ACLChangeACLData)(nil), "anytype.ACLChange.ACLData")
proto.RegisterType((*ACLChangeACLSnapshot)(nil), "anytype.ACLChange.ACLSnapshot") proto.RegisterType((*ACLChangeACLSnapshot)(nil), "anytype.ACLChange.ACLSnapshot")
@ -985,66 +976,64 @@ func init() {
func init() { proto.RegisterFile("data/pb/protos/aclchanges.proto", fileDescriptor_5a15109171a9dc49) } func init() { proto.RegisterFile("data/pb/protos/aclchanges.proto", fileDescriptor_5a15109171a9dc49) }
var fileDescriptor_5a15109171a9dc49 = []byte{ var fileDescriptor_5a15109171a9dc49 = []byte{
// 938 bytes of a gzipped FileDescriptorProto // 898 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdd, 0x6e, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4d, 0x6f, 0xe3, 0x44,
0x14, 0xce, 0x24, 0x6d, 0x1d, 0x1f, 0x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, 0x76, 0x8e, 0x6d, 0xd8, 0x3e, 0x89, 0x67, 0x68, 0xd0, 0x9d, 0x1e, 0xfd, 0x76, 0x1d, 0xa0, 0x67, 0xd7, 0x01, 0xfa, 0xeb, 0x3a, 0x40, 0x3f,
0x49, 0xda, 0x6f, 0x61, 0x80, 0x9d, 0x2f, 0x8a, 0x44, 0xb0, 0xa2, 0x8f, 0xe4, 0x5a, 0xba, 0xcb, 0xdd, 0x04, 0xd6, 0xb3, 0x9b, 0xc0, 0xfa, 0xf3, 0x26, 0xb0, 0xbe, 0xea, 0x64, 0x17, 0x17, 0x7b,
0x8a, 0x7e, 0x1b, 0x3b, 0x60, 0xe9, 0x12, 0xc5, 0xfd, 0xce, 0xe8, 0xf0, 0xb7, 0x6b, 0x1f, 0x3d, 0xea, 0xdf, 0xf2, 0xe1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x2f, 0x29, 0xef, 0x7e, 0x0a,
0xbb, 0xf6, 0xd1, 0x5f, 0xd7, 0x3e, 0xfa, 0xe9, 0xc6, 0x6f, 0x3d, 0xbb, 0xf1, 0x5b, 0x7f, 0xde, 0x00, 0x00,
0xf8, 0xad, 0xaf, 0xda, 0xf9, 0xf9, 0xf9, 0x8e, 0xfa, 0xad, 0x7d, 0xf0, 0x77, 0x00, 0x00, 0x00,
0xff, 0xff, 0x14, 0x6d, 0x36, 0xcd, 0xf9, 0x0a, 0x00, 0x00,
} }
func (m *ACLChange) Marshal() (dAtA []byte, err error) { func (m *ACLChange) Marshal() (dAtA []byte, err error) {
@ -1067,25 +1056,6 @@ func (m *ACLChange) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = 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 { if len(m.Identity) > 0 {
i -= len(m.Identity) i -= len(m.Identity)
copy(dAtA[i:], m.Identity) copy(dAtA[i:], m.Identity)
@ -1907,14 +1877,6 @@ func (m *ACLChange) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovAclchanges(uint64(l)) 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 return n
} }
@ -2525,133 +2487,6 @@ func (m *ACLChange) Unmarshal(dAtA []byte) error {
} }
m.Identity = string(dAtA[iNdEx:postIndex]) m.Identity = string(dAtA[iNdEx:postIndex])
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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipAclchanges(dAtA[iNdEx:]) skippy, err := skipAclchanges(dAtA[iNdEx:])

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,6 @@ message ACLChange {
uint64 currentReadKeyHash = 6; uint64 currentReadKeyHash = 6;
int64 timestamp = 7; int64 timestamp = 7;
string identity = 8; string identity = 8;
map<string, string> logHeads = 9;
message ACLContentValue { message ACLContentValue {
oneof value { oneof value {

View 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;
}
}

View File

@ -1,87 +1,86 @@
thread: thread:
author: A author: A
logs: changes:
- id: A.1 - id: A.1.1
identity: A identity: A
records: aclSnapshot:
- id: A.1.1 userStates:
aclSnapshot: - identity: A
userStates: encryptionKey: key.Enc.A
- identity: A encryptedReadKeys: [key.Read.1]
encryptionKey: key.Enc.A permission: admin
encryptedReadKeys: [key.Read.1] - identity: B
permission: admin encryptionKey: key.Enc.B
- identity: B encryptedReadKeys: [key.Read.1]
encryptionKey: key.Enc.B permission: admin
encryptedReadKeys: [key.Read.1] snapshot:
permission: admin blocks:
snapshot: - id: root
blocks: aclChanges:
- id: root - userAdd:
aclChanges: identity: A
- userAdd: permission: admin
identity: A encryptionKey: key.Enc.A
permission: admin encryptedReadKeys: [key.Read.1]
encryptionKey: key.Enc.A - userAdd:
encryptedReadKeys: [key.Read.1] identity: B
- userAdd: permission: admin
identity: B encryptionKey: key.Enc.B
permission: admin encryptedReadKeys: [key.Read.1]
encryptionKey: key.Enc.B readKey: key.Read.1
encryptedReadKeys: [key.Read.1] - id: A.1.2
readKey: key.Read.1 identity: A
- id: A.1.2 aclSnapshot:
aclSnapshot: userStates:
userStates: - identity: A
- identity: A encryptionKey: key.Enc.A
encryptionKey: key.Enc.A encryptedReadKeys: [key.Read.1]
encryptedReadKeys: [key.Read.1] permission: admin
permission: admin - identity: B
- identity: B encryptionKey: key.Enc.B
encryptionKey: key.Enc.B encryptedReadKeys: [key.Read.1]
encryptedReadKeys: [key.Read.1] permission: admin
permission: admin - identity: D
- identity: D encryptionKey: key.Enc.D
encryptionKey: key.Enc.D encryptedReadKeys: [ key.Read.1 ]
encryptedReadKeys: [ key.Read.1 ] permission: admin
permission: admin snapshot:
snapshot: blocks:
blocks: - id: root
- id: root aclChanges:
aclChanges: - userAdd:
- userAdd: identity: D
identity: D permission: admin
permission: admin encryptionKey: key.Enc.D
encryptionKey: key.Enc.D encryptedReadKeys: [key.Read.1]
encryptedReadKeys: [key.Read.1] readKey: key.Read.1
readKey: key.Read.1 - id: A.1.3
- id: A.1.3 identity: A
aclChanges: aclChanges:
- userAdd: - userAdd:
identity: E identity: E
permission: admin permission: admin
encryptionKey: key.Enc.E encryptionKey: key.Enc.E
encryptedReadKeys: [key.Read.1] encryptedReadKeys: [key.Read.1]
readKey: key.Read.1 readKey: key.Read.1
- id: B.1 - id: B.1.1
identity: B identity: B
records: aclChanges:
- id: B.1.1 - userAdd:
aclChanges: identity: C
- userAdd: permission: admin
identity: C encryptionKey: key.Enc.C
permission: admin encryptedReadKeys: [ key.Read.1 ]
encryptionKey: key.Enc.C readKey: key.Read.1
encryptedReadKeys: [ key.Read.1 ] - id: B.1.2
readKey: key.Read.1 identity: B
- id: B.1.2 aclChanges:
aclChanges: - userAdd:
- userAdd: identity: F
identity: F permission: admin
permission: admin encryptionKey: key.Enc.F
encryptionKey: key.Enc.F encryptedReadKeys: [ key.Read.1 ]
encryptedReadKeys: [ key.Read.1 ] readKey: key.Read.1
readKey: key.Read.1
keys: keys:
Enc: Enc:
- A - A
@ -120,3 +119,6 @@ graph:
baseSnapshot: A.1.2 baseSnapshot: A.1.2
aclHeads: [A.1.2] aclHeads: [A.1.2]
treeHeads: [A.1.2] treeHeads: [A.1.2]
heads:
- A.1.3
- B.1.2

View File

@ -1,10 +1,11 @@
package threadbuilder package threadbuilder
import ( import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
"github.com/textileio/go-threads/crypto/symmetric"
"hash/fnv" "hash/fnv"
"strings" "strings"
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadmodels"
"github.com/textileio/go-threads/crypto/symmetric"
) )
type SymKey struct { type SymKey struct {

View File

@ -3,43 +3,36 @@ package threadbuilder
import ( import (
"context" "context"
"fmt" "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" "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 *pb.ACLChange
id string id string
logId string
readKey *SymKey readKey *SymKey
signKey threadmodels.SigningPrivKey signKey threadmodels.SigningPrivKey
prevRecord *threadRecord changesData *pb.PlainTextChangeData
changesData *pb.ACLChangeChangeData
}
type threadLog struct {
id string
owner string
records []*threadRecord
} }
type ThreadBuilder struct { type ThreadBuilder struct {
threadId string threadId string
logs map[string]*threadLog allChanges map[string]*threadChange
allRecords map[string]*threadRecord heads []string
keychain *Keychain keychain *Keychain
} }
func NewThreadBuilder(keychain *Keychain) *ThreadBuilder { func NewThreadBuilder(keychain *Keychain) *ThreadBuilder {
return &ThreadBuilder{ return &ThreadBuilder{
logs: make(map[string]*threadLog), allChanges: make(map[string]*threadChange),
allRecords: make(map[string]*threadRecord),
keychain: keychain, keychain: keychain,
} }
} }
@ -70,27 +63,13 @@ func (t *ThreadBuilder) GetKeychain() *Keychain {
return t.keychain return t.keychain
} }
func (t *ThreadBuilder) GetLogs() ([]threadmodels.ThreadLog, error) { // writer can create docs -> id can create writer permissions
var logs []threadmodels.ThreadLog // by id we can check who created
for _, l := range t.logs { // at the same time this guy can add some random folks which are not in space
logs = append(logs, threadmodels.ThreadLog{ // but we should compare this against space in the future
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
}
func (t *ThreadBuilder) GetRecord(ctx context.Context, recordID string) (*threadmodels.ThreadRecord, error) { func (t *ThreadBuilder) GetChange(ctx context.Context, recordID string) (*threadmodels.RawChange, error) {
rec := t.allRecords[recordID] rec := t.allChanges[recordID]
prevId := ""
if rec.prevRecord != nil {
prevId = rec.prevRecord.id
}
var encrypted []byte var encrypted []byte
if rec.changesData != nil { 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!") panic("should be able to sign final acl message!")
} }
transformedRec := &threadmodels.ThreadRecord{ transformedRec := &threadmodels.RawChange{
PrevId: prevId, Payload: aclMarshaled,
Id: rec.id, Signature: signature,
LogId: rec.logId, Id: recordID,
Signed: &threadmodels.SignedPayload{
Payload: aclMarshaled,
Signature: signature,
},
} }
return transformedRec, nil 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") panic("implement me")
} }
@ -139,63 +114,49 @@ func (t *ThreadBuilder) Parse(thread *YMLThread) {
// the same thing is happening for the encryption keys // the same thing is happening for the encryption keys
t.keychain.ParseKeys(&thread.Keys) t.keychain.ParseKeys(&thread.Keys)
t.threadId = t.parseThreadId(thread.Description) t.threadId = t.parseThreadId(thread.Description)
for _, l := range thread.Logs { for _, ch := range thread.Changes {
newLog := &threadLog{ newChange := &threadChange{
id: l.Id, id: ch.Id,
owner: t.keychain.GetIdentity(l.Identity),
} }
var records []*threadRecord k := t.keychain.GetKey(ch.ReadKey).(*SymKey)
for _, r := range l.Records { newChange.readKey = k
newRecord := &threadRecord{ newChange.signKey = t.keychain.SigningKeys[ch.Identity]
id: r.Id, aclChange := &pb.ACLChange{}
logId: newLog.id, aclChange.Identity = newChange.Identity
if len(ch.AclChanges) > 0 || ch.AclSnapshot != nil {
aclChange.AclData = &pb.ACLChangeACLData{}
if ch.AclSnapshot != nil {
aclChange.AclData.AclSnapshot = t.parseACLSnapshot(ch.AclSnapshot)
} }
if len(records) > 0 { if ch.AclChanges != nil {
newRecord.prevRecord = records[len(records)-1] var aclChangeContents []*pb.ACLChangeACLContentValue
for _, ch := range ch.AclChanges {
aclChangeContent := t.parseACLChange(ch)
aclChangeContents = append(aclChangeContents, aclChangeContent)
}
aclChange.AclData.AclContent = aclChangeContents
} }
k := t.keychain.GetKey(r.ReadKey).(*SymKey)
newRecord.readKey = k
newRecord.signKey = t.keychain.SigningKeys[l.Identity]
aclChange := &pb.ACLChange{}
aclChange.Identity = newLog.owner
if len(r.AclChanges) > 0 || r.AclSnapshot != nil {
aclChange.AclData = &pb.ACLChangeACLData{}
if r.AclSnapshot != nil {
aclChange.AclData.AclSnapshot = t.parseACLSnapshot(r.AclSnapshot)
}
if r.AclChanges != nil {
var aclChangeContents []*pb.ACLChangeACLContentValue
for _, ch := range r.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(r.Changes) > 0 {
var changeContents []*pb.ChangeContent
for _, ch := range r.Changes {
aclChangeContent := t.parseDocumentChange(ch)
changeContents = append(changeContents, aclChangeContent)
}
newRecord.changesData.Content = changeContents
}
}
aclChange.CurrentReadKeyHash = k.Hash
newRecord.ACLChange = aclChange
t.allRecords[newRecord.id] = newRecord
records = append(records, newRecord)
} }
newLog.records = records if len(ch.Changes) > 0 || ch.Snapshot != nil {
t.logs[newLog.id] = newLog newChange.changesData = &pb.PlainTextChangeData{}
if ch.Snapshot != nil {
newChange.changesData.Snapshot = t.parseChangeSnapshot(ch.Snapshot)
}
if len(ch.Changes) > 0 {
var changeContents []*pb.PlainTextChangeContent
for _, ch := range ch.Changes {
aclChangeContent := t.parseDocumentChange(ch)
changeContents = append(changeContents, aclChangeContent)
}
newChange.changesData.Content = changeContents
}
}
aclChange.CurrentReadKeyHash = k.Hash
newChange.ACLChange = aclChange
t.allChanges[newChange.id] = newChange
} }
t.parseGraph(thread) t.parseGraph(thread)
t.parseHeads(thread)
} }
func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string { func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
@ -203,7 +164,7 @@ func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
panic("no author in thread") panic("no author in thread")
} }
key := t.keychain.SigningKeys[description.Author] key := t.keychain.SigningKeys[description.Author]
id, err := threadmodels.CreateACLThreadID(key.GetPublic(), smartblock.SmartBlockTypeWorkspace) id, err := threadmodels.CreateACLThreadID(key.GetPublic(), plainTextDocType)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -211,16 +172,9 @@ func (t *ThreadBuilder) parseThreadId(description *ThreadDescription) string {
return id.String() return id.String()
} }
func (t *ThreadBuilder) parseChangeSnapshot(s *ChangeSnapshot) *pb.ChangeSnapshot { func (t *ThreadBuilder) parseChangeSnapshot(s *PlainTextSnapshot) *pb.PlainTextChangeSnapshot {
data := &model.SmartBlockSnapshotBase{} return &pb.PlainTextChangeSnapshot{
var blocks []*model.Block Text: s.Text,
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,
} }
} }
@ -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 { switch {
case ch.BlockAdd != nil: case ch.TextAppend != nil:
blockAdd := ch.BlockAdd convCh = &pb.PlainTextChangeContent{
Value: &pb.PlainTextChangeContentValueOfTextAppend{
convCh = &pb.ChangeContent{ TextAppend: &pb.PlainTextChangeTextAppend{
Value: &pb.ChangeContentValueOfBlockCreate{ Text: ch.TextAppend.Text,
BlockCreate: &pb.ChangeBlockCreate{ },
TargetId: blockAdd.TargetId, },
Position: model.Block_Inner, }
Blocks: []*model.Block{&model.Block{Id: blockAdd.Id}},
}}}
} }
if convCh == nil { if convCh == nil {
panic("cannot have empty document change") 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 { func (t *ThreadBuilder) traverseFromHeads(f func(t *threadChange) error) error {
allLogs, err := t.GetLogs() uniqMap := map[string]struct{}{}
if err != nil { stack := t.heads
return err for len(stack) > 0 {
} id := stack[len(stack)-1]
stack = stack[:len(stack)-1]
if _, exists := uniqMap[id]; exists {
continue
}
for _, log := range allLogs { ch := t.allChanges[id]
head := t.allRecords[log.Head] uniqMap[id] = struct{}{}
err = f(head) if err := f(ch); err != nil {
if err != nil {
return err return err
} }
for head.prevRecord != nil { for _, prev := range ch.ACLChange.TreeHeadIds {
head = head.prevRecord stack = append(stack, prev)
err = f(head)
if err != nil {
return err
}
} }
} }
return nil return nil
@ -436,9 +387,13 @@ func (t *ThreadBuilder) traverseFromHeads(f func(t *threadRecord) error) error {
func (t *ThreadBuilder) parseGraph(thread *YMLThread) { func (t *ThreadBuilder) parseGraph(thread *YMLThread) {
for _, node := range thread.Graph { for _, node := range thread.Graph {
rec := t.allRecords[node.Id] rec := t.allChanges[node.Id]
rec.AclHeadIds = node.ACLHeads rec.AclHeadIds = node.ACLHeads
rec.TreeHeadIds = node.TreeHeads rec.TreeHeadIds = node.TreeHeads
rec.SnapshotBaseId = node.BaseSnapshot rec.SnapshotBaseId = node.BaseSnapshot
} }
} }
func (t *ThreadBuilder) parseHeads(thread *YMLThread) {
t.heads = thread.Heads
}

View File

@ -30,7 +30,7 @@ func (t *ThreadBuilder) Graph() (string, error) {
graph.SetDir(true) graph.SetDir(true)
var nodes = make(map[string]struct{}) var nodes = make(map[string]struct{})
var addNodes = func(r *threadRecord) error { var addNodes = func(r *threadChange) error {
// TODO: revisit function after checking // TODO: revisit function after checking
style := "solid" style := "solid"
@ -105,7 +105,7 @@ func (t *ThreadBuilder) Graph() (string, error) {
return nil return nil
} }
var addLinks = func(t *threadRecord) error { var addLinks = func(t *threadChange) error {
for _, prevId := range t.AclHeadIds { for _, prevId := range t.AclHeadIds {
err := createEdge(t.id, prevId, EdgeParameters{ err := createEdge(t.id, prevId, EdgeParameters{
style: "dashed", style: "dashed",

View File

@ -20,11 +20,8 @@ type ACLSnapshot struct {
} `yaml:"userStates"` } `yaml:"userStates"`
} }
type ChangeSnapshot struct { type PlainTextSnapshot struct {
Blocks []struct { Text string `yaml:"text"`
Id string `yaml:"id"`
ChildrenIds []string `yaml:"childrenIds"`
} `yaml:"blocks"`
} }
type ACLChange struct { type ACLChange struct {
@ -67,29 +64,25 @@ type ACLChange struct {
} }
} }
type DocumentChange struct { type PlainTextChange struct {
BlockAdd *struct { TextAppend *struct {
Id string `yaml:"id"` Text string `yaml:"text"`
TargetId string `yaml:"targetId"`
} `yaml:"blockAdd"` } `yaml:"blockAdd"`
} }
type YMLThread struct { type YMLThread struct {
Description *ThreadDescription `yaml:"thread"` Description *ThreadDescription `yaml:"thread"`
Logs []struct { Changes []struct {
Id string `yaml:"id"` Id string `yaml:"id"`
Identity string `yaml:"identity"` Identity string `yaml:"identity"`
Records []struct {
Id string `yaml:"id"`
AclSnapshot *ACLSnapshot `yaml:"aclSnapshot"` AclSnapshot *ACLSnapshot `yaml:"aclSnapshot"`
Snapshot *ChangeSnapshot `yaml:"snapshot"` Snapshot *PlainTextSnapshot `yaml:"snapshot"`
AclChanges []*ACLChange `yaml:"aclChanges"` AclChanges []*ACLChange `yaml:"aclChanges"`
Changes []*DocumentChange `yaml:"changes"` Changes []*PlainTextChange `yaml:"changes"`
ReadKey string `yaml:"readKey"` ReadKey string `yaml:"readKey"`
} `yaml:"records"` } `yaml:"changes"`
} `yaml:"logs"`
Keys Keys `yaml:"keys"` Keys Keys `yaml:"keys"`
@ -100,4 +93,6 @@ type YMLThread struct {
ACLHeads []string `yaml:"aclHeads"` ACLHeads []string `yaml:"aclHeads"`
TreeHeads []string `yaml:"treeHeads"` TreeHeads []string `yaml:"treeHeads"`
} `yaml:"graph"` } `yaml:"graph"`
Heads []string `yaml:"heads"`
} }

View File

@ -2,33 +2,17 @@ package threadmodels
import ( import (
"context" "context"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
) )
type Thread interface { type Thread interface {
ID() string ID() string
GetLogs() ([]ThreadLog, error) GetChange(ctx context.Context, recordID string) (*RawChange, error)
GetRecord(ctx context.Context, recordID string) (*ThreadRecord, error) PushChange(payload proto.Marshaler) (id string, err error)
PushRecord(payload proto.Marshaler) (id string, err error)
// SubscribeForRecords()
} }
type SignedPayload struct { type RawChange struct {
Payload []byte Payload []byte
Signature []byte Signature []byte
} Id string
type ThreadRecord struct {
PrevId string
Id string
LogId string
Signed *SignedPayload
}
type ThreadLog struct {
ID string
Head string
Counter int64
} }

View File

@ -4,12 +4,12 @@ import (
"crypto/rand" "crypto/rand"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/lib/core/smartblock"
"github.com/textileio/go-threads/core/thread"
"hash/fnv" "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 rndlen := 32
buf := make([]byte, 8+rndlen) 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 // putting hash of the pubkey in the beginning
binary.LittleEndian.PutUint64(buf[:8], res) binary.LittleEndian.PutUint64(buf[:8], res)
return threadIDFromBytes(blockType, buf) return threadIDFromBytes(docType, buf)
} }
func VerifyACLThreadID(k SigningPubKey, threadId thread.ID) (bool, error) { func VerifyACLThreadID(k SigningPubKey, threadId thread.ID) (bool, error) {
@ -52,7 +52,7 @@ func VerifyACLThreadID(k SigningPubKey, threadId thread.ID) (bool, error) {
} }
func threadIDFromBytes( func threadIDFromBytes(
blockType smartblock.SmartBlockType, docType uint16,
b []byte) (thread.ID, error) { b []byte) (thread.ID, error) {
blen := len(b) blen := len(b)
@ -60,7 +60,7 @@ func threadIDFromBytes(
buf := make([]byte, 2*binary.MaxVarintLen64+blen) buf := make([]byte, 2*binary.MaxVarintLen64+blen)
n := binary.PutUvarint(buf, thread.V1) n := binary.PutUvarint(buf, thread.V1)
n += binary.PutUvarint(buf[n:], uint64(thread.AccessControlled)) 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) cn := copy(buf[n:], b)
if cn != blen { if cn != blen {

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"errors" "errors"
"fmt" "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/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/pkg/lib/logging"
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
"github.com/gogo/protobuf/proto" "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) ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel() defer cancel()
record, err := tb.thread.GetRecord(ctx, id) record, err := tb.thread.GetChange(ctx, id)
if err != nil { if err != nil {
return nil, err return nil, err
} }

2
go.mod
View File

@ -4,6 +4,8 @@ go 1.18
require ( require (
github.com/textileio/go-threads v1.0.2-0.20210304072541-d0f91da84404 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 replace github.com/textileio/go-threads => github.com/anytypeio/go-threads v1.1.0-rc1.0.20220223104843-a67245cee80e