mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
move acl tree files to acl folder
This commit is contained in:
parent
de775e95b0
commit
d2c9fd4500
45 changed files with 65 additions and 67 deletions
|
@ -1,6 +1,8 @@
|
||||||
package aclchanges
|
package aclchanges
|
||||||
|
|
||||||
import "github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
import (
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
)
|
||||||
|
|
||||||
type Change interface {
|
type Change interface {
|
||||||
ProtoChange() *pb.ACLChange
|
ProtoChange() *pb.ACLChange
|
|
@ -4,11 +4,10 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash/fnv"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
"github.com/textileio/go-threads/crypto/symmetric"
|
"github.com/textileio/go-threads/crypto/symmetric"
|
||||||
|
"hash/fnv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNoSuchUser = errors.New("no such user")
|
var ErrNoSuchUser = errors.New("no such user")
|
|
@ -2,9 +2,9 @@ package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package acltree
|
package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package acltree
|
package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/threadbuilder"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/threadbuilder"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockListener struct{}
|
type mockListener struct{}
|
|
@ -2,8 +2,8 @@ package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
||||||
)
|
)
|
|
@ -2,10 +2,10 @@ package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/textileio/go-threads/crypto/symmetric"
|
"github.com/textileio/go-threads/crypto/symmetric"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package acltree
|
package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
|
@ -3,10 +3,10 @@ package acltree
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
)
|
)
|
|
@ -2,8 +2,8 @@ package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package acltree
|
package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,10 +2,10 @@ package acltree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/threadbuilder"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/threadbuilder"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
|
@ -3,8 +3,8 @@ package acltree
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
//"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"
|
|
@ -2,12 +2,12 @@ package plaintextdocument
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
|
aclpb "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
acltree2 "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/acltree"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/testchanges/pb"
|
||||||
|
thread2 "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
|
||||||
aclpb "github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/acltree"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/testchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type PlainTextDocument interface {
|
||||||
|
|
||||||
type plainTextDocument struct {
|
type plainTextDocument struct {
|
||||||
heads []string
|
heads []string
|
||||||
aclTree acltree.ACLTree
|
aclTree acltree2.ACLTree
|
||||||
state *DocumentState
|
state *DocumentState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ func (p *plainTextDocument) Text() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *plainTextDocument) AddText(text string) error {
|
func (p *plainTextDocument) AddText(text string) error {
|
||||||
_, err := p.aclTree.AddContent(func(builder acltree.ChangeBuilder) error {
|
_, err := p.aclTree.AddContent(func(builder acltree2.ChangeBuilder) error {
|
||||||
builder.AddChangeContent(
|
builder.AddChangeContent(
|
||||||
&pb.PlainTextChangeData{
|
&pb.PlainTextChangeData{
|
||||||
Content: []*pb.PlainTextChangeContent{
|
Content: []*pb.PlainTextChangeContent{
|
||||||
|
@ -42,7 +42,7 @@ func (p *plainTextDocument) AddText(text string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *plainTextDocument) Update(tree acltree.ACLTree) {
|
func (p *plainTextDocument) Update(tree acltree2.ACLTree) {
|
||||||
p.aclTree = tree
|
p.aclTree = tree
|
||||||
var err error
|
var err error
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -54,7 +54,7 @@ func (p *plainTextDocument) Update(tree acltree.ACLTree) {
|
||||||
prevHeads := p.heads
|
prevHeads := p.heads
|
||||||
p.heads = tree.Heads()
|
p.heads = tree.Heads()
|
||||||
startId := prevHeads[0]
|
startId := prevHeads[0]
|
||||||
tree.IterateFrom(startId, func(change *acltree.Change) (isContinue bool) {
|
tree.IterateFrom(startId, func(change *acltree2.Change) (isContinue bool) {
|
||||||
if change.Id == startId {
|
if change.Id == startId {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ func (p *plainTextDocument) Update(tree acltree.ACLTree) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *plainTextDocument) Rebuild(tree acltree.ACLTree) {
|
func (p *plainTextDocument) Rebuild(tree acltree2.ACLTree) {
|
||||||
p.aclTree = tree
|
p.aclTree = tree
|
||||||
p.heads = tree.Heads()
|
p.heads = tree.Heads()
|
||||||
var startId string
|
var startId string
|
||||||
|
@ -92,7 +92,7 @@ func (p *plainTextDocument) Rebuild(tree acltree.ACLTree) {
|
||||||
}
|
}
|
||||||
|
|
||||||
startId = rootChange.Id
|
startId = rootChange.Id
|
||||||
tree.Iterate(func(change *acltree.Change) (isContinue bool) {
|
tree.Iterate(func(change *acltree2.Change) (isContinue bool) {
|
||||||
if startId == change.Id {
|
if startId == change.Id {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -111,14 +111,14 @@ func (p *plainTextDocument) Rebuild(tree acltree.ACLTree) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInMemoryPlainTextDocument(acc *account.AccountData, text string) (PlainTextDocument, error) {
|
func NewInMemoryPlainTextDocument(acc *account.AccountData, text string) (PlainTextDocument, error) {
|
||||||
return NewPlainTextDocument(acc, thread.NewInMemoryThread, text)
|
return NewPlainTextDocument(acc, thread2.NewInMemoryThread, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPlainTextDocument(
|
func NewPlainTextDocument(
|
||||||
acc *account.AccountData,
|
acc *account.AccountData,
|
||||||
create func(change *thread.RawChange) (thread.Thread, error),
|
create func(change *thread2.RawChange) (thread2.Thread, error),
|
||||||
text string) (PlainTextDocument, error) {
|
text string) (PlainTextDocument, error) {
|
||||||
changeBuilder := func(builder acltree.ChangeBuilder) error {
|
changeBuilder := func(builder acltree2.ChangeBuilder) error {
|
||||||
err := builder.UserAdd(acc.Identity, acc.EncKey.GetPublic(), aclpb.ACLChange_Admin)
|
err := builder.UserAdd(acc.Identity, acc.EncKey.GetPublic(), aclpb.ACLChange_Admin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -126,7 +126,7 @@ func NewPlainTextDocument(
|
||||||
builder.AddChangeContent(createInitialChangeContent(text))
|
builder.AddChangeContent(createInitialChangeContent(text))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
t, err := acltree.BuildThreadWithACL(
|
t, err := acltree2.BuildThreadWithACL(
|
||||||
acc,
|
acc,
|
||||||
changeBuilder,
|
changeBuilder,
|
||||||
create)
|
create)
|
||||||
|
@ -139,7 +139,7 @@ func NewPlainTextDocument(
|
||||||
aclTree: nil,
|
aclTree: nil,
|
||||||
state: nil,
|
state: nil,
|
||||||
}
|
}
|
||||||
tree, err := acltree.BuildACLTree(t, acc, doc)
|
tree, err := acltree2.BuildACLTree(t, acc, doc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package plaintextdocument
|
package plaintextdocument
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/account"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/account"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/threadbuilder"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/threadbuilder"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
|
@ -2,8 +2,8 @@ package plaintextdocument
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/testchanges/pb"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/testchanges/pb"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,8 +3,12 @@ package threadbuilder
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/yamltests"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges/pb"
|
||||||
|
testpb "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/testchanges/pb"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/yamltests"
|
||||||
|
thread2 "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread"
|
||||||
|
threadpb "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread/pb"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
|
@ -12,10 +16,6 @@ import (
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges/pb"
|
|
||||||
testpb "github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/testchanges/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread"
|
|
||||||
threadpb "github.com/anytypeio/go-anytype-infrastructure-experiments/thread/pb"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ func (t *ThreadBuilder) Heads() []string {
|
||||||
return t.heads
|
return t.heads
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ThreadBuilder) AddRawChange(change *thread.RawChange) error {
|
func (t *ThreadBuilder) AddRawChange(change *thread2.RawChange) error {
|
||||||
aclChange := new(pb.ACLChange)
|
aclChange := new(pb.ACLChange)
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -162,12 +162,12 @@ func (t *ThreadBuilder) RemoveOrphans(orphans ...string) {
|
||||||
t.orphans = slice.Difference(t.orphans, orphans)
|
t.orphans = slice.Difference(t.orphans, orphans)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ThreadBuilder) GetChange(ctx context.Context, recordID string) (*thread.RawChange, error) {
|
func (t *ThreadBuilder) GetChange(ctx context.Context, recordID string) (*thread2.RawChange, error) {
|
||||||
return t.getChange(recordID, t.allChanges), nil
|
return t.getChange(recordID, t.allChanges), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ThreadBuilder) GetUpdates(useCase string) []*thread.RawChange {
|
func (t *ThreadBuilder) GetUpdates(useCase string) []*thread2.RawChange {
|
||||||
var res []*thread.RawChange
|
var res []*thread2.RawChange
|
||||||
update := t.updates[useCase]
|
update := t.updates[useCase]
|
||||||
for _, ch := range update.changes {
|
for _, ch := range update.changes {
|
||||||
rawCh := t.getChange(ch.id, update.changes)
|
rawCh := t.getChange(ch.id, update.changes)
|
||||||
|
@ -180,7 +180,7 @@ func (t *ThreadBuilder) Header() *threadpb.ThreadHeader {
|
||||||
return t.header
|
return t.header
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ThreadBuilder) getChange(changeId string, m map[string]*threadChange) *thread.RawChange {
|
func (t *ThreadBuilder) getChange(changeId string, m map[string]*threadChange) *thread2.RawChange {
|
||||||
rec := m[changeId]
|
rec := m[changeId]
|
||||||
|
|
||||||
if rec.changesDataDecrypted != nil {
|
if rec.changesDataDecrypted != nil {
|
||||||
|
@ -202,7 +202,7 @@ func (t *ThreadBuilder) getChange(changeId string, m map[string]*threadChange) *
|
||||||
panic("should be able to sign final acl message!")
|
panic("should be able to sign final acl message!")
|
||||||
}
|
}
|
||||||
|
|
||||||
transformedRec := &thread.RawChange{
|
transformedRec := &thread2.RawChange{
|
||||||
Payload: aclMarshaled,
|
Payload: aclMarshaled,
|
||||||
Signature: signature,
|
Signature: signature,
|
||||||
Id: changeId,
|
Id: changeId,
|
||||||
|
@ -279,7 +279,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 := thread.CreateACLThreadID(key.GetPublic(), plainTextDocType)
|
id, err := thread2.CreateACLThreadID(key.GetPublic(), plainTextDocType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
|
@ -9,14 +9,13 @@ package threadbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
testpb "github.com/anytypeio/go-anytype-infrastructure-experiments/acl/testutils/testchanges/pb"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/awalterschulze/gographviz"
|
"github.com/awalterschulze/gographviz"
|
||||||
|
|
||||||
testpb "github.com/anytypeio/go-anytype-infrastructure-experiments/testutils/testchanges/pb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// To quickly look at visualized string you can use https://dreampuf.github.io/GraphvizOnline
|
// To quickly look at visualized string you can use https://dreampuf.github.io/GraphvizOnline
|
|
@ -3,8 +3,8 @@ package thread
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread/pb"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread/pb"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid"
|
||||||
"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"
|
|
@ -2,9 +2,8 @@ package thread
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/thread/pb"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/aclchanges"
|
||||||
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/acl/thread/pb"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/aclchanges"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: change methods to have errors as a return parameter, because we will be dealing with a real database
|
// TODO: change methods to have errors as a return parameter, because we will be dealing with a real database
|
Loading…
Add table
Add a link
Reference in a new issue