storage

package
v0.4.16-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION string = "0.5.0"

Variables

This section is empty.

Functions

func Backends

func Backends() []string

func Register

func Register(name string, backend func() RepositoryBackend)

Types

type Repository

type Repository struct {
	Location    string
	Username    string
	Hostname    string
	CommandLine string
	MachineID   string

	Cache *cache.Cache
	Key   []byte
	// contains filtered or unexported fields
}

func Create

func Create(location string, configuration RepositoryConfig) (*Repository, error)

func New

func New(location string) (*Repository, error)

func Open

func Open(location string) (*Repository, error)

func (*Repository) CheckBlob

func (repository *Repository) CheckBlob(checksum [32]byte) (bool, error)

func (*Repository) Close

func (repository *Repository) Close() error

func (*Repository) Commit

func (repository *Repository) Commit(indexID uuid.UUID, data []byte) error

func (*Repository) Configuration

func (repository *Repository) Configuration() RepositoryConfig

func (*Repository) DeleteBlob

func (repository *Repository) DeleteBlob(checksum [32]byte) error

func (*Repository) DeleteIndex

func (repository *Repository) DeleteIndex(checksum [32]byte) error

func (*Repository) DeleteLock

func (repository *Repository) DeleteLock(indexID uuid.UUID) error

func (*Repository) DeletePackfile

func (repository *Repository) DeletePackfile(checksum [32]byte) error

func (*Repository) DeleteSnapshot

func (repository *Repository) DeleteSnapshot(indexID uuid.UUID) error

func (*Repository) GetBlob

func (repository *Repository) GetBlob(checksum [32]byte) ([]byte, error)

func (*Repository) GetBlobs

func (repository *Repository) GetBlobs() ([][32]byte, error)

Blobs

func (*Repository) GetCache

func (repository *Repository) GetCache() *cache.Cache

func (*Repository) GetCommandLine

func (repository *Repository) GetCommandLine() string

func (*Repository) GetHostname

func (repository *Repository) GetHostname() string

func (*Repository) GetIndex

func (repository *Repository) GetIndex(checksum [32]byte) ([]byte, error)

func (*Repository) GetIndexes

func (repository *Repository) GetIndexes() ([][32]byte, error)

Indexes

func (*Repository) GetLock

func (repository *Repository) GetLock(indexID uuid.UUID) ([]byte, error)

func (*Repository) GetLocks

func (repository *Repository) GetLocks() ([]uuid.UUID, error)

locks

func (*Repository) GetMachineID

func (repository *Repository) GetMachineID() string

func (*Repository) GetPackfile

func (repository *Repository) GetPackfile(checksum [32]byte) ([]byte, error)

func (*Repository) GetPackfileSubpart

func (repository *Repository) GetPackfileSubpart(checksum [32]byte, offset uint32, length uint32) ([]byte, error)

func (*Repository) GetPackfiles

func (repository *Repository) GetPackfiles() ([][32]byte, error)

Packfiles

func (*Repository) GetRBytes

func (repository *Repository) GetRBytes() uint64

func (*Repository) GetRepositoryIndex

func (repository *Repository) GetRepositoryIndex() *index.Index

func (*Repository) GetSecret

func (repository *Repository) GetSecret() []byte

func (*Repository) GetSnapshot

func (repository *Repository) GetSnapshot(indexID uuid.UUID) ([]byte, error)

func (*Repository) GetSnapshots

func (repository *Repository) GetSnapshots() ([]uuid.UUID, error)

snapshots

func (*Repository) GetUsername

func (repository *Repository) GetUsername() string

func (*Repository) GetWBytes

func (repository *Repository) GetWBytes() uint64

func (*Repository) PutBlob

func (repository *Repository) PutBlob(checksum [32]byte, data []byte) error

func (*Repository) PutIndex

func (repository *Repository) PutIndex(checksum [32]byte, data []byte) error

func (*Repository) PutLock

func (repository *Repository) PutLock(indexID uuid.UUID, data []byte) error

func (*Repository) PutPackfile

func (repository *Repository) PutPackfile(checksum [32]byte, data []byte) error

func (*Repository) PutSnapshot

func (repository *Repository) PutSnapshot(indexID uuid.UUID, data []byte) error

func (*Repository) SetCache

func (repository *Repository) SetCache(localCache *cache.Cache) error

func (*Repository) SetCommandLine

func (repository *Repository) SetCommandLine(commandLine string) error

func (*Repository) SetHostname

func (repository *Repository) SetHostname(hostname string) error

func (*Repository) SetMachineID

func (repository *Repository) SetMachineID(machineID string) error

func (*Repository) SetRepositoryIndex

func (repository *Repository) SetRepositoryIndex(index *index.Index)

func (*Repository) SetSecret

func (repository *Repository) SetSecret(secret []byte) error

func (*Repository) SetUsername

func (repository *Repository) SetUsername(username string) error

type RepositoryBackend

type RepositoryBackend interface {
	Create(repository string, configuration RepositoryConfig) error
	Open(repository string) error
	Configuration() RepositoryConfig

	GetSnapshots() ([]uuid.UUID, error)
	PutSnapshot(indexID uuid.UUID, data []byte) error
	GetSnapshot(indexID uuid.UUID) ([]byte, error)
	DeleteSnapshot(indexID uuid.UUID) error

	GetLocks() ([]uuid.UUID, error)
	PutLock(indexID uuid.UUID, data []byte) error
	GetLock(indexID uuid.UUID) ([]byte, error)
	DeleteLock(indexID uuid.UUID) error

	GetBlobs() ([][32]byte, error)
	PutBlob(checksum [32]byte, data []byte) error
	CheckBlob(checksum [32]byte) (bool, error)
	GetBlob(checksum [32]byte) ([]byte, error)
	DeleteBlob(checksum [32]byte) error

	GetIndexes() ([][32]byte, error)
	PutIndex(checksum [32]byte, data []byte) error
	GetIndex(checksum [32]byte) ([]byte, error)
	DeleteIndex(checksum [32]byte) error

	GetPackfiles() ([][32]byte, error)
	PutPackfile(checksum [32]byte, data []byte) error
	GetPackfile(checksum [32]byte) ([]byte, error)
	GetPackfileSubpart(checksum [32]byte, offset uint32, length uint32) ([]byte, error)
	DeletePackfile(checksum [32]byte) error

	Commit(indexID uuid.UUID, data []byte) error

	Close() error
}

type RepositoryConfig

type RepositoryConfig struct {
	CreationTime time.Time
	RepositoryID uuid.UUID

	Version string

	Encryption    string
	EncryptionKey string

	Compression string

	Hashing string

	Chunking       string
	ChunkingMin    int
	ChunkingNormal int
	ChunkingMax    int

	PackfileSize int
}

Directories

Path Synopsis
backends
fs
s3

Jump to

Keyboard shortcuts

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