treestorage

package
v0.5.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownTreeId = errors.New("tree does not exist")
	ErrTreeExists    = errors.New("tree already exists")
	ErrUnknownChange = errors.New("change doesn't exist")
)

Functions

func CreateHeadsPayload

func CreateHeadsPayload(heads []string) []byte

func JoinStringsToBytes

func JoinStringsToBytes(strs ...string) []byte

func ParseHeads

func ParseHeads(headsPayload []byte) []string

Types

type Exporter

type Exporter interface {
	TreeStorage(root *treechangeproto.RawTreeChangeWithId) (TreeStorage, error)
}

type InMemoryTreeStorage

type InMemoryTreeStorage struct {
	Changes map[string]*treechangeproto.RawTreeChangeWithId

	sync.Mutex
	// contains filtered or unexported fields
}

func (*InMemoryTreeStorage) AddRawChange

func (*InMemoryTreeStorage) AddRawChangesSetHeads

func (t *InMemoryTreeStorage) AddRawChangesSetHeads(changes []*treechangeproto.RawTreeChangeWithId, heads []string) error

func (*InMemoryTreeStorage) AllChanges added in v0.3.2

func (*InMemoryTreeStorage) Copy

func (*InMemoryTreeStorage) Delete

func (t *InMemoryTreeStorage) Delete() error

func (*InMemoryTreeStorage) Equal

func (t *InMemoryTreeStorage) Equal(other *InMemoryTreeStorage) bool

func (*InMemoryTreeStorage) GetAllChangeIds added in v0.5.0

func (t *InMemoryTreeStorage) GetAllChangeIds() (chs []string, err error)

func (*InMemoryTreeStorage) GetAppendRawChange added in v0.5.0

func (t *InMemoryTreeStorage) GetAppendRawChange(ctx context.Context, buf []byte, id string) (*treechangeproto.RawTreeChangeWithId, error)

func (*InMemoryTreeStorage) GetRawChange

func (*InMemoryTreeStorage) HasChange

func (t *InMemoryTreeStorage) HasChange(ctx context.Context, id string) (bool, error)

func (*InMemoryTreeStorage) Heads

func (t *InMemoryTreeStorage) Heads() ([]string, error)

func (*InMemoryTreeStorage) Id

func (t *InMemoryTreeStorage) Id() string

func (*InMemoryTreeStorage) Remove added in v0.5.0

func (t *InMemoryTreeStorage) Remove(id string)

func (*InMemoryTreeStorage) Root

func (*InMemoryTreeStorage) SetHeads

func (t *InMemoryTreeStorage) SetHeads(heads []string) error

func (*InMemoryTreeStorage) SetReturnErrorOnAdd

func (t *InMemoryTreeStorage) SetReturnErrorOnAdd(err error)

type TreeStorage

type TreeStorage interface {
	Id() string
	Root() (*treechangeproto.RawTreeChangeWithId, error)
	Heads() ([]string, error)
	SetHeads(heads []string) error
	AddRawChange(change *treechangeproto.RawTreeChangeWithId) error
	AddRawChangesSetHeads(changes []*treechangeproto.RawTreeChangeWithId, heads []string) error
	GetAllChangeIds() ([]string, error)

	GetRawChange(ctx context.Context, id string) (*treechangeproto.RawTreeChangeWithId, error)
	GetAppendRawChange(ctx context.Context, buf []byte, id string) (*treechangeproto.RawTreeChangeWithId, error)
	HasChange(ctx context.Context, id string) (bool, error)
	Delete() error
}

type TreeStorageCreatePayload

type TreeStorageCreatePayload struct {
	RootRawChange *treechangeproto.RawTreeChangeWithId
	Changes       []*treechangeproto.RawTreeChangeWithId
	Heads         []string
}

type TreeStorageCreatorFunc

type TreeStorageCreatorFunc = func(payload TreeStorageCreatePayload) (TreeStorage, error)

Directories

Path Synopsis
Package mock_treestorage is a generated GoMock package.
Package mock_treestorage is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL