chunkref

package
v0.3.0-beta0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIteratorNil = blobref.ErrIteratorNil
)

Functions

func CacheKey

func CacheKey(u uuid.UUID) string

CacheKey returns a cache key string to store in the cache. It returns a string representation of the uuid key.

Types

type ChunkRef

type ChunkRef struct {
	// Key is the primary key of the ChunkRef.
	Key uuid.UUID `datastore:"-"`
	// BlobRef is the key of parent BlobRef.
	BlobRef uuid.UUID `datastore:"-"`
	// Number is the position of the chunk in the BlobRef.
	Number int32
	// Size is the byte size of the chunk.
	Size int32
	// Status is the current status of the chunk.
	blobref.Status

	// Checksums contains checksums for the chunk object.
	checksums.Checksums `datastore:",flatten"`

	// Timestamps keeps track of creation and modification times and stores a randomly
	// generated UUID to maintain consistency.
	Timestamps timestamps.Timestamps
}

ChunkRef is a metadata entity to keep track of chunks stored in an external blob store. It is a child entity of and always associated to a BlobRef.

func New

func New(blobRef uuid.UUID, number int32) *ChunkRef

New creates a new ChunkRef instance with the input parameters.

func (ChunkRef) CacheKey

func (c ChunkRef) CacheKey() string

CacheKey returns a cache key string to store in the cache. It returns a string representation of the uuid key.

func (*ChunkRef) DecodeBytes

func (c *ChunkRef) DecodeBytes(by []byte) error

DecodeBytes deserializes the byte slice given by by.

func (*ChunkRef) EncodeBytes

func (c *ChunkRef) EncodeBytes() ([]byte, error)

EncodeBytes returns a serialized byte slice of the object.

func (*ChunkRef) Load

func (c *ChunkRef) Load(ps []datastore.Property) error

Load implements the Datastore PropertyLoadSaver interface and converts Datastore properties to corresponding struct fields.

func (*ChunkRef) LoadKey

func (c *ChunkRef) LoadKey(k *datastore.Key) error

func (*ChunkRef) ObjectPath

func (c *ChunkRef) ObjectPath() string

func (*ChunkRef) Save

func (c *ChunkRef) Save() ([]datastore.Property, error)

Save implements the Datastore PropertyLoadSaver interface and converts struct fields to Datastore properties.

func (*ChunkRef) ToProto

func (c *ChunkRef) ToProto() *pb.ChunkMetadata

ToProto converts returns a pb.ChunkMetadata representation of the ChunkRef object.

type ChunkRefCursor

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

ChunkRefCursor is a database cursor for ChunkRef.

func NewCursor

func NewCursor(i *ds.Iterator) *ChunkRefCursor

func (*ChunkRefCursor) Next

func (i *ChunkRefCursor) Next() (*ChunkRef, error)

Next advances the iterator and returns the next value. Returns nil and and iterator.Done at the end of the iterator. Returns ErrIteratorNil if the iterator is nil.

Jump to

Keyboard shortcuts

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