registry

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_BRANCH = "master"

Variables

This section is empty.

Functions

This section is empty.

Types

type ByNames

type ByNames []types.VolumeName

func (ByNames) Len

func (bn ByNames) Len() int

func (ByNames) Less

func (bn ByNames) Less(i, j int) bool

func (ByNames) Swap

func (bn ByNames) Swap(i, j int)

type DefaultRegistry

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

func NewRegistry

func NewRegistry(um user.UserManager, registryStore store.RegistryStore) *DefaultRegistry

func (*DefaultRegistry) ClonesFor

func (r *DefaultRegistry) ClonesFor(filesystemId string) map[string]types.Clone

map of clone names => clone objects for a given top-level filesystemId

func (*DefaultRegistry) CurrentMasterNode

func (r *DefaultRegistry) CurrentMasterNode(filesystemID string) (string, error)

func (*DefaultRegistry) DeducePathToTopLevelFilesystem

func (r *DefaultRegistry) DeducePathToTopLevelFilesystem(name types.VolumeName, cloneName string) (types.PathToTopLevelFilesystem, error)

func (*DefaultRegistry) DeleteCloneFromEtcd

func (r *DefaultRegistry) DeleteCloneFromEtcd(name string, topLevelFilesystemId string)

func (*DefaultRegistry) DeleteFilesystemFromEtcd

func (r *DefaultRegistry) DeleteFilesystemFromEtcd(name types.VolumeName)

func (*DefaultRegistry) DeleteMasterNode

func (r *DefaultRegistry) DeleteMasterNode(filesystemID string)

func (*DefaultRegistry) DumpClones

func (r *DefaultRegistry) DumpClones() map[string]map[string]types.Clone

func (*DefaultRegistry) DumpTopLevelFilesystems

func (r *DefaultRegistry) DumpTopLevelFilesystems() []*types.TopLevelFilesystem

func (*DefaultRegistry) Exists

func (r *DefaultRegistry) Exists(name types.VolumeName, cloneName string) string

filesystem id if exists, else ""

func (*DefaultRegistry) FilesystemIdsIncludingClones

func (r *DefaultRegistry) FilesystemIdsIncludingClones() []string

func (*DefaultRegistry) Filesystems

func (r *DefaultRegistry) Filesystems() []types.VolumeName

sorted list of top-level filesystem names

func (*DefaultRegistry) GetByName

func (*DefaultRegistry) GetMasterNode

func (r *DefaultRegistry) GetMasterNode(filesystemID string) (string, bool)

func (*DefaultRegistry) IdFromName

func (r *DefaultRegistry) IdFromName(name types.VolumeName) (string, error)

func (*DefaultRegistry) ListMasterNodes

func (r *DefaultRegistry) ListMasterNodes(query *ListMasterNodesQuery) map[string]string

func (*DefaultRegistry) LookupClone

func (r *DefaultRegistry) LookupClone(topLevelFilesystemId, cloneName string) (types.Clone, error)

Look up a clone. If you want to look up based on filesystem name and clone name, do: fsId := LookupFilesystem(fsName); cloneId := LookupClone(fsId, cloneName)

func (*DefaultRegistry) LookupCloneById

func (r *DefaultRegistry) LookupCloneById(filesystemId string) (types.Clone, error)

XXX make this more efficient

func (*DefaultRegistry) LookupCloneByIdWithName

func (r *DefaultRegistry) LookupCloneByIdWithName(filesystemId string) (types.Clone, string, error)

func (*DefaultRegistry) LookupFilesystem

func (r *DefaultRegistry) LookupFilesystem(name types.VolumeName) (types.TopLevelFilesystem, error)

func (*DefaultRegistry) LookupFilesystemById

func (r *DefaultRegistry) LookupFilesystemById(filesystemId string) (types.TopLevelFilesystem, string, error)

given a filesystem id, return the (types.TopLevelFilesystem, cloneName) tuple that it can be identified by to the user. XXX make this less horrifically inefficient by storing & updating inverted indexes.

func (*DefaultRegistry) MaybeCloneFilesystemId

func (r *DefaultRegistry) MaybeCloneFilesystemId(name types.VolumeName, cloneName string) (string, error)

given a top level fs name and a clone name, find the appropriate fs id

func (*DefaultRegistry) RegisterClone

func (r *DefaultRegistry) RegisterClone(name string, topLevelFilesystemId string, clone types.Clone) error

update a clone, including updating our local record and etcd

func (*DefaultRegistry) RegisterFilesystem

func (r *DefaultRegistry) RegisterFilesystem(ctx context.Context, name types.VolumeName, filesystemId string) error

update a filesystem, including updating etcd and our local state

func (*DefaultRegistry) RegisterFork

func (r *DefaultRegistry) RegisterFork(originFilesystemId string, originSnapshotId string, forkName types.VolumeName, forkFilesystemId string) error

func (*DefaultRegistry) SetMasterNode

func (r *DefaultRegistry) SetMasterNode(filesystemID, nodeID string)

func (*DefaultRegistry) UnregisterFilesystem

func (r *DefaultRegistry) UnregisterFilesystem(name types.VolumeName) error

Remove a filesystem from the registry

func (*DefaultRegistry) UpdateCloneFromEtcd

func (r *DefaultRegistry) UpdateCloneFromEtcd(name string, topLevelFilesystemId string, clone types.Clone)

func (*DefaultRegistry) UpdateCollaborators

func (r *DefaultRegistry) UpdateCollaborators(ctx context.Context, tlf types.TopLevelFilesystem, newCollaborators []user.SafeUser) error

func (*DefaultRegistry) UpdateFilesystemFromEtcd

func (r *DefaultRegistry) UpdateFilesystemFromEtcd(name types.VolumeName, rf types.RegistryFilesystem) error

type ListMasterNodesQuery

type ListMasterNodesQuery struct {
	NodeID string
}

type NoSuchClone

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

func (NoSuchClone) Error

func (n NoSuchClone) Error() string

type Registry

type Registry interface {
	Filesystems() []types.VolumeName
	IdFromName(name types.VolumeName) (string, error)
	GetByName(name types.VolumeName) (types.TopLevelFilesystem, error)
	FilesystemIdsIncludingClones() []string
	DeducePathToTopLevelFilesystem(name types.VolumeName, cloneName string) (types.PathToTopLevelFilesystem, error)

	ClonesFor(filesystemID string) map[string]types.Clone

	RegisterFilesystem(ctx context.Context, name types.VolumeName, filesystemID string) error
	UnregisterFilesystem(name types.VolumeName) error

	UpdateCollaborators(ctx context.Context, tlf types.TopLevelFilesystem, newCollaborators []user.SafeUser) error
	RegisterClone(name string, topLevelFilesystemId string, clone types.Clone) error
	RegisterFork(originFilesystemId string, originSnapshotId string, forkName types.VolumeName, forkFilesystemId string) error

	// TODO: why ..FromEtcd?
	UpdateFilesystemFromEtcd(name types.VolumeName, rf types.RegistryFilesystem) error
	DeleteFilesystemFromEtcd(name types.VolumeName)
	UpdateCloneFromEtcd(name string, topLevelFilesystemId string, clone types.Clone)
	DeleteCloneFromEtcd(name string, topLevelFilesystemId string)

	LookupFilesystem(name types.VolumeName) (types.TopLevelFilesystem, error)
	LookupClone(topLevelFilesystemId, cloneName string) (types.Clone, error)
	LookupCloneById(filesystemId string) (types.Clone, error)
	LookupCloneByIdWithName(filesystemId string) (types.Clone, string, error)
	LookupFilesystemById(filesystemId string) (types.TopLevelFilesystem, string, error)

	Exists(name types.VolumeName, cloneName string) string

	MaybeCloneFilesystemId(name types.VolumeName, cloneName string) (string, error)

	CurrentMasterNode(filesystemID string) (string, error)

	GetMasterNode(filesystemID string) (nodeID string, exists bool)
	SetMasterNode(filesystemID, nodeID string)
	DeleteMasterNode(filesystemID string)
	ListMasterNodes(query *ListMasterNodesQuery) map[string]string

	DumpTopLevelFilesystems() []*types.TopLevelFilesystem
	DumpClones() map[string]map[string]types.Clone
}

Jump to

Keyboard shortcuts

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