lba

package
v1.1.0-alpha-8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StorageKeyPrefix is the prefix used in StorageKey
	StorageKeyPrefix = "lba:"
	// MinimumBucketSizeLimit defines how small the cache limit for the LBA
	// and thus a bucket can be at its extreme. Bigger is better.
	MinimumBucketSizeLimit = BytesPerSector * 8
)
View Source
const (
	// NumberOfRecordsPerLBASector is the fixed length of the LBASectors
	NumberOfRecordsPerLBASector = 128
	// BytesPerSector defines how many bytes each sector requires
	BytesPerSector = NumberOfRecordsPerLBASector * zerodisk.HashSize
)

Variables

This section is empty.

Functions

func StorageKey

func StorageKey(vdiskID string) string

StorageKey returns the LBA storage key used for a given deduped vdisk

Types

type LBA

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

LBA implements the functionality to lookup block keys through the logical block index. The data is persisted to an external metadataserver in sectors of n keys, where n = NumberOfRecordsPerLBASector.

func NewLBA

func NewLBA(vdiskID string, cacheLimitInBytes int64, provider ardb.MetadataConnProvider) (lba *LBA, err error)

NewLBA creates a new LBA

func (*LBA) Delete

func (lba *LBA) Delete(blockIndex int64) error

Delete the content hash for a specific block. When a key is updated, the sector containing this blockindex is marked as dirty and will be stored in the external metadaserver when Flush is called, or when the its getting evicted from the cache due to space limitations. Deleting means actually that the nilhash will be set for this blockindex.

func (*LBA) Flush

func (lba *LBA) Flush() error

Flush stores all dirty sectors to the external metadaserver

func (*LBA) Get

func (lba *LBA) Get(blockIndex int64) (zerodisk.Hash, error)

Get returns the hash for a block, nil if no hash is registered. If the sector containing this blockindex is not present, it is fetched from the external metadaserver

func (*LBA) Set

func (lba *LBA) Set(blockIndex int64, h zerodisk.Hash) error

Set the content hash for a specific block. When a key is updated, the sector containing this blockindex is marked as dirty and will be stored in the external metadataserver when Flush is called, or when the its getting evicted from the cache due to space limitations.

Jump to

Keyboard shortcuts

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