Documentation ¶
Index ¶
- Variables
- func CreateObjectTreeRoot(payload ObjectTreeCreatePayload, aclList list.AclList) (root *treechangeproto.RawTreeChangeWithId, err error)
- func DeriveObjectTreeRoot(payload ObjectTreeDerivePayload, aclList list.AclList) (root *treechangeproto.RawTreeChangeWithId, err error)
- func DoSnapshot(treeLen int) bool
- func IsDerivedRoot(root *treechangeproto.RawTreeChangeWithId) (derived bool, err error)
- func IsEmptyDerivedTree(tree ObjectTree) bool
- func IsEmptyTree(tree ObjectTree) bool
- func ValidateFilterRawTree(payload treestorage.TreeStorageCreatePayload, aclList list.AclList) (retPayload treestorage.TreeStorageCreatePayload, err error)
- func ValidateRawTree(payload treestorage.TreeStorageCreatePayload, aclList list.AclList) (err error)
- func ValidateRawTreeBuildFunc(payload treestorage.TreeStorageCreatePayload, buildFunc BuildObjectTreeFunc, ...) (newPayload treestorage.TreeStorageCreatePayload, err error)
- type AddResult
- type AddResultSummary
- type BuildObjectTreeFunc
- type BuilderContent
- type Change
- type ChangeBuilder
- type ChangeConvertFunc
- type ChangeIterateFunc
- type DebugInfo
- type DescriptionParser
- type HistoryTree
- type HistoryTreeParams
- type InitialContent
- type InitialDerivedContent
- type MockChangeCreator
- func (c *MockChangeCreator) CreateDerivedRoot(id string, isDerived bool) *treechangeproto.RawTreeChangeWithId
- func (c *MockChangeCreator) CreateNewTreeStorage(treeId, aclHeadId string, isDerived bool) treestorage.TreeStorage
- func (c *MockChangeCreator) CreateRaw(id, aclId, snapshotId string, isSnapshot bool, prevIds ...string) *treechangeproto.RawTreeChangeWithId
- func (c *MockChangeCreator) CreateRawWithData(id, aclId, snapshotId string, isSnapshot bool, data []byte, prevIds ...string) *treechangeproto.RawTreeChangeWithId
- func (c *MockChangeCreator) CreateRoot(id, aclId string) *treechangeproto.RawTreeChangeWithId
- type Mode
- type ObjectTree
- func BuildEmptyDataObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
- func BuildEmptyDataTestableTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
- func BuildKeyFilterableObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
- func BuildObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
- func BuildTestableTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
- type ObjectTreeCreatePayload
- type ObjectTreeDerivePayload
- type ObjectTreeValidator
- type RawChangesPayload
- type ReadableObjectTree
- type SignableChangeContent
- type Tree
- func (t *Tree) Add(changes ...*Change) (mode Mode, added []*Change)
- func (t *Tree) AddFast(changes ...*Change) []*Change
- func (t *Tree) AddMergedHead(c *Change) error
- func (t *Tree) Get(id string) *Change
- func (t *Tree) GetDuplicateEvents() int
- func (t *Tree) Graph(parser DescriptionParser) (data string, err error)
- func (t *Tree) Hash() string
- func (t *Tree) Heads() []string
- func (t *Tree) HeadsChanges() []*Change
- func (t *Tree) Iterate(startId string, f func(c *Change) (isContinue bool))
- func (t *Tree) IterateBranching(startId string, f func(c *Change, branchLevel int) (isContinue bool))
- func (t *Tree) IterateSkip(startId string, skipBeforeId string, f func(c *Change) (isContinue bool))
- func (t *Tree) Len() int
- func (t *Tree) RemoveInvalidChange(id string)
- func (t *Tree) ResetDuplicateEvents()
- func (t *Tree) Root() *Change
- func (t *Tree) RootId() string
- func (t *Tree) String() string
- type TryLocker
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIncorrectSignature = errors.New("change has incorrect signature") ErrIncorrectCid = errors.New("change has incorrect CID") )
View Source
var ( ErrHasInvalidChanges = errors.New("the change is invalid") ErrNoCommonSnapshot = errors.New("trees doesn't have a common snapshot") ErrNoChangeInTree = errors.New("no such change in tree") ErrMissingKey = errors.New("missing current read key") ErrDerived = errors.New("expect >= 2 changes in derived tree") ErrDeleted = errors.New("object tree is deleted") ErrNoAclHead = errors.New("no acl head") )
View Source
var (
ErrEmpty = errors.New("logs empty")
)
View Source
var ErrEmptyChange = errors.New("change payload should not be empty")
View Source
var ErrLoadBeforeRoot = errors.New("can't load before root")
View Source
var NoOpDescriptionParser = noopDescriptionParser{}
Functions ¶
func CreateObjectTreeRoot ¶
func CreateObjectTreeRoot(payload ObjectTreeCreatePayload, aclList list.AclList) (root *treechangeproto.RawTreeChangeWithId, err error)
func DeriveObjectTreeRoot ¶ added in v0.3.2
func DeriveObjectTreeRoot(payload ObjectTreeDerivePayload, aclList list.AclList) (root *treechangeproto.RawTreeChangeWithId, err error)
func DoSnapshot ¶
func IsDerivedRoot ¶ added in v0.3.2
func IsDerivedRoot(root *treechangeproto.RawTreeChangeWithId) (derived bool, err error)
func IsEmptyDerivedTree ¶ added in v0.3.2
func IsEmptyDerivedTree(tree ObjectTree) bool
func IsEmptyTree ¶ added in v0.3.21
func IsEmptyTree(tree ObjectTree) bool
func ValidateFilterRawTree ¶ added in v0.3.21
func ValidateFilterRawTree(payload treestorage.TreeStorageCreatePayload, aclList list.AclList) (retPayload treestorage.TreeStorageCreatePayload, err error)
func ValidateRawTree ¶
func ValidateRawTree(payload treestorage.TreeStorageCreatePayload, aclList list.AclList) (err error)
func ValidateRawTreeBuildFunc ¶ added in v0.3.20
func ValidateRawTreeBuildFunc(payload treestorage.TreeStorageCreatePayload, buildFunc BuildObjectTreeFunc, aclList list.AclList) (newPayload treestorage.TreeStorageCreatePayload, err error)
Types ¶
type AddResult ¶
type AddResult struct { OldHeads []string Heads []string Added []*treechangeproto.RawTreeChangeWithId Mode Mode }
type AddResultSummary ¶
type AddResultSummary int
type BuildObjectTreeFunc ¶
type BuildObjectTreeFunc = func(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
type BuilderContent ¶
type Change ¶
type Change struct { Next []*Change PreviousIds []string AclHeadId string Id string SnapshotId string Timestamp int64 ReadKeyId string Identity crypto.PubKey Data []byte Model interface{} Signature []byte DataType string IsSnapshot bool IsDerived bool // contains filtered or unexported fields }
Change is an abstract type for all types of changes
func NewChange ¶
func NewChange(id string, identity crypto.PubKey, ch *treechangeproto.TreeChange, signature []byte) *Change
func NewChangeFromRoot ¶
func NewChangeFromRoot(id string, identity crypto.PubKey, ch *treechangeproto.RootChange, signature []byte, isDerived bool) *Change
type ChangeBuilder ¶
type ChangeBuilder interface { Unmarshall(rawIdChange *treechangeproto.RawTreeChangeWithId, verify bool) (ch *Change, err error) Build(payload BuilderContent) (ch *Change, raw *treechangeproto.RawTreeChangeWithId, err error) BuildRoot(payload InitialContent) (ch *Change, raw *treechangeproto.RawTreeChangeWithId, err error) BuildDerivedRoot(payload InitialDerivedContent) (ch *Change, raw *treechangeproto.RawTreeChangeWithId, err error) Marshall(ch *Change) (*treechangeproto.RawTreeChangeWithId, error) }
func NewChangeBuilder ¶
func NewChangeBuilder(keys crypto.KeyStorage, rootChange *treechangeproto.RawTreeChangeWithId) ChangeBuilder
type ChangeConvertFunc ¶
type ChangeIterateFunc ¶
type DescriptionParser ¶
type HistoryTree ¶
type HistoryTree interface { ReadableObjectTree }
func BuildHistoryTree ¶
func BuildHistoryTree(params HistoryTreeParams) (HistoryTree, error)
func BuildNonVerifiableHistoryTree ¶
func BuildNonVerifiableHistoryTree(params HistoryTreeParams) (HistoryTree, error)
type HistoryTreeParams ¶
type HistoryTreeParams struct { TreeStorage treestorage.TreeStorage AclList list.AclList BeforeId string IncludeBeforeId bool BuildFullTree bool }
type InitialContent ¶
type InitialDerivedContent ¶ added in v0.3.2
type MockChangeCreator ¶
type MockChangeCreator struct{}
func NewMockChangeCreator ¶
func NewMockChangeCreator() *MockChangeCreator
func (*MockChangeCreator) CreateDerivedRoot ¶ added in v0.3.2
func (c *MockChangeCreator) CreateDerivedRoot(id string, isDerived bool) *treechangeproto.RawTreeChangeWithId
func (*MockChangeCreator) CreateNewTreeStorage ¶
func (c *MockChangeCreator) CreateNewTreeStorage(treeId, aclHeadId string, isDerived bool) treestorage.TreeStorage
func (*MockChangeCreator) CreateRaw ¶
func (c *MockChangeCreator) CreateRaw(id, aclId, snapshotId string, isSnapshot bool, prevIds ...string) *treechangeproto.RawTreeChangeWithId
func (*MockChangeCreator) CreateRawWithData ¶
func (c *MockChangeCreator) CreateRawWithData(id, aclId, snapshotId string, isSnapshot bool, data []byte, prevIds ...string) *treechangeproto.RawTreeChangeWithId
func (*MockChangeCreator) CreateRoot ¶
func (c *MockChangeCreator) CreateRoot(id, aclId string) *treechangeproto.RawTreeChangeWithId
type ObjectTree ¶
type ObjectTree interface { ReadableObjectTree SnapshotPath() []string ChangesAfterCommonSnapshot(snapshotPath, heads []string) ([]*treechangeproto.RawTreeChangeWithId, error) Storage() treestorage.TreeStorage AddContent(ctx context.Context, content SignableChangeContent) (AddResult, error) AddRawChanges(ctx context.Context, changes RawChangesPayload) (AddResult, error) UnpackChange(raw *treechangeproto.RawTreeChangeWithId) (data []byte, err error) PrepareChange(content SignableChangeContent) (res *treechangeproto.RawTreeChangeWithId, err error) Delete() error Close() error TryClose(objectTTL time.Duration) (bool, error) }
func BuildEmptyDataObjectTree ¶
func BuildEmptyDataObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
func BuildEmptyDataTestableTree ¶
func BuildEmptyDataTestableTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
func BuildKeyFilterableObjectTree ¶ added in v0.3.21
func BuildKeyFilterableObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
func BuildObjectTree ¶
func BuildObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
func BuildTestableTree ¶
func BuildTestableTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error)
type ObjectTreeCreatePayload ¶
type ObjectTreeDerivePayload ¶ added in v0.3.2
type ObjectTreeValidator ¶
type ObjectTreeValidator interface { // ValidateFullTree should always be entered while holding a read lock on AclList ValidateFullTree(tree *Tree, aclList list.AclList) error // ValidateNewChanges should always be entered while holding a read lock on AclList ValidateNewChanges(tree *Tree, aclList list.AclList, newChanges []*Change) error FilterChanges(aclList list.AclList, changes []*Change, snapshots []*Change, indexes []int) (filteredHeads bool, filtered, filteredSnapshots []*Change, newIndexes []int) }
type RawChangesPayload ¶
type RawChangesPayload struct { NewHeads []string RawChanges []*treechangeproto.RawTreeChangeWithId }
type ReadableObjectTree ¶
type ReadableObjectTree interface { TryLocker Id() string Header() *treechangeproto.RawTreeChangeWithId UnmarshalledHeader() *Change ChangeInfo() *treechangeproto.TreeChangeInfo Heads() []string Root() *Change Len() int IsDerived() bool AclList() list.AclList HasChanges(...string) bool GetChange(string) (*Change, error) Debug(parser DescriptionParser) (DebugInfo, error) IterateRoot(convert ChangeConvertFunc, iterate ChangeIterateFunc) error IterateFrom(id string, convert ChangeConvertFunc, iterate ChangeIterateFunc) error }
type SignableChangeContent ¶
type SignableChangeContent struct { // Data is a data provided by the client Data []byte // Key is the key which will be used to sign the change Key crypto.PrivKey // IsSnapshot tells if the change has snapshot of all previous data IsSnapshot bool // IsEncrypted tells if we encrypt the data with the relevant symmetric key IsEncrypted bool // Timestamp is a timestamp of change, if it is <= 0, then we use current timestamp Timestamp int64 // DataType contains additional info about the data in the payload DataType string }
SignableChangeContent is a payload to be passed when we are creating change
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) AddMergedHead ¶
func (*Tree) GetDuplicateEvents ¶
func (*Tree) HeadsChanges ¶
func (*Tree) IterateBranching ¶
func (*Tree) IterateSkip ¶
func (*Tree) RemoveInvalidChange ¶
RemoveInvalidChange removes all the changes that are descendants of id
func (*Tree) ResetDuplicateEvents ¶
func (t *Tree) ResetDuplicateEvents()
type ValidatorFunc ¶ added in v0.3.21
type ValidatorFunc func(payload treestorage.TreeStorageCreatePayload, buildFunc BuildObjectTreeFunc, aclList list.AclList) (retPayload treestorage.TreeStorageCreatePayload, err error)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_objecttree is a generated GoMock package.
|
Package mock_objecttree is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.