filesystem

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 23 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.3.4

type Config struct {
	BaseDirectory     string
	LockCheckInterval time.Duration
	LockLogTimeout    time.Duration
}

type ObjectServer

type ObjectServer struct {
	Config

	Params
	// contains filtered or unexported fields
}

func NewObjectServer

func NewObjectServer(baseDir string, logger log.Logger) (
	*ObjectServer, error)

func NewObjectServerWithConfigAndParams added in v0.3.4

func NewObjectServerWithConfigAndParams(config Config, params Params) (
	*ObjectServer, error)

func (*ObjectServer) AddObject

func (objSrv *ObjectServer) AddObject(reader io.Reader, length uint64,
	expectedHash *hash.Hash) (hash.Hash, bool, error)

AddObject will add an object. Object data are read from reader (length bytes are read). The object hash is computed and compared with expectedHash if not nil. The following are returned:

computed hash value
a boolean which is true if the object is new
an error or nil if no error.

func (*ObjectServer) AdjustRefcounts added in v0.3.4

func (objSrv *ObjectServer) AdjustRefcounts(increment bool,
	iterator objectserver.ObjectsIterator) error

AdjustRefcounts will increment or decrement the refcounts for each object yielded by the specified objects iterator. If there are missing objects or the iterator returns an error, the adjustments are reverted and an error is returned.

func (*ObjectServer) CheckObjects

func (objSrv *ObjectServer) CheckObjects(hashes []hash.Hash) ([]uint64, error)

func (*ObjectServer) CommitObject

func (objSrv *ObjectServer) CommitObject(hashVal hash.Hash) error

CommitObject will commit (add) a previously stashed object.

func (*ObjectServer) DeleteObject

func (objSrv *ObjectServer) DeleteObject(hashVal hash.Hash) error

func (*ObjectServer) DeleteStashedObject

func (objSrv *ObjectServer) DeleteStashedObject(hashVal hash.Hash) error

func (*ObjectServer) DeleteUnreferenced added in v0.3.4

func (objSrv *ObjectServer) DeleteUnreferenced(percentage uint8,
	bytes uint64) (uint64, uint64, error)

DeleteUnreferenced will delete some or all unreferenced objects. The oldest unreferenced objects are deleted first, until both the percentage and bytes thresholds are satisfied. The number of bytes and objects deleted are returned.

func (*ObjectServer) GetObject

func (objSrv *ObjectServer) GetObject(hashVal hash.Hash) (
	uint64, io.ReadCloser, error)

func (*ObjectServer) GetObjects

func (objSrv *ObjectServer) GetObjects(hashes []hash.Hash) (
	objectserver.ObjectsReader, error)

func (*ObjectServer) LastMutationTime

func (objSrv *ObjectServer) LastMutationTime() time.Time

func (*ObjectServer) ListObjectSizes

func (objSrv *ObjectServer) ListObjectSizes() map[hash.Hash]uint64

func (*ObjectServer) ListObjects

func (objSrv *ObjectServer) ListObjects() []hash.Hash

func (*ObjectServer) ListUnreferenced added in v0.3.4

func (objSrv *ObjectServer) ListUnreferenced() map[hash.Hash]uint64

func (*ObjectServer) NumObjects

func (objSrv *ObjectServer) NumObjects() uint64

func (*ObjectServer) SetAddCallback

func (objSrv *ObjectServer) SetAddCallback(callback objectserver.AddCallback)

func (*ObjectServer) SetGarbageCollector

func (objSrv *ObjectServer) SetGarbageCollector(
	gc objectserver.GarbageCollector)

SetGarbageCollector is deprecated.

func (*ObjectServer) StashOrVerifyObject

func (objSrv *ObjectServer) StashOrVerifyObject(reader io.Reader,
	length uint64, expectedHash *hash.Hash) (hash.Hash, []byte, error)

StashOrVerifyObject will stash an object if it is new or it will verify if it already exists. Object data are read from reader (length bytes are read). The object hash is computed and compared with expectedHash if not nil. The following are returned:

computed hash value
the object data if the object is new, otherwise nil
an error or nil if no error.

func (*ObjectServer) WriteHtml

func (objSrv *ObjectServer) WriteHtml(writer io.Writer)

type ObjectsReader

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

func (*ObjectsReader) Close

func (or *ObjectsReader) Close() error

func (*ObjectsReader) NextObject

func (or *ObjectsReader) NextObject() (uint64, io.ReadCloser, error)

func (*ObjectsReader) ObjectSizes

func (or *ObjectsReader) ObjectSizes() []uint64

type Params added in v0.3.4

type Params struct {
	Logger log.DebugLogger
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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