storage

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: 17 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDeduped

func CopyDeduped(sourceID, targetID string, sourceCluster, targetCluster *config.StorageClusterConfig) error

CopyDeduped copies all metadata of a deduped storage from a sourceID to a targetID, within the same cluster or between different clusters.

func CopyNonDeduped

func CopyNonDeduped(sourceID, targetID string, sourceCluster, targetCluster *config.StorageClusterConfig) error

CopyNonDeduped copies a non-deduped storage within the same or between different storage clusters.

func CopySemiDeduped

func CopySemiDeduped(sourceID, targetID string, sourceCluster, targetCluster *config.StorageClusterConfig) error

CopySemiDeduped copies a semi deduped storage within the same or between different storage clusters.

func DedupedVdiskExists

func DedupedVdiskExists(vdiskID string, cluster *config.StorageClusterConfig) (bool, error)

DedupedVdiskExists returns if the deduped vdisk in question exists in the given ardb storage cluster.

func DeleteData

func DeleteData(cfg config.StorageServerConfig, vdisks map[string]config.VdiskType) error

DeleteData deletes all data for the given vdisks from the given storage server.

func DeleteMetadata

func DeleteMetadata(cfg config.StorageServerConfig, vdisks map[string]config.VdiskType) error

DeleteMetadata deletes all metadata for the given vdisks from the given storage server.

func ListBlockIndices

func ListBlockIndices(id string, t config.VdiskType, ccfg *config.StorageClusterConfig) ([]int64, error)

ListBlockIndices returns all indices stored for the given storage. This function will always either return an error OR indices.

func ListDedupedBlockIndices

func ListDedupedBlockIndices(vdiskID string, cluster *config.StorageClusterConfig) ([]int64, error)

ListDedupedBlockIndices returns all indices stored for the given deduped storage. This function will always either return an error OR indices. If this function returns indices, they are guaranteed to be in order from smallest to biggest.

func ListNonDedupedBlockIndices

func ListNonDedupedBlockIndices(vdiskID string, cluster *config.StorageClusterConfig) ([]int64, error)

ListNonDedupedBlockIndices returns all indices stored for the given nondeduped storage. This function will always either return an error OR indices. If this function returns indices, they are guaranteed to be in order from smallest to biggest.

func ListSemiDedupedBlockIndices

func ListSemiDedupedBlockIndices(vdiskID string, cluster *config.StorageClusterConfig) ([]int64, error)

ListSemiDedupedBlockIndices returns all indices stored for the given semi deduped storage. This function will always either return an error OR indices.

func NonDedupedVdiskExists

func NonDedupedVdiskExists(vdiskID string, cluster *config.StorageClusterConfig) (bool, error)

NonDedupedVdiskExists returns if the non deduped vdisk in question exists in the given ardb storage cluster.

func ScanForAvailableVdisks

func ScanForAvailableVdisks(cfg config.StorageServerConfig) ([]string, error)

ScanForAvailableVdisks scans a given storage servers for available vdisks, and returns their ids.

func SemiDedupedVdiskExists

func SemiDedupedVdiskExists(vdiskID string, cluster *config.StorageClusterConfig) (bool, error)

SemiDedupedVdiskExists returns if the semi deduped vdisk in question exists in the given ardb storage cluster.

func VdiskExists

func VdiskExists(id string, t config.VdiskType, ccfg *config.StorageClusterConfig) (bool, error)

VdiskExists returns true if the vdisk question exists in the given ardb storage cluster. An error is returned in case this couldn't be verified for whatever reason.

Types

type BlockStorage

type BlockStorage interface {
	SetBlock(blockIndex int64, content []byte) (err error)
	GetBlock(blockIndex int64) (content []byte, err error)
	DeleteBlock(blockIndex int64) (err error)

	Flush() (err error)
	Close() (err error)
}

BlockStorage defines an interface for all a block storage. It can be used to set, get and delete blocks.

It is used by the `nbdserver.Backend` to implement the NBD Backend, as well as other modules, who need to manipulate the block storage for whatever reason.

func Deduped

func Deduped(vdiskID string, blockSize, lbaCacheLimit int64, templateSupport bool, provider ardb.ConnProvider) (BlockStorage, error)

Deduped returns a deduped BlockStorage

func NewBlockStorage

func NewBlockStorage(cfg BlockStorageConfig, provider ardb.ConnProvider) (storage BlockStorage, err error)

NewBlockStorage returns the correct block storage based on the given VdiskConfig.

func NewInMemoryStorage

func NewInMemoryStorage(vdiskID string, blockSize int64) BlockStorage

NewInMemoryStorage returns an in-memory BlockStorage implementation

func NonDeduped

func NonDeduped(vdiskID, templateVdiskID string, blockSize int64, templateSupport bool, provider ardb.ConnProvider) (BlockStorage, error)

NonDeduped returns a non deduped BlockStorage

func SemiDeduped

func SemiDeduped(vdiskID string, blockSize, lbaCacheLimit int64, provider ardb.ConnProvider) (BlockStorage, error)

SemiDeduped returns a semi deduped BlockStorage

type BlockStorageConfig

type BlockStorageConfig struct {
	// required: ID of the vdisk
	VdiskID string
	// optional: used for nondeduped storage
	TemplateVdiskID string

	// required: type of vdisk
	VdiskType config.VdiskType

	// required: block size in bytes
	BlockSize int64

	// optional: used by (semi)deduped storage
	LBACacheLimit int64
}

BlockStorageConfig is used when creating a block storage using the NewBlockStorage helper constructor.

func (*BlockStorageConfig) Validate

func (cfg *BlockStorageConfig) Validate() error

Validate this BlockStorageConfig.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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