spacestorage

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TreeDeletedStatusQueued  = "queued"
	TreeDeletedStatusDeleted = "deleted"
)
View Source
const CName = "common.commonspace.spacestorage"

Variables

View Source
var (
	ErrSpaceStorageExists   = errors.New("space storage exists")
	ErrSpaceStorageMissing  = errors.New("space storage missing")
	ErrIncorrectSpaceHeader = errors.New("incorrect space header")

	ErrTreeStorageAlreadyDeleted = errors.New("tree storage already deleted")
)

Functions

This section is empty.

Types

type InMemorySpaceStorage

type InMemorySpaceStorage struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*InMemorySpaceStorage) AclStorage

func (*InMemorySpaceStorage) AllTrees

func (*InMemorySpaceStorage) Close

func (i *InMemorySpaceStorage) Close() error

func (*InMemorySpaceStorage) CopyStorage

func (i *InMemorySpaceStorage) CopyStorage() *InMemorySpaceStorage

func (*InMemorySpaceStorage) CreateTreeStorage

func (*InMemorySpaceStorage) HasTree

func (i *InMemorySpaceStorage) HasTree(id string) (bool, error)

func (*InMemorySpaceStorage) Id

func (i *InMemorySpaceStorage) Id() string

func (*InMemorySpaceStorage) IsSpaceDeleted

func (i *InMemorySpaceStorage) IsSpaceDeleted() (bool, error)

func (*InMemorySpaceStorage) ReadSpaceHash

func (i *InMemorySpaceStorage) ReadSpaceHash() (hash string, err error)

func (*InMemorySpaceStorage) SetSpaceDeleted

func (i *InMemorySpaceStorage) SetSpaceDeleted() error

func (*InMemorySpaceStorage) SetTreeDeletedStatus

func (i *InMemorySpaceStorage) SetTreeDeletedStatus(id, state string) error

func (*InMemorySpaceStorage) SetTrees

func (i *InMemorySpaceStorage) SetTrees(trees map[string]treestorage.TreeStorage)

func (*InMemorySpaceStorage) SpaceHeader

func (*InMemorySpaceStorage) SpaceSettingsId

func (i *InMemorySpaceStorage) SpaceSettingsId() string

func (*InMemorySpaceStorage) StoredIds

func (i *InMemorySpaceStorage) StoredIds() ([]string, error)

func (*InMemorySpaceStorage) TreeDeletedStatus

func (i *InMemorySpaceStorage) TreeDeletedStatus(id string) (string, error)

func (*InMemorySpaceStorage) TreeRoot

func (*InMemorySpaceStorage) TreeStorage

func (*InMemorySpaceStorage) WriteSpaceHash

func (i *InMemorySpaceStorage) WriteSpaceHash(hash string) error

type InMemorySpaceStorageProvider

type InMemorySpaceStorageProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*InMemorySpaceStorageProvider) CreateSpaceStorage

func (*InMemorySpaceStorageProvider) Init

func (i *InMemorySpaceStorageProvider) Init(a *app.App) (err error)

func (*InMemorySpaceStorageProvider) Name

func (i *InMemorySpaceStorageProvider) Name() (name string)

func (*InMemorySpaceStorageProvider) SetStorage

func (i *InMemorySpaceStorageProvider) SetStorage(storage SpaceStorage)

func (*InMemorySpaceStorageProvider) SpaceExists

func (i *InMemorySpaceStorageProvider) SpaceExists(id string) bool

func (*InMemorySpaceStorageProvider) WaitSpaceStorage

func (i *InMemorySpaceStorageProvider) WaitSpaceStorage(ctx context.Context, id string) (SpaceStorage, error)

type SpaceStorage

type SpaceStorage interface {
	Id() string
	SetSpaceDeleted() error
	IsSpaceDeleted() (bool, error)
	SetTreeDeletedStatus(id, state string) error
	TreeDeletedStatus(id string) (string, error)
	SpaceSettingsId() string
	AclStorage() (liststorage.ListStorage, error)
	SpaceHeader() (*spacesyncproto.RawSpaceHeaderWithId, error)
	StoredIds() ([]string, error)
	TreeRoot(id string) (*treechangeproto.RawTreeChangeWithId, error)
	TreeStorage(id string) (treestorage.TreeStorage, error)
	HasTree(id string) (bool, error)
	CreateTreeStorage(payload treestorage.TreeStorageCreatePayload) (treestorage.TreeStorage, error)
	WriteSpaceHash(hash string) error
	ReadSpaceHash() (hash string, err error)

	Close() error
}

TODO: consider moving to some file with all common interfaces etc

func NewInMemorySpaceStorage

func NewInMemorySpaceStorage(payload SpaceStorageCreatePayload) (SpaceStorage, error)

type SpaceStorageCreatePayload

type SpaceStorageCreatePayload struct {
	AclWithId           *aclrecordproto.RawAclRecordWithId
	SpaceHeaderWithId   *spacesyncproto.RawSpaceHeaderWithId
	SpaceSettingsWithId *treechangeproto.RawTreeChangeWithId
}

type SpaceStorageProvider

type SpaceStorageProvider interface {
	app.Component
	WaitSpaceStorage(ctx context.Context, id string) (SpaceStorage, error)
	SpaceExists(id string) bool
	CreateSpaceStorage(payload SpaceStorageCreatePayload) (SpaceStorage, error)
}

func NewInMemorySpaceStorageProvider

func NewInMemorySpaceStorageProvider() SpaceStorageProvider

Directories

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

Jump to

Keyboard shortcuts

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