filesystem

package
v0.0.0-...-d8f7d12 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectServer

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

func NewObjectServer

func NewObjectServer(baseDir string, logger log.Logger) (
	*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) 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) 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) 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)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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