1
0
Fork 0
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:
mcrakhman 2022-12-03 14:43:18 +01:00 committed by Mikhail Iudin
parent 78f67d221c
commit e6f4ff2f20
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
8 changed files with 717 additions and 202 deletions

View file

@ -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
}