lba

package
v1.1.0-alpha-4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//NumberOfRecordsPerLBAShard is the fixed length of the LBAShards
	NumberOfRecordsPerLBAShard = 128
	// BytesPerShard defines how many bytes each shards requires
	BytesPerShard = NumberOfRecordsPerLBAShard * zerodisk.HashSize
)

Variables

This section is empty.

Functions

This section is empty.

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 shards of n keys, where n = NumberOfRecordsPerLBAShard.

func NewLBA

func NewLBA(vdiskID string, blockCount, cacheLimitInBytes int64, provider MetaRedisProvider) (lba *LBA, err error)

NewLBA creates a new LBA

func (*LBA) Delete

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

Delete the content hash for a specific block. When a key is updated, the shard containing this blockindex is marked as dirty and will be stored in the external metadaserver when Flush is called Deleting means actually that the nilhash will be set for this blockindex.

func (*LBA) Flush

func (lba *LBA) Flush() (err error)

Flush stores all dirty shards to the external metadaserver

func (*LBA) Get

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

Get returns the hash for a block, nil if no hash registered If the shard 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) (err error)

Set the content hash for a specific block. When a key is updated, the shard containing this blockindex is marked as dirty and will be stored in the external metadataserver when Flush is called.

type MetaRedisProvider

type MetaRedisProvider interface {
	MetaRedisConnection() (redis.Conn, error)
}

MetaRedisProvider is used by the LBA, to retreive a Redis Meta Connection

Jump to

Keyboard shortcuts

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