1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

Load iterator

This commit is contained in:
mcrakhman 2024-03-19 11:32:50 +01:00
parent 8c9682212f
commit 869943723e
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
6 changed files with 59 additions and 39 deletions

View file

@ -2,10 +2,12 @@ package objecttree
import (
"errors"
"github.com/gogo/protobuf/proto"
"github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
"github.com/anyproto/any-sync/util/cidutil"
"github.com/anyproto/any-sync/util/crypto"
"github.com/gogo/protobuf/proto"
)
var ErrEmptyChange = errors.New("change payload should not be empty")
@ -60,6 +62,7 @@ type newChangeFunc = func(id string, identity crypto.PubKey, ch *treechangeproto
type changeBuilder struct {
rootChange *treechangeproto.RawTreeChangeWithId
keys crypto.KeyStorage
rawTreeCh *treechangeproto.RawTreeChange
newChange newChangeFunc
}
@ -81,7 +84,9 @@ func (c *changeBuilder) Unmarshall(rawIdChange *treechangeproto.RawTreeChangeWit
}
}
raw := &treechangeproto.RawTreeChange{} // TODO: sync pool
c.rawTreeCh.Signature = c.rawTreeCh.Signature[:0]
c.rawTreeCh.Payload = c.rawTreeCh.Payload[:0]
raw := c.rawTreeCh
err = proto.Unmarshal(rawIdChange.GetRawChange(), raw)
if err != nil {
return