rados

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Set of wrappers around librados API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() (int, int, int)

Version returns the major, minor, and patch components of the version of the RADOS library linked against.

Types

type ClusterStat

type ClusterStat struct {
	Kb          uint64
	Kb_used     uint64
	Kb_avail    uint64
	Num_objects uint64
}

ClusterStat represents Ceph cluster statistics.

type Conn

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

Conn is a connection handle to a Ceph cluster.

func NewConn

func NewConn() (*Conn, error)

NewConn creates a new connection object. It returns the connection and an error, if any.

func NewConnWithUser

func NewConnWithUser(user string) (*Conn, error)

NewConnWithUser creates a new connection object with a custom username. It returns the connection and an error, if any.

func (*Conn) Connect

func (c *Conn) Connect() error

Connect establishes a connection to a RADOS cluster. It returns an error, if any.

func (*Conn) DeletePool

func (c *Conn) DeletePool(name string) error

DeletePool deletes a pool and all the data inside the pool.

func (*Conn) GetClusterStats

func (c *Conn) GetClusterStats() (stat ClusterStat, err error)

GetClusterStat returns statistics about the cluster associated with the connection.

func (*Conn) GetConfigOption

func (c *Conn) GetConfigOption(name string) (value string, err error)

GetConfigOption returns the value of the Ceph configuration option identified by the given name.

func (*Conn) GetFSID

func (c *Conn) GetFSID() (fsid string, err error)

GetFSID returns the fsid of the cluster as a hexadecimal string. The fsid is a unique identifier of an entire Ceph cluster.

func (*Conn) GetInstanceID

func (c *Conn) GetInstanceID() uint64

GetInstanceID returns a globally unique identifier for the cluster connection instance.

func (*Conn) ListPools

func (c *Conn) ListPools() (names []string, err error)

ListPools returns the names of all existing pools.

func (*Conn) MakePool

func (c *Conn) MakePool(name string) error

MakePool creates a new pool with default settings.

func (*Conn) MonCommand

func (c *Conn) MonCommand(args []byte) (buffer []byte, info string, err error)

MonCommand sends a command to one of the monitors

func (*Conn) OpenIOContext

func (c *Conn) OpenIOContext(pool string) (*IOContext, error)

func (*Conn) ParseCmdLineArgs

func (c *Conn) ParseCmdLineArgs(args []string) error

ParseCmdLineArgs configures the connection from command line arguments.

func (*Conn) ParseDefaultConfigEnv

func (c *Conn) ParseDefaultConfigEnv() error

ParseDefaultConfigEnv configures the connection from the default Ceph environment variable(s).

func (*Conn) PingMonitor

func (c *Conn) PingMonitor(id string) (string, error)

PingMonitor sends a ping to a monitor and returns the reply.

func (*Conn) ReadConfigFile

func (c *Conn) ReadConfigFile(path string) error

ReadConfigFile configures the connection using a Ceph configuration file.

func (*Conn) ReadDefaultConfigFile

func (c *Conn) ReadDefaultConfigFile() error

ReadDefaultConfigFile configures the connection using a Ceph configuration file located at default locations.

func (*Conn) SetConfigOption

func (c *Conn) SetConfigOption(option, value string) error

SetConfigOption sets the value of the configuration option identified by the given name.

func (*Conn) Shutdown

func (c *Conn) Shutdown()

Shutdown disconnects from the cluster.

func (*Conn) WaitForLatestOSDMap

func (c *Conn) WaitForLatestOSDMap() error

WaitForLatestOSDMap blocks the caller until the latest OSD map has been retrieved.

type IOContext

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

IOContext represents a context for performing I/O within a pool.

func (*IOContext) CleanOmap

func (ioctx *IOContext) CleanOmap(oid string) error

Clear the omap `oid`

func (*IOContext) Delete

func (ioctx *IOContext) Delete(oid string) error

Delete deletes the object with key oid. It returns an error, if any.

func (*IOContext) Destroy

func (ioctx *IOContext) Destroy()

Destroy informs librados that the I/O context is no longer in use. Resources associated with the context may not be freed immediately, and the context should not be used again after calling this method.

func (*IOContext) GetAllOmapValues

func (ioctx *IOContext) GetAllOmapValues(oid string, startAfter string, filterPrefix string, iteratorSize int64) (map[string][]byte, error)

Fetch all the keys and their values from an omap and returns then as a map `startAfter`: retrieve only the keys after this specified one `filterPrefix`: retrieve only the keys beginning with this prefix `iteratorSize`: internal number of keys to fetch during a read operation

func (*IOContext) GetOmapValues

func (ioctx *IOContext) GetOmapValues(oid string, startAfter string, filterPrefix string, maxReturn int64) (map[string][]byte, error)

Fetch a set of keys and their values from an omap and returns then as a map `startAfter`: retrieve only the keys after this specified one `filterPrefix`: retrieve only the keys beginning with this prefix `maxReturn`: retrieve no more than `maxReturn` key/value pairs

func (*IOContext) GetPoolName

func (ioctx *IOContext) GetPoolName() (name string, err error)

GetPoolName returns the name of the pool associated with the I/O context.

func (*IOContext) GetPoolStats

func (ioctx *IOContext) GetPoolStats() (stat PoolStat, err error)

Stat returns a set of statistics about the pool associated with this I/O context.

func (*IOContext) GetXattr

func (ioctx *IOContext) GetXattr(object string, name string, data []byte) (int, error)

GetXattr gets an xattr with key `name`, it returns the length of the key read or an error if not successful

func (*IOContext) ListObjects

func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error

ListObjects lists all of the objects in the pool associated with the I/O context, and called the provided listFn function for each object, passing to the function the name of the object.

func (*IOContext) ListOmapValues

func (ioctx *IOContext) ListOmapValues(oid string, startAfter string, filterPrefix string, maxReturn int64, listFn OmapListFunc) error

Iterate on a set of keys and their values from an omap `startAfter`: iterate only on the keys after this specified one `filterPrefix`: iterate only on the keys beginning with this prefix `maxReturn`: iterate no more than `maxReturn` key/value pairs `listFn`: the function called at each iteration

func (*IOContext) ListXattrs

func (ioctx *IOContext) ListXattrs(oid string) (map[string][]byte, error)

function that lists all the xattrs for an object, since xattrs are a k-v pair, this function returns a map of k-v pairs on success, error code on failure

func (*IOContext) Pointer

func (ioctx *IOContext) Pointer() uintptr

Pointer returns a uintptr representation of the IOContext.

func (*IOContext) Read

func (ioctx *IOContext) Read(oid string, data []byte, offset uint64) (int, error)

Read reads up to len(data) bytes from the object with key oid starting at byte offset offset. It returns the number of bytes read and an error, if any.

func (*IOContext) RmOmapKeys

func (ioctx *IOContext) RmOmapKeys(oid string, keys []string) error

Remove the specified `keys` from the omap `oid`

func (*IOContext) RmXattr

func (ioctx *IOContext) RmXattr(oid string, name string) error

Remove an xattr with key `name` from object `oid`

func (*IOContext) SetOmap

func (ioctx *IOContext) SetOmap(oid string, pairs map[string][]byte) error

Append the map `pairs` to the omap `oid`

func (*IOContext) SetXattr

func (ioctx *IOContext) SetXattr(object string, name string, data []byte) error

Sets an xattr for an object with key `name` with value as `data`

func (*IOContext) Stat

func (ioctx *IOContext) Stat(object string) (stat ObjectStat, err error)

Stat returns the size of the object and its last modification time

func (*IOContext) Truncate

func (ioctx *IOContext) Truncate(oid string, size uint64) error

Truncate resizes the object with key oid to size size. If the operation enlarges the object, the new area is logically filled with zeroes. If the operation shrinks the object, the excess data is removed. It returns an error, if any.

func (*IOContext) Write

func (ioctx *IOContext) Write(oid string, data []byte, offset uint64) error

Write writes len(data) bytes to the object with key oid starting at byte offset offset. It returns an error, if any.

type ObjectListFunc

type ObjectListFunc func(oid string)

ObjectListFunc is the type of the function called for each object visited by ListObjects.

type ObjectStat

type ObjectStat struct {
	// current length in bytes
	Size uint64
	// last modification time
	ModTime time.Time
}

ObjectStat represents an object stat information

type OmapListFunc

type OmapListFunc func(key string, value []byte)

OmapListFunc is the type of the function called for each omap key visited by ListOmapValues

type PoolStat

type PoolStat struct {
	// space used in bytes
	Num_bytes uint64
	// space used in KB
	Num_kb uint64
	// number of objects in the pool
	Num_objects uint64
	// number of clones of objects
	Num_object_clones uint64
	// num_objects * num_replicas
	Num_object_copies              uint64
	Num_objects_missing_on_primary uint64
	// number of objects found on no OSDs
	Num_objects_unfound uint64
	// number of objects replicated fewer times than they should be
	// (but found on at least one OSD)
	Num_objects_degraded uint64
	Num_rd               uint64
	Num_rd_kb            uint64
	Num_wr               uint64
	Num_wr_kb            uint64
}

PoolStat represents Ceph pool statistics.

type RadosError

type RadosError int

func (RadosError) Error

func (e RadosError) Error() string

Jump to

Keyboard shortcuts

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