store

package
v0.0.0-...-6bdf688 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerAddressesPrefix = "servers/addresses/"
	ServerSnapshotsPrefix = "servers/snapshots/"
	ServerStatesPrefix    = "servers/states/"
)
View Source
const (
	FilesystemMastersPrefix        = "filesystems/masters/"
	FilesystemDeletedPrefix        = "filesystems/deleted/"
	FilesystemCleanupPendingPrefix = "filesystems/cleanupPending/"
	FilesystemLivePrefix           = "filesystems/live/"
	FilesystemContainersPrefix     = "filesystems/containers/"
	FilesystemDirtyPrefix          = "filesystems/dirty/"
	FilesystemTransfersPrefix      = "filesystems/transfers/"
)
View Source
const (
	RegistryClonesPrefix      = "registry/clones/"
	RegistryFilesystemsPrefix = "registry/filesystems/"
)

Variables

View Source
var (
	ErrNotFound = kvdb.ErrNotFound
	ErrExist    = kvdb.ErrExist
)
View Source
var (
	ErrIDNotSet = errors.New("ID not set")
)

Functions

func ActionString

func ActionString(a kvdb.KVAction) string

func IsKeyAlreadyExist

func IsKeyAlreadyExist(err error) bool

func IsKeyNotFound

func IsKeyNotFound(err error) bool

func NewKVDBClient

func NewKVDBClient(cfg *KVDBConfig) (kvdb.Kvdb, error)

NewKVDBClient - returns kvdb.KVDB interface based on provided configuration to access KV store directly

Types

type DeleteOptions

type DeleteOptions struct {
	PrevValue []byte
	KVFlags   kvdb.KVFlags
}

type FilesystemStore

type FilesystemStore interface {
	SetMaster(fm *types.FilesystemMaster, opts *SetOptions) error
	CompareAndSetMaster(fm *types.FilesystemMaster, opts *SetOptions) error
	GetMaster(id string) (*types.FilesystemMaster, error)
	DeleteMaster(id string) (err error)
	WatchMasters(idx uint64, cb WatchMasterCB) error
	ListMaster() ([]*types.FilesystemMaster, error)
	ImportMasters(fs []*types.FilesystemMaster, opts *ImportOptions) error

	// /filesystems/deleted/<id>
	SetDeleted(audit *types.FilesystemDeletionAudit, opts *SetOptions) error
	GetDeleted(id string) (*types.FilesystemDeletionAudit, error)
	DeleteDeleted(id string) error
	WatchDeleted(idx uint64, cb WatchDeletedCB) error
	ListDeleted() ([]*types.FilesystemDeletionAudit, error)

	// /filesystems/cleanupPending/<id>
	SetCleanupPending(audit *types.FilesystemDeletionAudit, opts *SetOptions) error
	DeleteCleanupPending(id string) error
	// /filesystems/cleanupPending
	ListCleanupPending() ([]*types.FilesystemDeletionAudit, error)
	WatchCleanupPending(idx uint64, cb WatchCleanupPendingCB) error

	// /filesystems/live/<id>
	SetLive(fl *types.FilesystemLive, opts *SetOptions) error
	GetLive(id string) (*types.FilesystemLive, error)

	// filesystems/containers/<id>
	SetContainers(fc *types.FilesystemContainers, opts *SetOptions) error
	DeleteContainers(id string) error
	WatchContainers(idx uint64, cb WatchContainersCB) error
	ListContainers() ([]*types.FilesystemContainers, error)

	// filesystems/dirty/<id>
	SetDirty(fd *types.FilesystemDirty, opts *SetOptions) error
	DeleteDirty(id string) error
	WatchDirty(idx uint64, cb WatchDirtyCB) error
	ListDirty() ([]*types.FilesystemDirty, error)

	SetTransfer(t *types.TransferPollResult, opts *SetOptions) error
	WatchTransfers(idx uint64, cb WatchTransfersCB) error
	ListTransfers() ([]*types.TransferPollResult, error)
}

type ImportOptions

type ImportOptions struct {
	DeleteExisting bool
}

type KVDBConfig

type KVDBConfig struct {
	Type     KVType // etcd/bolt/mem
	Machines []string
	Options  map[string]string
	Prefix   string
}

type KVDBFilesystemStore

type KVDBFilesystemStore struct {
	// contains filtered or unexported fields
}

func NewKVDBFilesystemStore

func NewKVDBFilesystemStore(client kvdb.Kvdb) *KVDBFilesystemStore

func (*KVDBFilesystemStore) CompareAndDelete

func (s *KVDBFilesystemStore) CompareAndDelete(namespace, filesystemName string, opts *DeleteOptions) error

func (*KVDBFilesystemStore) CompareAndSetFilesystem

func (s *KVDBFilesystemStore) CompareAndSetFilesystem(f *types.RegistryFilesystem, opts *SetOptions) error

func (*KVDBFilesystemStore) CompareAndSetMaster

func (s *KVDBFilesystemStore) CompareAndSetMaster(fm *types.FilesystemMaster, opts *SetOptions) error

func (*KVDBFilesystemStore) DeleteCleanupPending

func (s *KVDBFilesystemStore) DeleteCleanupPending(id string) error

func (*KVDBFilesystemStore) DeleteClone

func (s *KVDBFilesystemStore) DeleteClone(filesystemID, cloneName string) error

func (*KVDBFilesystemStore) DeleteContainers

func (s *KVDBFilesystemStore) DeleteContainers(id string) error

func (*KVDBFilesystemStore) DeleteDeleted

func (s *KVDBFilesystemStore) DeleteDeleted(id string) error

func (*KVDBFilesystemStore) DeleteDirty

func (s *KVDBFilesystemStore) DeleteDirty(id string) error

func (*KVDBFilesystemStore) DeleteFilesystem

func (s *KVDBFilesystemStore) DeleteFilesystem(namespace, filesystemName string) error

func (*KVDBFilesystemStore) DeleteMaster

func (s *KVDBFilesystemStore) DeleteMaster(id string) error

func (*KVDBFilesystemStore) GetDeleted

func (*KVDBFilesystemStore) GetFilesystem

func (s *KVDBFilesystemStore) GetFilesystem(namespace, filesystemName string) (*types.RegistryFilesystem, error)

func (*KVDBFilesystemStore) GetLive

func (*KVDBFilesystemStore) GetMaster

func (s *KVDBFilesystemStore) GetMaster(id string) (*types.FilesystemMaster, error)

func (*KVDBFilesystemStore) ImportClones

func (s *KVDBFilesystemStore) ImportClones(clones []*types.Clone, opts *ImportOptions) error

func (*KVDBFilesystemStore) ImportFilesystems

func (s *KVDBFilesystemStore) ImportFilesystems(fs []*types.RegistryFilesystem, opts *ImportOptions) error

func (*KVDBFilesystemStore) ImportMasters

func (s *KVDBFilesystemStore) ImportMasters(fs []*types.FilesystemMaster, opts *ImportOptions) error

func (*KVDBFilesystemStore) ListCleanupPending

func (s *KVDBFilesystemStore) ListCleanupPending() ([]*types.FilesystemDeletionAudit, error)

func (*KVDBFilesystemStore) ListClones

func (s *KVDBFilesystemStore) ListClones() ([]*types.Clone, error)

func (*KVDBFilesystemStore) ListContainers

func (s *KVDBFilesystemStore) ListContainers() ([]*types.FilesystemContainers, error)

func (*KVDBFilesystemStore) ListDeleted

func (s *KVDBFilesystemStore) ListDeleted() ([]*types.FilesystemDeletionAudit, error)

func (*KVDBFilesystemStore) ListDirty

func (s *KVDBFilesystemStore) ListDirty() ([]*types.FilesystemDirty, error)

func (*KVDBFilesystemStore) ListFilesystems

func (s *KVDBFilesystemStore) ListFilesystems() ([]*types.RegistryFilesystem, error)

func (*KVDBFilesystemStore) ListMaster

func (s *KVDBFilesystemStore) ListMaster() ([]*types.FilesystemMaster, error)

func (*KVDBFilesystemStore) ListTransfers

func (s *KVDBFilesystemStore) ListTransfers() ([]*types.TransferPollResult, error)

func (*KVDBFilesystemStore) SetCleanupPending

func (s *KVDBFilesystemStore) SetCleanupPending(f *types.FilesystemDeletionAudit, opts *SetOptions) error

func (*KVDBFilesystemStore) SetClone

func (s *KVDBFilesystemStore) SetClone(c *types.Clone, opts *SetOptions) error

func (*KVDBFilesystemStore) SetContainers

func (s *KVDBFilesystemStore) SetContainers(f *types.FilesystemContainers, opts *SetOptions) error

func (*KVDBFilesystemStore) SetDeleted

func (*KVDBFilesystemStore) SetDirty

func (s *KVDBFilesystemStore) SetDirty(f *types.FilesystemDirty, opts *SetOptions) error

func (*KVDBFilesystemStore) SetFilesystem

func (s *KVDBFilesystemStore) SetFilesystem(f *types.RegistryFilesystem, opts *SetOptions) error

func (*KVDBFilesystemStore) SetLive

func (*KVDBFilesystemStore) SetMaster

func (s *KVDBFilesystemStore) SetMaster(fm *types.FilesystemMaster, opts *SetOptions) error

SetMaster - creates master entry only if the key didn't previously exist (using Create method)

func (*KVDBFilesystemStore) SetTransfer

func (s *KVDBFilesystemStore) SetTransfer(t *types.TransferPollResult, opts *SetOptions) error

func (*KVDBFilesystemStore) WatchCleanupPending

func (s *KVDBFilesystemStore) WatchCleanupPending(idx uint64, cb WatchCleanupPendingCB) error

func (*KVDBFilesystemStore) WatchClones

func (s *KVDBFilesystemStore) WatchClones(idx uint64, cb WatchRegistryClonesCB) error

func (*KVDBFilesystemStore) WatchContainers

func (s *KVDBFilesystemStore) WatchContainers(idx uint64, cb WatchContainersCB) error

func (*KVDBFilesystemStore) WatchDeleted

func (s *KVDBFilesystemStore) WatchDeleted(idx uint64, cb WatchDeletedCB) error

func (*KVDBFilesystemStore) WatchDirty

func (s *KVDBFilesystemStore) WatchDirty(idx uint64, cb WatchDirtyCB) error

func (*KVDBFilesystemStore) WatchFilesystems

func (s *KVDBFilesystemStore) WatchFilesystems(idx uint64, cb WatchRegistryFilesystemsCB) error

func (*KVDBFilesystemStore) WatchMasters

func (s *KVDBFilesystemStore) WatchMasters(idx uint64, cb WatchMasterCB) error

func (*KVDBFilesystemStore) WatchTransfers

func (s *KVDBFilesystemStore) WatchTransfers(idx uint64, cb WatchTransfersCB) error

type KVDBStoreWithIndex

type KVDBStoreWithIndex struct {
	// contains filtered or unexported fields
}

func NewKVDBStoreWithIndex

func NewKVDBStoreWithIndex(client kvdb.Kvdb, namespace string) *KVDBStoreWithIndex

func (*KVDBStoreWithIndex) AddToIndex

func (s *KVDBStoreWithIndex) AddToIndex(prefix, name, id string) error

func (*KVDBStoreWithIndex) CreateWithIndex

func (s *KVDBStoreWithIndex) CreateWithIndex(prefix, id, name string, val []byte) (*kvdb.KVPair, error)

func (*KVDBStoreWithIndex) Delete

func (s *KVDBStoreWithIndex) Delete(prefix, id string) error

func (*KVDBStoreWithIndex) DeleteFromIndex

func (s *KVDBStoreWithIndex) DeleteFromIndex(prefix, name string) error

func (*KVDBStoreWithIndex) Get

func (s *KVDBStoreWithIndex) Get(prefix, ref string) (*kvdb.KVPair, error)

func (*KVDBStoreWithIndex) List

func (s *KVDBStoreWithIndex) List(prefix string) ([]*kvdb.KVPair, error)

func (*KVDBStoreWithIndex) Set

func (s *KVDBStoreWithIndex) Set(prefix, id string, val []byte) (*kvdb.KVPair, error)

type KVServerStore

type KVServerStore struct {
	// contains filtered or unexported fields
}

func NewKVServerStore

func NewKVServerStore(client kvdb.Kvdb) *KVServerStore

func (*KVServerStore) ListAddresses

func (s *KVServerStore) ListAddresses() ([]*types.Server, error)

func (*KVServerStore) ListSnapshots

func (s *KVServerStore) ListSnapshots() ([]*types.ServerSnapshots, error)

func (*KVServerStore) ListStates

func (s *KVServerStore) ListStates() ([]*types.ServerState, error)

func (*KVServerStore) SetAddresses

func (s *KVServerStore) SetAddresses(si *types.Server, opts *SetOptions) error

func (*KVServerStore) SetSnapshots

func (s *KVServerStore) SetSnapshots(ss *types.ServerSnapshots) error

func (*KVServerStore) SetState

func (s *KVServerStore) SetState(ss *types.ServerState) error

func (*KVServerStore) WatchAddresses

func (s *KVServerStore) WatchAddresses(idx uint64, cb WatchServerAddressesClonesCB) error

func (*KVServerStore) WatchSnapshots

func (s *KVServerStore) WatchSnapshots(idx uint64, cb WatchServerSnapshotsClonesCB) error

func (*KVServerStore) WatchStates

func (s *KVServerStore) WatchStates(idx uint64, cb WatchServerStatesClonesCB) error

type KVStoreWithIndex

type KVStoreWithIndex interface {
	List(prefix string) ([]*kvdb.KVPair, error)
	CreateWithIndex(prefix, id, name string, val []byte) (*kvdb.KVPair, error)

	DeleteFromIndex(prefix, name string) error
	AddToIndex(prefix, name, id string) error

	Set(prefix, id string, val []byte) (*kvdb.KVPair, error)
	Get(prefix, ref string) (*kvdb.KVPair, error)
	Delete(prefix, id string) error
}

KVStoreWithIndex is used by the UserManager to add users and then lookup them by their usernames

type KVType

type KVType string
const (
	KVTypeEtcdV3 KVType = "etcdv3"
	KVTypeMem    KVType = "mem"
	KVTypeBolt   KVType = "bolt"
)

type NameIndex

type NameIndex struct {
	Prefix string `json:"prefix"`
	Name   string `json:"name"`
	ID     string `json:"id"`
}

type RegistryStore

type RegistryStore interface {
	SetClone(c *types.Clone, opts *SetOptions) error
	DeleteClone(filesystemID, cloneName string) error
	WatchClones(idx uint64, cb WatchRegistryClonesCB) error
	ListClones() ([]*types.Clone, error)

	SetFilesystem(f *types.RegistryFilesystem, opts *SetOptions) error
	CompareAndSetFilesystem(f *types.RegistryFilesystem, opts *SetOptions) error
	GetFilesystem(namespace, filesystemName string) (*types.RegistryFilesystem, error)
	DeleteFilesystem(namespace, filesystemName string) error
	CompareAndDelete(namespace, filesystemName string, opts *DeleteOptions) error
	WatchFilesystems(idx uint64, cb WatchRegistryFilesystemsCB) error
	ListFilesystems() ([]*types.RegistryFilesystem, error)

	// Misc
	ImportClones(clones []*types.Clone, opts *ImportOptions) error
	ImportFilesystems(fs []*types.RegistryFilesystem, opts *ImportOptions) error
}

type ServerStore

type ServerStore interface {
	SetAddresses(si *types.Server, opts *SetOptions) error
	WatchAddresses(idx uint64, cb WatchServerAddressesClonesCB) error
	ListAddresses() ([]*types.Server, error)

	SetSnapshots(ss *types.ServerSnapshots) error
	WatchSnapshots(idx uint64, cb WatchServerSnapshotsClonesCB) error
	ListSnapshots() ([]*types.ServerSnapshots, error)

	SetState(ss *types.ServerState) error
	WatchStates(idx uint64, cb WatchServerStatesClonesCB) error
	ListStates() ([]*types.ServerState, error)
}

type SetOptions

type SetOptions struct {
	// TTL seconds
	TTL       uint64
	PrevValue []byte
	KVFlags   kvdb.KVFlags
	Force     bool
}

type WatchCleanupPendingCB

type WatchCleanupPendingCB func(fs *types.FilesystemDeletionAudit) error

Callbacks for filesystem events

type WatchContainersCB

type WatchContainersCB func(fs *types.FilesystemContainers) error

WatchLiveCB func(fs *types.FilesystemLive) error

type WatchDeletedCB

type WatchDeletedCB func(fs *types.FilesystemDeletionAudit) error

Callbacks for filesystem events

type WatchDirtyCB

type WatchDirtyCB func(fs *types.FilesystemDirty) error

Callbacks for filesystem events

type WatchMasterCB

type WatchMasterCB func(fs *types.FilesystemMaster) error

Callbacks for filesystem events

type WatchRegistryClonesCB

type WatchRegistryClonesCB func(c *types.Clone) error

type WatchRegistryFilesystemsCB

type WatchRegistryFilesystemsCB func(f *types.RegistryFilesystem) error

type WatchServerAddressesClonesCB

type WatchServerAddressesClonesCB func(server *types.Server) error

type WatchServerSnapshotsClonesCB

type WatchServerSnapshotsClonesCB func(server *types.ServerSnapshots) error

type WatchServerStatesClonesCB

type WatchServerStatesClonesCB func(server *types.ServerState) error

type WatchTransfersCB

type WatchTransfersCB func(fs *types.TransferPollResult) error

Callbacks for filesystem events

Jump to

Keyboard shortcuts

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