mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
27 lines
766 B
Go
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
|
|
}
|