grados

package module
v0.0.0-...-ec435a2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

README

grados

Package grados is a go library for communicating with librados. This requires that the host machine this runs on has ceph and the librados library.

Usage

To start communicating with ceph, a connection to a cluster needs to be established.

Connect to the default cluster using the configuration found in /etc/ceph:

    // connect to default cluster
    cluster, err := rados.ConnectToDefaultCluster()

    // disconnect from cluster
    cluster.Shutdown()

Basic pool operations can be done:

    // create a pool
    err := cluster.CreatePool("new_pool")

    // deletes a pool
    err := cluster.DeletePool("new_pool")

    // manage a pool
    pool, err := cluster.CreatePool("new_pool")

    // stop managing the pool
    pool.Close()

Basic object operations:

    // manage an object
    object := pool.ManageObject("object_name")

    // write to object
    err := object.WriteFull(my_data_reader)

    // read from an object
    reader, err := object.Read(lengthToRead, offset)

    // remove an object
    err := object.Remove()

Async object operations:

    // manage object asynchronously
    asyncObject := pool.ManageObject("my_object").AsyncMode(completeCallback, safeCallback, errCallback, "arg1", "arg2")

    // async write
    asyncObject.WriteFull(my_data_reader)

    // async read. result will be stored in args.
    asyncObject.Read(10, 0)

    // async remove.
    asyncObjet.Remove()

Other features implemented are:

  • pool snapshots
  • managed-snapshots
  • read/write transactions
  • object extended attributes

Missing implementation:

  • OMAP/TMAP operations (TODO)
  • class executions (TODO)
  • mon/osd/pg commands (necessary?)
  • watch/unwatch/notify objects (still looking for a way to do this)

More info here

Still WIP

Documentation

Overview

Package grados is a go library for communicating with librados. This requires that the host machine this runs on has ceph and the librados library.

Usage

To start communicating with ceph, a connection to a cluster needs to be established.

Connect to the default cluster using the configuration found in /etc/ceph:

// connect to default cluster
cluster, err := rados.ConnectToDefaultCluster()

// disconnect from cluster
cluster.Shutdown()

Basic pool operations can be done:

// create a pool
err := cluster.CreatePool("new_pool")

// deletes a pool
err := cluster.DeletePool("new_pool")

// manage a pool
pool, err := cluster.CreatePool("new_pool")

// stop managing the pool
pool.Close()

Basic object operations:

// manage an object
object := pool.ManageObject("object_name")

// write to object
err := object.WriteFull(my_data_reader)

// read from an object
reader, err := object.Read(lengthToRead, offset)

// remove an object
err := object.Remove()

Async object operations:

// manage object asynchronously
asyncObject := pool.ManageObject("my_object").AsyncMode(completeCallback, safeCallback, errCallback, "arg1", "arg2")

// async write
asyncObject.WriteFull(my_data_reader)

// async read. result will be stored in args.
asyncObject.Read(10, 0)

// async remove.
asyncObjet.Remove()

Other features implemented are:

  • pool snapshots
  • managed-snapshots
  • read/write transactions
  • object extended attributes

Missing implementation:

  • OMAP/TMAP operations (TODO)
  • class executions (TODO)
  • mon/osd/pg commands (necessary?)
  • watch/unwatch/notify objects (still looking for a way to do this)

Index

Constants

View Source
const (
	OperationExclusive LibradosOpFlag = C.LIBRADOS_OP_FLAG_EXCL   // Fails a create operation if the object already exists.
	OperationFailOk    LibradosOpFlag = C.LIBRADOS_OP_FLAG_FAILOK // Allows the transaction to succeed even if the flagged operation fails.

	Equal            CompareAttribute = C.LIBRADOS_CMPXATTR_OP_EQ  // == comparaison operator.
	NotEqual         CompareAttribute = C.LIBRADOS_CMPXATTR_OP_NE  // != comparison operator.
	GreaterThan      CompareAttribute = C.LIBRADOS_CMPXATTR_OP_GT  // > comparison operator.
	GreaterThanEqual CompareAttribute = C.LIBRADOS_CMPXATTR_OP_GTE // >= comparison operaor.
	LessThan         CompareAttribute = C.LIBRADOS_CMPXATTR_OP_LT  // < comparison operator.
	LessThanEqual    CompareAttribute = C.LIBRADOS_CMPXATTR_OP_LTE // <= comparison operator.

	CreateExclusive  CreateMode = C.LIBRADOS_CREATE_EXCLUSIVE  // Fails a create operation if the object already exists.
	CreateIdempotent CreateMode = C.LIBRADOS_CREATE_IDEMPOTENT // Does not fail a create operation if the object exists.

	NoFlag          LibradosOperation = C.LIBRADOS_OPERATION_NOFLAG             // General Librados Flag. Not much detail in Librados API.
	BalanceReads    LibradosOperation = C.LIBRADOS_OPERATION_BALANCE_READS      // General Librados Flag. Not much detail in Librados API.
	LocalizeReads   LibradosOperation = C.LIBRADOS_OPERATION_LOCALIZE_READS     // General Librados Flag. Not much detail in Librados API.
	OrderReadWrites LibradosOperation = C.LIBRADOS_OPERATION_ORDER_READS_WRITES // General Librados Flag. Not much detail in Librados API.
	IgnoreCache     LibradosOperation = C.LIBRADOS_OPERATION_IGNORE_CACHE       // General Librados Flag. Not much detail in Librados API.
	SkipRWLocks     LibradosOperation = C.LIBRADOS_OPERATION_SKIPRWLOCKS        // General Librados Flag. Not much detail in Librados API.
	IgnoreOverlay   LibradosOperation = C.LIBRADOS_OPERATION_IGNORE_OVERLAY     // General Librados Flag. Not much detail in Librados API.

	NoSnapshot = C.LIBRADOS_SNAP_HEAD // Use this to disable snapshop selection when performing object operations.

	Renew LibradosLock = C.LIBRADOS_LOCK_FLAG_RENEW // Lock Flag. Not much detail in Librados API.
)

Variables

This section is empty.

Functions

func Version

func Version() string

Version will return current librados version.

Types

type ASyncIoErrorCallback

type ASyncIoErrorCallback func(err error, args ...interface{})

ASyncIoErrorCallback is the signature of a callback function that will be called when an asynchronous operation has an unexpected error.

type AsyncIoCallback

type AsyncIoCallback func(args ...interface{})

AsyncIoCallback is the signature of a callback function that can be used on asynchronous operations. This can receive a number of arguments that is passed during async function calls or can contain result data from the asychronous operation.

type AsyncObject

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

AsyncObject represents an object ready for asynchronous operations. Use AsyncMode from an object instance to create a valid AsyncObjet instance.

func (*AsyncObject) Append

func (ao *AsyncObject) Append(data io.Reader)

Append performs an append operation asynchronously.

func (*AsyncObject) Read

func (ao *AsyncObject) Read(length, offset uint64)

Read reads from the object a specific length starting at the given offset. The read data is stored in an io.Reader and is appended at the end of the args passed to the onComplete and onSafe callbacks.

func (*AsyncObject) Release

func (ao *AsyncObject) Release()

Release stops asynchronous mode. No asynchronous operations should be done to the AsyncObject after this is called.

func (*AsyncObject) Remove

func (ao *AsyncObject) Remove()

Remove removes an object asynchronously.

func (*AsyncObject) Write

func (ao *AsyncObject) Write(data io.Reader, offset uint64)

Write performes a write operation asynchronously.

func (*AsyncObject) WriteFull

func (ao *AsyncObject) WriteFull(data io.Reader)

WriteFull performs a full write operation asynchronously.

type AttributeList

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

AttributeList is an iterator to an object's extended attributes.

func (*AttributeList) Close

func (i *AttributeList) Close()

Close closes the iterator. The iterator should not be used after this.

func (*AttributeList) Next

func (i *AttributeList) Next() (name string, value io.Reader, err error)

Next returns the next extended attribute. This returns an error when there are no more attributes.

type Cluster

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

Cluster represents a Cluster handle encapsulating the functions in librados that requires a cluster handle.

func ConnectToDefaultCluster

func ConnectToDefaultCluster() (*Cluster, error)

ConnectToDefaultCluster will connect to the default cluster based on configuration in /etc/ceph/.

func ConnectWithExistingConfig

func ConnectWithExistingConfig(config *ClusterConfig) (*Cluster, error)

func (*Cluster) Config

func (cluster *Cluster) Config() *ClusterConfig

func (*Cluster) CreatePool

func (cluster *Cluster) CreatePool(poolName string) error

CreatePool creates a new pool using the given poolName. This uses the default pool configuration.

func (*Cluster) CreatePoolWithAll

func (cluster *Cluster) CreatePoolWithAll(poolName string, auid uint64, crushRule uint8) error

CreatePoolWithAll creates a new pool using the given poolName with both auid and crushRule set.

func (*Cluster) CreatePoolWithCrushRule

func (cluster *Cluster) CreatePoolWithCrushRule(poolName string, crushRule uint8) error

CreatePoolWithCrushRule creates a new pool using the given poolName with a crushRule set.

func (*Cluster) CreatePoolWithOwner

func (cluster *Cluster) CreatePoolWithOwner(poolName string, auid uint64) error

CreatePoolWithOwner creates a new pool using the given poolName and sets it auid.

func (*Cluster) DeletePool

func (cluster *Cluster) DeletePool(poolName string) error

DeletePool removes a pool from the cluster.

func (*Cluster) FSID

func (cluster *Cluster) FSID() string

FSID returns the FSID of the cluster.

func (*Cluster) GetConfigValue

func (cluster *Cluster) GetConfigValue(configName string) (string, error)

GetConfig returns the configuration value of the given configName.

func (*Cluster) InstanceId

func (cluster *Cluster) InstanceId() uint64

InstanceId returns the instance ID of the current connection.

func (*Cluster) ListPools

func (cluster *Cluster) ListPools() ([]string, error)

ListPools returns all the pools in the ceph cluster.

func (*Cluster) LookupPool

func (cluster *Cluster) LookupPool(poolName string) (int64, error)

LookupPool returns the pool ID of the given pool name.

func (*Cluster) ManagePool

func (cluster *Cluster) ManagePool(poolName string) (*Pool, error)

ManagePool opens a pool for query, read, and write operations.

func (*Cluster) PingMonitor

func (cluster *Cluster) PingMonitor(monitorId string) (string, error)

PingMonitor will query the given monitor to check it's status TODO: Make struct for result

func (*Cluster) ReverseLookupPool

func (cluster *Cluster) ReverseLookupPool(id int64) (string, error)

ReverseLookupPool returns the pool name of the given pool ID.

func (*Cluster) Shutdown

func (cluster *Cluster) Shutdown()

Shutdown will close the connection to the cluster.

func (*Cluster) Status

func (cluster *Cluster) Status() (*ClusterStatus, error)

Status returns the ClusterStatus

func (*Cluster) WaitForLatestOsdMap

func (cluster *Cluster) WaitForLatestOsdMap() error

WaitForLatestOsdMap blocks until the latest OSD Map is ready

type ClusterConfig

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

ClusterConfig represents a config handle of a ceph cluster.

type ClusterStatus

type ClusterStatus struct {
	Total   uint64 // Total storage space of the cluster in KiloBytes.
	Used    uint64 // Used space of the cluster in KiloBytes.
	Free    uint64 // Free space of the cluster in KiloBytes.
	Objects uint64 // Number of objects in the cluster.
}

ClusterStatus represents the status of the cluster.

func (*ClusterStatus) String

func (cs *ClusterStatus) String() string

Pretty form of ClusterStatus

type CompareAttribute

type CompareAttribute int

CompareAttribute are read/write operation compare operators.

type Connection

type Connection struct {

	// The cluster name of ceph cluster to connect to. If this is left as an empty string adn the UserName is also
	// empty, the default configuration will be used. If this is specified, the UserName should also be specified and
	// should be fully qualified (eg. client.admin instead of just admin)
	ClusterName string

	// The UserName to connect as. This should be the fully qualified user name if the cluster name is specified. If the
	// cluster name is not specified, this should just be the user name without the "client." prefix. This can be empty
	// if the ClusterName is empty and the defaults will be used.
	UserName string

	// The ceph config file path. This should be a path to the ceph configuration file. If this is empty and all other
	// configuration settings are also empty, then the default configuration will be used.
	ConfigFile string

	// Parse the command line arguments for configuration. This will use the command line arguments as the configuration
	// to connect to the ceph cluster. If this is false and all other configuration settings are also emtpy, the default
	// configuration will be used.
	ParseArgs bool

	// Use an environment variable to specify the configuration. The environment variable should have the command line
	// flags for configuration. If this is empty and all other configuration settings are empty, the default
	// configuration will be used.
	ConfigEnv string

	// Use a map[string]string to use as the K/V configuration. If this is empty and all other configuration settings
	// are empty, the default configuration will be used.
	ConfigMap map[string]string
	// contains filtered or unexported fields
}

Connection represents a connection to a ceph cluster. Calling the Connect() function will connect to a ceph cluster using whatever has been set in this struct. There are also helper functions to configure a connection. See To(), As() UnseConfigFile(), UseConfigArgs(), UseConfigEnv(), and UseConfigMap().

func (*Connection) As

func (conn *Connection) As(user string) *Connection

As will set the cluster user name to connect as.

func (*Connection) Connect

func (conn *Connection) Connect() (*Cluster, error)

Connect will connect to the cluster based on the values it contains.

func (*Connection) To

func (conn *Connection) To(cluster string) *Connection

To will set the cluster name to connect to.

func (*Connection) UseConfigArgs

func (conn *Connection) UseConfigArgs() *Connection

UseConfigArgs will load configuration from the command line args.

func (*Connection) UseConfigEnv

func (conn *Connection) UseConfigEnv(env string) *Connection

UseConfigEnv will load configuration from the given environment variable.

func (*Connection) UseConfigFile

func (conn *Connection) UseConfigFile(configFile string) *Connection

UseConfigFile will user a custom configuration file instead of the default.

func (*Connection) UseConfigMap

func (conn *Connection) UseConfigMap(configMap map[string]string) *Connection

UserConfigMap will load configuration based on the content of the configMap.

type CreateMode

type CreateMode int

CreateMode are write operation object creation flags.

type LibradosLock

type LibradosLock int

LibradosLock are object lock flags.

type LibradosOpFlag

type LibradosOpFlag int

LibradosOpFlag are librados read/write operation flags.

type LibradosOperation

type LibradosOperation int

LibradosOperation are general librados read/write operation flags.

type Locker

type Locker struct {
	Client  string // The client.
	Cookies string // The cookies.
	Address string // The address.
}

Locker represents a client that has locked an object.

type ManagedSnapshot

type ManagedSnapshot struct {
	Id SnapshotId
	// contains filtered or unexported fields
}

ManagedSnapshot is a reference to a self managed snapshot Id.

func (*ManagedSnapshot) Remove

func (snapshot *ManagedSnapshot) Remove() error

Remove will lazily remove the self managed snapshot.

func (*ManagedSnapshot) Rollback

func (snapshot *ManagedSnapshot) Rollback(objectId string) error

Rollback will rollback an object to this snapshot. TODO: Needs testing

func (*ManagedSnapshot) SetAsWriteContext

func (snapshot *ManagedSnapshot) SetAsWriteContext(snapshots ManagedSnapshots) error

SetAsWriteContext sets all new writes will use this snapshot when writing. // TODO: Needs better testing

type ManagedSnapshots

type ManagedSnapshots []*ManagedSnapshot

Snapshots represents a list of Snapshot reference

func (ManagedSnapshots) Len

func (s ManagedSnapshots) Len() int

Len implements sort.Interface for sorting. Returns the number of snaphots.

func (ManagedSnapshots) Less

func (s ManagedSnapshots) Less(i, j int) bool

Less implements sort.Interface for sorting. Returns true if index i is less than index j.

func (ManagedSnapshots) Swap

func (s ManagedSnapshots) Swap(i, j int)

Swap implements sort.Interface for sorting. Swaps the values of index i and j.

type Object

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

Object represents an object. The object may or may not be stored yet. This allows for atomic CRUD oerations to the object represented. Use ManageObject to create a valid instance.

func (*Object) Append

func (o *Object) Append(data io.Reader) error

Append appends new data to the object

func (*Object) AsyncMode

func (o *Object) AsyncMode(onComplete, onSafe AsyncIoCallback, onError ASyncIoErrorCallback, args ...interface{}) *AsyncObject

AsyncMode Prepares the object for asynchronous operations. If callbacks are set to nil, the results will be ignored. args passed here will be passed to the callbacks.

func (*Object) Attribute

func (o *Object) Attribute(attributeName string) (io.Reader, error)

Attribute returns an extended attribute of the object.

func (*Object) BreakLock

func (o *Object) BreakLock(name, client, cookie string) error

BreakLock forcefully breaks the object lock. This fails if specified client does not hold the lock.

func (*Object) Clone

func (o *Object) Clone(target *Object, srcOffset, dstOffset, length uint64) error

Clone clones a length of data from an object given an offest to another object starting at an offset. The source and destination objects must be on the same PG. This requires that a locator key must be set first.

func (*Object) ListLockers

func (o *Object) ListLockers(name string) ([]*Locker, string, error)

ListLockers show all the clients that has locks on the object. This also returns the lock tag if any.

func (*Object) LockExclusive

func (o *Object) LockExclusive(name, cookie, description string, flags ...LibradosLock) error

LockExclusive exclusively locks an object. At the moment, lock duration cannot be specified so this locks the object indefinitely.

func (*Object) LockShared

func (o *Object) LockShared(name, cookie, tag, description string, flags ...LibradosLock) error

LockShared share locks an object. At the moment, lock duration cannot be specified so this locks the object indefinitely.

func (*Object) Name

func (o *Object) Name() string

Name returns the name or id of the object.

func (*Object) OpenAttributeList

func (o *Object) OpenAttributeList() (*AttributeList, error)

OpenAttributeList returns an iterator of the object's attributes.

func (*Object) Read

func (o *Object) Read(length, offset uint64) (io.Reader, error)

Read reads a specified length of data from the object starting at the given offset.

func (*Object) Remove

func (o *Object) Remove() error

Remove removes the object from the pool.

func (*Object) RemoveAttribute

func (o *Object) RemoveAttribute(attributeName string) error

RemoveAttribute removes an attribute of the object.

func (*Object) SetAllocationHint

func (o *Object) SetAllocationHint(expectedObjectSize, expectedWriteSize uint64)

SetAllocationHint sets the expected object size and expected write size of an object. As per latest doc, this may not actually do anything.

func (*Object) SetAttribute

func (o *Object) SetAttribute(attributeName string, attributeValue io.Reader) error

SetAttribute sets an extended attribute of the object.

func (*Object) Status

func (o *Object) Status() (*ObjectStatus, error)

Status returns the status of an object.

func (*Object) Truncate

func (o *Object) Truncate(size uint64) error

Truncate modifies the size of an object. If the object size in increased, the new space is zero-filled. If the size is reduced, the excess data is removed.

func (*Object) Unlock

func (o *Object) Unlock(name, cookie string) error

Unlock unlocks a locked object. This returns an error if the lock is not owned by the current client.

func (*Object) Write

func (o *Object) Write(data io.Reader, offset uint64) error

Write writes the data at a specific offset to the object.

func (*Object) WriteFull

func (o *Object) WriteFull(data io.Reader) error

WriteFull writes the entire data to the object replacing old data.

type ObjectList

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

ObjectList represents a handler for iterating through objects of a pool.

func (*ObjectList) Close

func (ol *ObjectList) Close()

Close closes the iterator.

func (*ObjectList) Next

func (ol *ObjectList) Next() (object *Object, locationKey string, err error)

Next returns the objectId and locationKey (if any) of the next object.

func (*ObjectList) Position

func (ol *ObjectList) Position() uint32

Position returns the hash of the position rounded to the nearest PG.

func (*ObjectList) Seek

func (ol *ObjectList) Seek(position uint32) uint32

Seek moves the iterator pointer to the given position. This returns the new position rouded to the nearest PG.

type ObjectStatus

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

ObjectStatus represents the status of the object. Documentation on this is a big vague so this may or may not be very accurate.

type Pool

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

Pool represents a pool io context. This contains pool related functions.

func (*Pool) AUID

func (pool *Pool) AUID() (uint64, error)

AUID returns the AUID of the pool.

func (*Pool) Close

func (pool *Pool) Close()

CloseNow this pool context immediately.

func (*Pool) Cluster

func (pool *Pool) Cluster() *Cluster

Cluster returns a reference of the Cluster handle.

func (*Pool) Config

func (pool *Pool) Config() *ClusterConfig

Config returns a reference of the ClusterConfig.

func (*Pool) CreatePoolSnapshot

func (pool *Pool) CreatePoolSnapshot(snapshotName string) error

CreateSnapshot creates a pool wide snapshot.

func (*Pool) CreateReadOperation

func (pool *Pool) CreateReadOperation() (*ReadOperation, error)

func (*Pool) CreateSelfManagedSnapshot

func (pool *Pool) CreateSelfManagedSnapshot() (*ManagedSnapshot, error)

CreateSelfManagedSnapshot creates an id for reference to manipulating self managed snapshots. A clone will not be created until a write using the created snapshot context is done.

func (*Pool) CreateWriteOperation

func (pool *Pool) CreateWriteOperation() (*WriteOperation, error)

func (*Pool) Id

func (pool *Pool) Id() int64

Id returns the id of the pool.

func (*Pool) LastObjectVersion

func (pool *Pool) LastObjectVersion() uint64

LastObjectVersion returns the version of the last object read or written.

func (*Pool) ListPoolSnapshots

func (pool *Pool) ListPoolSnapshots() []SnapshotId

ListSelfManagedSnapshots returns a list of all self managed snapshots.

func (*Pool) LookupPoolSnapshot

func (pool *Pool) LookupPoolSnapshot(snapshotName string) (SnapshotId, error)

SnapshotLookup returns the id of the given snapshot.

func (*Pool) ManageObject

func (pool *Pool) ManageObject(name string) *Object

ManageObject manages an object. This can read/write/update/delete objects.

func (*Pool) Name

func (pool *Pool) Name() string

Name returns the name of the pool.

func (*Pool) OpenObjectList

func (pool *Pool) OpenObjectList() (*ObjectList, error)

OpenObjectList returns an ObjectList handler to start iterating over objects of a pool.

func (*Pool) RemovePoolSnapshot

func (pool *Pool) RemovePoolSnapshot(snapshotName string) error

RemoveSnapshot removes a pool wide snapshot.

func (*Pool) RequiredAlignment

func (pool *Pool) RequiredAlignment() uint64

TODO:

func (*Pool) RequiresAlignment

func (pool *Pool) RequiresAlignment() bool

RequiresAlignment returns true if the pool requires alignment.

func (*Pool) ReverseLookupSnapshot

func (pool *Pool) ReverseLookupSnapshot(snapId SnapshotId) (string, error)

ReverseLookupSnapshot returns the name of the given pool snapshot id.

func (*Pool) RollbackToPoolSnapshot

func (pool *Pool) RollbackToPoolSnapshot(objectName, snapshotName string) error

RollbackSnapshot rolls back an object to a pool snapshot.

func (*Pool) SafeClose

func (pool *Pool) SafeClose()

CloseWhenDone this pool context when all asynchronous writes are done.

func (*Pool) SetAUID

func (pool *Pool) SetAUID(auid uint64) error

SetAUID attempts to change the AUID for the pool.

func (*Pool) SetLocatorKey

func (pool *Pool) SetLocatorKey(key string)

SetLocatorKey sets the key for mapping objects to pgs.

The key is used instead of the object name to determine which placement groups an object is put in. This affects all subsequent operations of the io context - until a different locator key is set, all objects in this io context will be placed in the same pg.

This is useful if you need to do clone_range operations, which must be done with the source and destination objects in the same pg.

func (*Pool) SetNamespace

func (pool *Pool) SetNamespace(namespace string)

Set the namespace for objects.

The namespace specification further refines a pool into different domains. The mapping of objects to pgs is also based on this value.

func (*Pool) SnapshotTimestamp

func (pool *Pool) SnapshotTimestamp(snapId SnapshotId) (time.Time, error)

SnapshotTimestamp returns the timestamp the snapshot was created.

func (*Pool) Status

func (pool *Pool) Status() (*PoolStatus, error)

Status retrieves the PoolStatus.

func (*Pool) UseSnapshot

func (pool *Pool) UseSnapshot(snapId SnapshotId)

UseSnapshot sets the pool context to use the snapshot for successive reads. Use NoSnapshot to not use snapshots when reading.

type PoolStatus

type PoolStatus struct {
	FreeBytes               uint64 // Free space in bytes.
	FreeKiloBytes           uint64 // Free space in kilobytes.
	Objects                 uint64 // number of objects.
	ObjectClones            uint64 // number of object clones.
	ObjectCopies            uint64 // number of object copies.
	ObjectsMissingOnPrimary uint64 // number of objects missing on primary.
	ObjectsFound            uint64 // number of objects found.
	ObjectsDegraded         uint64 // number of objects degraded.
	ReadBytes               uint64 // read bytes.
	ReadKiloBytes           uint64 // read bytes in kilobytes.
	WriteBytes              uint64 // written bytes.
	WriteKiloBytes          uint64 // written bytes in kilobytes.
}

PoolStatus represents the status of an induividual pool.

func (*PoolStatus) String

func (ps *PoolStatus) String() string

Pretty PoolStatus

type RadosError

type RadosError struct {
	Code    int
	Message string
}

RadosError contains the error code returned from call the librados functions. The message is some (maybe) helpful text regarding the error.

func (*RadosError) Error

func (err *RadosError) Error() string

Implement the error interface.

type ReadOperation

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

func (*ReadOperation) AssertExists

func (ro *ReadOperation) AssertExists() *ReadOperation

func (*ReadOperation) CompareAttribute

func (ro *ReadOperation) CompareAttribute(name string, operator CompareAttribute, value io.Reader) *ReadOperation

func (*ReadOperation) Operate

func (ro *ReadOperation) Operate(object *Object, flags ...LibradosOperation) (io.Reader, error)

func (*ReadOperation) Read

func (ro *ReadOperation) Read(offset, length uint64)

func (*ReadOperation) Release

func (ro *ReadOperation) Release()

func (*ReadOperation) SetFlags

func (ro *ReadOperation) SetFlags(flags ...LibradosOpFlag) *ReadOperation

type SnapshotId

type SnapshotId uint64

type WriteOperation

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

func (*WriteOperation) Append

func (wo *WriteOperation) Append(data io.Reader) *WriteOperation

func (*WriteOperation) AssertExists

func (wo *WriteOperation) AssertExists() *WriteOperation

func (*WriteOperation) CompareAttribute

func (wo *WriteOperation) CompareAttribute(attributeName string, operator CompareAttribute, value io.Reader) *WriteOperation

func (*WriteOperation) CreateObject

func (wo *WriteOperation) CreateObject(mode CreateMode, category string) *WriteOperation

func (*WriteOperation) Operate

func (wo *WriteOperation) Operate(object *Object, modifiedTime *time.Time, flags ...LibradosOperation) error

func (*WriteOperation) Release

func (wo *WriteOperation) Release()

func (*WriteOperation) Remove

func (wo *WriteOperation) Remove() *WriteOperation

func (*WriteOperation) RemoveAttribute

func (wo *WriteOperation) RemoveAttribute(name string) *WriteOperation

func (*WriteOperation) SetAttribute

func (wo *WriteOperation) SetAttribute(name string, value io.Reader) *WriteOperation

func (*WriteOperation) SetFlags

func (wo *WriteOperation) SetFlags(flags ...LibradosOpFlag) *WriteOperation

func (*WriteOperation) Truncate

func (wo *WriteOperation) Truncate(offset uint64) *WriteOperation

func (*WriteOperation) Write

func (wo *WriteOperation) Write(data io.Reader, offset uint64) *WriteOperation

func (*WriteOperation) WriteFull

func (wo *WriteOperation) WriteFull(data io.Reader) *WriteOperation

func (*WriteOperation) Zero

func (wo *WriteOperation) Zero(offset, length uint64) *WriteOperation

Jump to

Keyboard shortcuts

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