storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0, MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesystemStorage

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

func NewFilesystemStorage

func NewFilesystemStorage(dir string, opts *FilesystemStorageOpts) (*FilesystemStorage, error)

func (*FilesystemStorage) GetChunk

func (s *FilesystemStorage) GetChunk(id contenthash.Hash) (io.ReadCloser, error)

GetChunk retrieves a chunk from storage.

func (*FilesystemStorage) GetObject

GetObject retrieves an object manifest from storage.

func (*FilesystemStorage) PutChunk

func (s *FilesystemStorage) PutChunk(id contenthash.Hash, r io.ReadSeeker) error

PutChunk adds a chunk to the storage.

func (*FilesystemStorage) PutObject

func (s *FilesystemStorage) PutObject(manifest *pb.ObjectManifest) error

PutObject adds an object manifest to the storage.

type FilesystemStorageOpts added in v0.5.0

type FilesystemStorageOpts struct {
	// NoSync disables fsync() calls after writing files. This will increase
	// performance but may lead to data loss in the event of a system crash.
	NoSync bool
}

type Storage

type Storage interface {
	// GetObject retrieves an object manifest from storage.
	GetObject(id contenthash.Hash) (*pb.ObjectManifest, error)
	// PutObject adds an object manifest to the storage.
	PutObject(manifest *pb.ObjectManifest) error
	// GetChunk retrieves a chunk from storage.
	GetChunk(id contenthash.Hash) (io.ReadCloser, error)
	// PutChunk adds a chunk to the storage.
	PutChunk(id contenthash.Hash, r io.ReadSeeker) error
}

Jump to

Keyboard shortcuts

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