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
- func Version() string
- type ASyncIoErrorCallback
- type AsyncIoCallback
- type AsyncObject
- type AttributeList
- type Cluster
- func (cluster *Cluster) Config() *ClusterConfig
- func (cluster *Cluster) CreatePool(poolName string) error
- func (cluster *Cluster) CreatePoolWithAll(poolName string, auid uint64, crushRule uint8) error
- func (cluster *Cluster) CreatePoolWithCrushRule(poolName string, crushRule uint8) error
- func (cluster *Cluster) CreatePoolWithOwner(poolName string, auid uint64) error
- func (cluster *Cluster) DeletePool(poolName string) error
- func (cluster *Cluster) FSID() string
- func (cluster *Cluster) GetConfigValue(configName string) (string, error)
- func (cluster *Cluster) InstanceId() uint64
- func (cluster *Cluster) ListPools() ([]string, error)
- func (cluster *Cluster) LookupPool(poolName string) (int64, error)
- func (cluster *Cluster) ManagePool(poolName string) (*Pool, error)
- func (cluster *Cluster) PingMonitor(monitorId string) (string, error)
- func (cluster *Cluster) ReverseLookupPool(id int64) (string, error)
- func (cluster *Cluster) Shutdown()
- func (cluster *Cluster) Status() (*ClusterStatus, error)
- func (cluster *Cluster) WaitForLatestOsdMap() error
- type ClusterConfig
- type ClusterStatus
- type CompareAttribute
- type Connection
- func (conn *Connection) As(user string) *Connection
- func (conn *Connection) Connect() (*Cluster, error)
- func (conn *Connection) To(cluster string) *Connection
- func (conn *Connection) UseConfigArgs() *Connection
- func (conn *Connection) UseConfigEnv(env string) *Connection
- func (conn *Connection) UseConfigFile(configFile string) *Connection
- func (conn *Connection) UseConfigMap(configMap map[string]string) *Connection
- type CreateMode
- type LibradosLock
- type LibradosOpFlag
- type LibradosOperation
- type Locker
- type ManagedSnapshot
- type ManagedSnapshots
- type Object
- func (o *Object) Append(data io.Reader) error
- func (o *Object) AsyncMode(onComplete, onSafe AsyncIoCallback, onError ASyncIoErrorCallback, ...) *AsyncObject
- func (o *Object) Attribute(attributeName string) (io.Reader, error)
- func (o *Object) BreakLock(name, client, cookie string) error
- func (o *Object) Clone(target *Object, srcOffset, dstOffset, length uint64) error
- func (o *Object) ListLockers(name string) ([]*Locker, string, error)
- func (o *Object) LockExclusive(name, cookie, description string, flags ...LibradosLock) error
- func (o *Object) LockShared(name, cookie, tag, description string, flags ...LibradosLock) error
- func (o *Object) Name() string
- func (o *Object) OpenAttributeList() (*AttributeList, error)
- func (o *Object) Read(length, offset uint64) (io.Reader, error)
- func (o *Object) Remove() error
- func (o *Object) RemoveAttribute(attributeName string) error
- func (o *Object) SetAllocationHint(expectedObjectSize, expectedWriteSize uint64)
- func (o *Object) SetAttribute(attributeName string, attributeValue io.Reader) error
- func (o *Object) Status() (*ObjectStatus, error)
- func (o *Object) Truncate(size uint64) error
- func (o *Object) Unlock(name, cookie string) error
- func (o *Object) Write(data io.Reader, offset uint64) error
- func (o *Object) WriteFull(data io.Reader) error
- type ObjectList
- type ObjectStatus
- type Pool
- func (pool *Pool) AUID() (uint64, error)
- func (pool *Pool) Close()
- func (pool *Pool) Cluster() *Cluster
- func (pool *Pool) Config() *ClusterConfig
- func (pool *Pool) CreatePoolSnapshot(snapshotName string) error
- func (pool *Pool) CreateReadOperation() (*ReadOperation, error)
- func (pool *Pool) CreateSelfManagedSnapshot() (*ManagedSnapshot, error)
- func (pool *Pool) CreateWriteOperation() (*WriteOperation, error)
- func (pool *Pool) Id() int64
- func (pool *Pool) LastObjectVersion() uint64
- func (pool *Pool) ListPoolSnapshots() []SnapshotId
- func (pool *Pool) LookupPoolSnapshot(snapshotName string) (SnapshotId, error)
- func (pool *Pool) ManageObject(name string) *Object
- func (pool *Pool) Name() string
- func (pool *Pool) OpenObjectList() (*ObjectList, error)
- func (pool *Pool) RemovePoolSnapshot(snapshotName string) error
- func (pool *Pool) RequiredAlignment() uint64
- func (pool *Pool) RequiresAlignment() bool
- func (pool *Pool) ReverseLookupSnapshot(snapId SnapshotId) (string, error)
- func (pool *Pool) RollbackToPoolSnapshot(objectName, snapshotName string) error
- func (pool *Pool) SafeClose()
- func (pool *Pool) SetAUID(auid uint64) error
- func (pool *Pool) SetLocatorKey(key string)
- func (pool *Pool) SetNamespace(namespace string)
- func (pool *Pool) SnapshotTimestamp(snapId SnapshotId) (time.Time, error)
- func (pool *Pool) Status() (*PoolStatus, error)
- func (pool *Pool) UseSnapshot(snapId SnapshotId)
- type PoolStatus
- type RadosError
- type ReadOperation
- func (ro *ReadOperation) AssertExists() *ReadOperation
- func (ro *ReadOperation) CompareAttribute(name string, operator CompareAttribute, value io.Reader) *ReadOperation
- func (ro *ReadOperation) Operate(object *Object, flags ...LibradosOperation) (io.Reader, error)
- func (ro *ReadOperation) Read(offset, length uint64)
- func (ro *ReadOperation) Release()
- func (ro *ReadOperation) SetFlags(flags ...LibradosOpFlag) *ReadOperation
- type SnapshotId
- type WriteOperation
- func (wo *WriteOperation) Append(data io.Reader) *WriteOperation
- func (wo *WriteOperation) AssertExists() *WriteOperation
- func (wo *WriteOperation) CompareAttribute(attributeName string, operator CompareAttribute, value io.Reader) *WriteOperation
- func (wo *WriteOperation) CreateObject(mode CreateMode, category string) *WriteOperation
- func (wo *WriteOperation) Operate(object *Object, modifiedTime *time.Time, flags ...LibradosOperation) error
- func (wo *WriteOperation) Release()
- func (wo *WriteOperation) Remove() *WriteOperation
- func (wo *WriteOperation) RemoveAttribute(name string) *WriteOperation
- func (wo *WriteOperation) SetAttribute(name string, value io.Reader) *WriteOperation
- func (wo *WriteOperation) SetFlags(flags ...LibradosOpFlag) *WriteOperation
- func (wo *WriteOperation) Truncate(offset uint64) *WriteOperation
- func (wo *WriteOperation) Write(data io.Reader, offset uint64) *WriteOperation
- func (wo *WriteOperation) WriteFull(data io.Reader) *WriteOperation
- func (wo *WriteOperation) Zero(offset, length uint64) *WriteOperation
Constants ¶
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 ¶
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.
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 ¶
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 ¶
CreatePool creates a new pool using the given poolName. This uses the default pool configuration.
func (*Cluster) CreatePoolWithAll ¶
CreatePoolWithAll creates a new pool using the given poolName with both auid and crushRule set.
func (*Cluster) CreatePoolWithCrushRule ¶
CreatePoolWithCrushRule creates a new pool using the given poolName with a crushRule set.
func (*Cluster) CreatePoolWithOwner ¶
CreatePoolWithOwner creates a new pool using the given poolName and sets it auid.
func (*Cluster) DeletePool ¶
DeletePool removes a pool from the cluster.
func (*Cluster) GetConfigValue ¶
GetConfig returns the configuration value of the given configName.
func (*Cluster) InstanceId ¶
InstanceId returns the instance ID of the current connection.
func (*Cluster) LookupPool ¶
LookupPool returns the pool ID of the given pool name.
func (*Cluster) ManagePool ¶
ManagePool opens a pool for query, read, and write operations.
func (*Cluster) PingMonitor ¶
PingMonitor will query the given monitor to check it's status TODO: Make struct for result
func (*Cluster) ReverseLookupPool ¶
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 ¶
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 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) 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) BreakLock ¶
BreakLock forcefully breaks the object lock. This fails if specified client does not hold the lock.
func (*Object) Clone ¶
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 ¶
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) OpenAttributeList ¶
func (o *Object) OpenAttributeList() (*AttributeList, error)
OpenAttributeList returns an iterator of the object's attributes.
func (*Object) Read ¶
Read reads a specified length of data from the object starting at the given offset.
func (*Object) RemoveAttribute ¶
RemoveAttribute removes an attribute of the object.
func (*Object) SetAllocationHint ¶
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 ¶
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 ¶
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 ¶
Unlock unlocks a locked object. This returns an error if the lock is not owned by the current client.
type ObjectList ¶
type ObjectList struct {
// contains filtered or unexported fields
}
ObjectList represents a handler for iterating through objects of a pool.
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) Config ¶
func (pool *Pool) Config() *ClusterConfig
Config returns a reference of the ClusterConfig.
func (*Pool) CreatePoolSnapshot ¶
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) LastObjectVersion ¶
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 ¶
ManageObject manages an object. This can read/write/update/delete objects.
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 ¶
RemoveSnapshot removes a pool wide snapshot.
func (*Pool) RequiresAlignment ¶
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 ¶
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) SetLocatorKey ¶
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 ¶
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.
type RadosError ¶
RadosError contains the error code returned from call the librados functions. The message is some (maybe) helpful text regarding the error.
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