mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 14:07:02 +09:00
Expose header in history
This commit is contained in:
parent
d15a02571f
commit
e12edef524
3 changed files with 13 additions and 1 deletions
|
@ -55,6 +55,7 @@ func NewChangeFromRoot(id string, ch *treechangeproto.RootChange, signature []by
|
|||
IsSnapshot: true,
|
||||
Identity: string(ch.Identity),
|
||||
Signature: signature,
|
||||
Data: []byte(ch.ChangeType),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package objecttree
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto"
|
||||
)
|
||||
|
||||
var ErrLoadBeforeRoot = errors.New("can't load before root")
|
||||
|
||||
|
@ -12,6 +15,8 @@ type HistoryTree interface {
|
|||
Heads() []string
|
||||
IterateFrom(id string, convert ChangeConvertFunc, iterate ChangeIterateFunc) error
|
||||
GetChange(string) (*Change, error)
|
||||
Header() *treechangeproto.RawTreeChangeWithId
|
||||
UnmarshalledHeader() *Change
|
||||
}
|
||||
|
||||
type historyTree struct {
|
||||
|
|
|
@ -187,5 +187,11 @@ func buildHistoryTree(deps objectTreeDeps, params HistoryTreeParams) (ht History
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
header, err := objTree.changeBuilder.ConvertFromRaw(objTree.rawRoot, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
objTree.root = header
|
||||
return hTree, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue