storage

package
v0.2.14-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: ISC Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION string = "0.2.1"

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) CheckChunk

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

func (*Repository) CheckObject

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

func (*Repository) Close

func (repository *Repository) Close() error

func (*Repository) Configuration

func (repository *Repository) Configuration() RepositoryConfig

func (*Repository) DeleteChunk

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

func (*Repository) DeleteObject

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

func (*Repository) GetBlob

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

func (*Repository) GetCache

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

func (*Repository) GetChunk

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

func (*Repository) GetChunks

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

func (*Repository) GetCommandLine

func (repository *Repository) GetCommandLine() string

func (*Repository) GetHostname

func (repository *Repository) GetHostname() string

func (*Repository) GetIndexes

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

func (*Repository) GetMachineID

func (repository *Repository) GetMachineID() string

func (*Repository) GetMetadata

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

func (*Repository) GetObject

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

func (*Repository) GetObjects

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

func (*Repository) GetRBytes

func (repository *Repository) GetRBytes() uint64

func (*Repository) GetSecret

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

func (*Repository) GetUsername

func (repository *Repository) GetUsername() string

func (*Repository) GetWBytes

func (repository *Repository) GetWBytes() uint64

func (*Repository) Purge

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

func (*Repository) PutBlob

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

func (*Repository) PutChunk

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

func (*Repository) PutMetadata

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

func (*Repository) PutObject

func (repository *Repository) PutObject(checksum [32]byte, data []byte) (int, 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) SetMaxParallelism

func (repository *Repository) SetMaxParallelism(parallelism int)

func (*Repository) SetReadParallelism

func (repository *Repository) SetReadParallelism(parallelism int)

func (*Repository) SetSecret

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

func (*Repository) SetStatParallelism

func (repository *Repository) SetStatParallelism(parallelism int)

func (*Repository) SetUsername

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

func (*Repository) SetWriteParallelism

func (repository *Repository) SetWriteParallelism(parallelism int)

func (*Repository) Transaction

func (repository *Repository) Transaction(indexID uuid.UUID) (*Transaction, error)

type RepositoryBackend

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

	Transaction(indexID uuid.UUID) (TransactionBackend, error)

	GetIndexes() ([]uuid.UUID, error)
	GetMetadata(indexID uuid.UUID) ([]byte, error)
	PutMetadata(indexID uuid.UUID, data []byte) error
	GetBlob(checksum [32]byte) ([]byte, error)
	PutBlob(checksum [32]byte, data []byte) error

	GetObjects() ([][32]byte, error)
	GetObject(checksum [32]byte) ([]byte, error)
	CheckObject(checksum [32]byte) (bool, error)
	PutObject(checksum [32]byte, data []byte) error
	DeleteObject(checksum [32]byte) error

	GetChunks() ([][32]byte, error)
	GetChunk(checksum [32]byte) ([]byte, error)
	CheckChunk(checksum [32]byte) (bool, error)
	PutChunk(checksum [32]byte, data []byte) error
	DeleteChunk(checksum [32]byte) error

	Purge(indexID uuid.UUID) error

	Close() error
}

type RepositoryConfig

type RepositoryConfig struct {
	CreationTime time.Time
	RepositoryID uuid.UUID
	Version      string
	Encryption   string
	Compression  string
	Hashing      string
}

type Transaction

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

func (*Transaction) Commit

func (transaction *Transaction) Commit() error

func (*Transaction) GetUuid

func (transaction *Transaction) GetUuid() uuid.UUID

func (*Transaction) PutBlob

func (transaction *Transaction) PutBlob(checksum [32]byte, data []byte) error

func (*Transaction) PutMetadata

func (transaction *Transaction) PutMetadata(data []byte) error

type TransactionBackend

type TransactionBackend interface {
	GetUuid() uuid.UUID

	PutObject(checksum [32]byte, data []byte) error
	PutChunk(checksum [32]byte, data []byte) error

	PutMetadata(data []byte) error
	PutBlob(checksum [32]byte, data []byte) error

	Commit() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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