storage

package
v0.2.7-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: ISC Imports: 20 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 Reader

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

func (*Reader) Close

func (reader *Reader) Close() error

func (*Reader) GetContentType

func (reader *Reader) GetContentType() string

func (*Reader) Read

func (reader *Reader) Read(buf []byte) (int, error)

func (*Reader) Seek

func (reader *Reader) Seek(offset int64, whence int) (int64, error)

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

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

func (*Repository) GetHostname

func (repository *Repository) GetHostname() string

func (*Repository) GetIndex

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

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

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

func (*Repository) GetUsername

func (repository *Repository) GetUsername() string

func (*Repository) NewReader

func (repository *Repository) NewReader(rdIndex *index.Index, pathname string) (*Reader, error)

func (*Repository) Purge

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

func (*Repository) PutChunk

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

func (*Repository) PutFilesystem

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

func (*Repository) PutIndex

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

func (*Repository) PutMetadata

func (repository *Repository) PutMetadata(indexID uuid.UUID, data []byte) (int, 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) SetSecret

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

func (*Repository) SetUsername

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

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
	GetIndex(indexID uuid.UUID) ([]byte, error)
	PutIndex(indexID uuid.UUID, data []byte) error
	GetFilesystem(indexID uuid.UUID) ([]byte, error)
	PutFilesystem(indexID uuid.UUID, 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) PutFilesystem

func (transaction *Transaction) PutFilesystem(data []byte) (int, error)

func (*Transaction) PutIndex

func (transaction *Transaction) PutIndex(data []byte) (int, error)

func (*Transaction) PutMetadata

func (transaction *Transaction) PutMetadata(data []byte) (int, 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
	PutIndex(data []byte) error
	PutFilesystem(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