mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
WIP add snapshot methods to debug api
This commit is contained in:
parent
78f67d221c
commit
e6f4ff2f20
8 changed files with 717 additions and 202 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
type TextDocument interface {
|
||||
tree.ObjectTree
|
||||
InnerTree() tree.ObjectTree
|
||||
AddText(text string) (string, error)
|
||||
AddText(text string, isSnapshot bool) (string, string, error)
|
||||
Text() (string, error)
|
||||
TreeDump() string
|
||||
Close() error
|
||||
|
@ -60,7 +60,7 @@ func (t *textDocument) InnerTree() tree.ObjectTree {
|
|||
return t.ObjectTree
|
||||
}
|
||||
|
||||
func (t *textDocument) AddText(text string) (head string, err error) {
|
||||
func (t *textDocument) AddText(text string, isSnapshot bool) (root, head string, err error) {
|
||||
content := &testchanges.TextContent_TextAppend{
|
||||
TextAppend: &testchanges.TextAppend{Text: text},
|
||||
}
|
||||
|
@ -80,11 +80,12 @@ func (t *textDocument) AddText(text string) (head string, err error) {
|
|||
Data: res,
|
||||
Key: t.account.Account().SignKey,
|
||||
Identity: t.account.Account().Identity,
|
||||
IsSnapshot: false,
|
||||
IsSnapshot: isSnapshot,
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
root = t.Root().Id
|
||||
head = addRes.Heads[0]
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue