treestorage

package
v0.4.20 Latest Latest
Warning

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

Go to latest
Published: May 24, 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.RWMutex
	// 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) 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) 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

	GetRawChange(ctx context.Context, 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