disk

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

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

Disk implements the Storage interface by writing data to a disk

func New

func New(cfg *config.CacheZone, log types.Logger) (*Disk, error)

New returns a new disk storage that ready for use.

func (*Disk) ChangeConfig

func (s *Disk) ChangeConfig(log types.Logger)

ChangeConfig change the logger of the disk storage

func (*Disk) Discard

func (s *Disk) Discard(id *types.ObjectID) error

Discard removes the object and its metadata from the disk.

func (*Disk) DiscardPart

func (s *Disk) DiscardPart(idx *types.ObjectIndex) error

DiscardPart removes the specified part of an Object from the disk.

func (*Disk) GetAvailableParts

func (s *Disk) GetAvailableParts(oid *types.ObjectID) ([]*types.ObjectIndex, error)

GetAvailableParts returns types.ObjectIndexMap including all the available parts of for the object specified by the provided objectMetadata

func (*Disk) GetMetadata

func (s *Disk) GetMetadata(id *types.ObjectID) (*types.ObjectMetadata, error)

GetMetadata returns the metadata on disk for this object, if present.

func (*Disk) GetPart

func (s *Disk) GetPart(idx *types.ObjectIndex) (io.ReadCloser, error)

GetPart returns an io.ReadCloser that will read the specified part of the object from the disk.

func (*Disk) Iterate

func (s *Disk) Iterate(callback func(*types.ObjectMetadata, ...*types.ObjectIndex) bool) error

Iterate is a disk-specific function that iterates over all the objects on the disk and passes them to the supplied callback function. If the callback function returns false, the iteration stops.

func (*Disk) PartSize

func (s *Disk) PartSize() uint64

PartSize the maximum part size for the disk storage.

func (*Disk) SaveMetadata

func (s *Disk) SaveMetadata(m *types.ObjectMetadata) error

SaveMetadata writes the supplied metadata to the disk.

func (*Disk) SavePart

func (s *Disk) SavePart(idx *types.ObjectIndex, data io.Reader) error

SavePart writes the contents of the supplied object part to the disk.

Jump to

Keyboard shortcuts

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