1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 14:07:02 +09:00
any-sync/commonspace/object/tree/objecttree/treestorage.go
2024-11-17 18:42:21 +01:00

27 lines
766 B
Go

package objecttree
import "context"
type StorageChange struct {
RawChange []byte
PrevIds []string
Id string
SnapshotCounter int
SnapshotId string
OrderId string
ChangeSize int
}
type StorageIterator = func(ctx context.Context, change StorageChange) (shouldContinue bool)
type Storage interface {
Id() string
Root() (*StorageChange, error)
Heads() ([]string, error)
CommonSnapshot() (string, error)
Has(ctx context.Context, id string) (bool, error)
Get(ctx context.Context, id string) (StorageChange, error)
GetAfterOrder(ctx context.Context, orderId string, iter StorageIterator) error
AddAll(ctx context.Context, changes []StorageChange, heads []string, commonSnapshot string) error
Delete() error
}