daos

package
v0.0.0-...-26b8ccb Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RecAny signals that the record needs to be prefetched in order
	// to determine its size
	RecAny = C.DAOS_REC_ANY
	// EpochMax is the highest possible epoch -- usually used in read
	// operations to get the latest data regardless of what's committed
	// NB: Can't use C.DAOS_EPOCH_MAX because it's interpreted as -1
	EpochMax = Epoch(1<<64 - 1)
)
View Source
const (
	PoolConnectRO = C.DAOS_PC_RO
	PoolConnectRW = C.DAOS_PC_RW
	PoolConnectEX = C.DAOS_PC_EX
)

PoolConnect flags

View Source
const (
	// ContOpenRO indicates that the container should be opened Read-Only
	ContOpenRO = C.DAOS_COO_RO
	// ContOpenRW indicates that the container should be opened Read/Write
	ContOpenRW = C.DAOS_COO_RW
	// ContOpenNoSlip indicates that the container should not allow
	// slip operations to succeed
	ContOpenNoSlip = C.DAOS_COO_NOSLIP
)
View Source
const (

	// ClassUnknown is an unknown Object Class
	ClassUnknown = OClassID(C.DAOS_OC_UNKNOWN)
	// ClassTinyRW is tiny i/o
	ClassTinyRW = OClassID(C.DAOS_OC_TINY_RW)
	// ClassSmallRW is mall i/o
	ClassSmallRW = OClassID(C.DAOS_OC_SMALL_RW)
	// ClassLargeRW is large i/o
	ClassLargeRW = OClassID(C.DAOS_OC_LARGE_RW)
	// ClassRepl2RW is 2-way replicated i/o
	ClassRepl2RW = OClassID(C.DAOS_OC_REPL_2_RW)
	// ClassReplMaxRW is fully-replicated i/o
	ClassReplMaxRW = OClassID(C.DAOS_OC_REPL_MAX_RW)
)
View Source
const (
	// ObjOpenRO indicates that the object should be opened Read Only
	ObjOpenRO = ObjectOpenFlag(C.DAOS_OO_RO)
	// ObjOpenRW indicates that the object should be opened Read/Write
	ObjOpenRW = ObjectOpenFlag(C.DAOS_OO_RW)
	// ObjOpenExcl indicates that the object should be opened for exclusive i/o
	ObjOpenExcl = ObjectOpenFlag(C.DAOS_OO_EXCL)
	// ObjOpenIORand indicates that the object will be used for random i/o
	ObjOpenIORand = ObjectOpenFlag(C.DAOS_OO_IO_RAND)
	// ObjOpenIOSeq indicates that the object will be used for sequential i/o
	ObjOpenIOSeq = ObjectOpenFlag(C.DAOS_OO_IO_SEQ)
)
View Source
const (
	DER_NO_PERM         = Error(C.DER_NO_PERM)
	DER_NO_HDL          = Error(C.DER_NO_HDL)
	DER_INVAL           = Error(C.DER_INVAL)
	DER_EXIST           = Error(C.DER_EXIST)
	DER_NONEXIST        = Error(C.DER_NONEXIST)
	DER_UNREACH         = Error(C.DER_UNREACH)
	DER_NOSPACE         = Error(C.DER_NOSPACE)
	DER_ALREADY         = Error(C.DER_ALREADY)
	DER_NOMEM           = Error(C.DER_NOMEM)
	DER_NOSYS           = Error(C.DER_NOSYS)
	DER_TIMEDOUT        = Error(C.DER_TIMEDOUT)
	DER_BUSY            = Error(C.DER_BUSY)
	DER_AGAIN           = Error(C.DER_AGAIN)
	DER_PROTO           = Error(C.DER_PROTO)
	DER_UNINIT          = Error(C.DER_UNINIT)
	DER_TRUNC           = Error(C.DER_TRUNC)
	DER_OVERFLOW        = Error(C.DER_OVERFLOW)
	DER_CANCELED        = Error(C.DER_CANCELED)
	DER_OOG             = Error(C.DER_OOG)
	DER_CRT_HG          = Error(C.DER_CRT_HG)
	DER_CRT_UNREG       = Error(C.DER_CRT_UNREG)
	DER_CRT_ADDRSTR_GEN = Error(C.DER_CRT_ADDRSTR_GEN)
	DER_CRT_PMIX        = Error(C.DER_CRT_PMIX)
	DER_IVCB_FORWARD    = Error(C.DER_IVCB_FORWARD)
	DER_MISC            = Error(C.DER_MISC)
	DER_BADPATH         = Error(C.DER_BADPATH)
	DER_NOTDIR          = Error(C.DER_NOTDIR)
	DER_UNKNOWN         = Error(C.DER_UNKNOWN)
	DER_IO              = Error(C.DER_IO)
	DER_FREE_MEM        = Error(C.DER_FREE_MEM)
	DER_ENOENT          = Error(C.DER_ENOENT)
	DER_NOTYPE          = Error(C.DER_NOTYPE)
	DER_NOSCHEMA        = Error(C.DER_NOSCHEMA)
	DER_NOLOCAL         = Error(C.DER_NOLOCAL)
	DER_STALE           = Error(C.DER_STALE)
	DER_TGT_CREATE      = Error(C.DER_TGT_CREATE)
	DER_EP_RO           = Error(C.DER_EP_RO)
	DER_EP_OLD          = Error(C.DER_EP_OLD)
	DER_KEY2BIG         = Error(C.DER_KEY2BIG)
	DER_REC2BIG         = Error(C.DER_REC2BIG)
	DER_IO_INVAL        = Error(C.DER_IO_INVAL)
	DER_EQ_BUSY         = Error(C.DER_EQ_BUSY)
	DER_DOMAIN          = Error(C.DER_DOMAIN)
)

Variables

View Source
var (
	Errors map[Error]string = map[Error]string{
		DER_NO_PERM:         "No permission",
		DER_NO_HDL:          "Invalid handle",
		DER_INVAL:           "Invalid parameters",
		DER_EXIST:           "Entity already exists",
		DER_NONEXIST:        "Nonexistent entity",
		DER_UNREACH:         "Unreachable node",
		DER_NOSPACE:         "No space on storage target",
		DER_ALREADY:         "Already did sth",
		DER_NOMEM:           "NO memory",
		DER_NOSYS:           "Function not implemented",
		DER_TIMEDOUT:        "Timed out",
		DER_BUSY:            "Busy",
		DER_AGAIN:           "Try again",
		DER_PROTO:           "incompatible protocol",
		DER_UNINIT:          "Un-initialized",
		DER_TRUNC:           "Buffer too short, larger buffer needed",
		DER_OVERFLOW:        "Value too large for defined data type",
		DER_CANCELED:        "Operation cancelled",
		DER_OOG:             "Out-Of-Group or member list",
		DER_CRT_HG:          "Transport layer mercury error",
		DER_CRT_UNREG:       "CRT RPC",
		DER_CRT_ADDRSTR_GEN: "CRT failed to generate an address string",
		DER_CRT_PMIX:        "CRT PMIx layer error",
		DER_IVCB_FORWARD:    "CRT IV callback - cannot handle locally",
		DER_MISC:            "CRT miscellaneous error",
		DER_BADPATH:         "Bad path name",
		DER_NOTDIR:          "Not a directory",
		DER_UNKNOWN:         "Unknown error",
		DER_IO:              "Generic I/O error",
		DER_FREE_MEM:        "Memory free error",
		DER_ENOENT:          "Entry not found",
		DER_NOTYPE:          "Unknown object type",
		DER_NOSCHEMA:        "Unknown object schema",
		DER_NOLOCAL:         "Object is not local",
		DER_STALE:           "stale pool map version",
		DER_TGT_CREATE:      "Target create error",
		DER_EP_RO:           "Epoch is read-only",
		DER_EP_OLD:          "Epoch is too old, all data have been recycled",
		DER_KEY2BIG:         "Key is too large",
		DER_REC2BIG:         "Record is too large",
		DER_IO_INVAL:        "IO buffers can't match object extents",
		DER_EQ_BUSY:         "Event queue is busy",
		DER_DOMAIN:          "Domain of cluster component can't match",
	}
)

Functions

func Fini

func Fini()

Fini shutsdown DAOS connection

func HandleIsInvalid

func HandleIsInvalid(h Handle) bool

HandleIsInvalid returns a boolean indicating whether or not the handle is invalid.

func Init

func Init() error

Init initializes the DAOS connection

func PoolCreate

func PoolCreate(mode uint32, uid uint32, gid uint32, group string, size int64) (string, error)

PoolCreate creates a new pool of specfied size.

func PoolDestroy

func PoolDestroy(pool string, group string, force int) error

PoolDestroy deletes the passed pool uuid.

Types

type Anchor

type Anchor C.daos_hash_out_t

Anchor is used for pagination

func (Anchor) EOF

func (a Anchor) EOF() bool

EOF indicates whether or not the final record has been retrieved

func (*Anchor) Pointer

func (a *Anchor) Pointer() *C.daos_hash_out_t

Pointer returns a *C.daos_hash_out_t

type Array

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

Array provides an idiomatic interface to DAOS Arrays

func NewArray

func NewArray(oh *ObjectHandle) *Array

NewArray wraps an *ObjectHandle with DAOS Array methods

func (*Array) Close

func (a *Array) Close() error

Close closes the Array's object handle

func (*Array) GetSize

func (a *Array) GetSize(e Epoch) (int64, error)

GetSize returns the size of the Array

func (*Array) Read

func (a *Array) Read(e Epoch, req *ArrayRequest) (int64, error)

func (*Array) SetSize

func (a *Array) SetSize(e Epoch, size int64) error

SetSize preallocates an Array up to the given size

func (*Array) Write

func (a *Array) Write(e Epoch, req *ArrayRequest) (int64, error)

type ArrayRanges

type ArrayRanges []*BufferedRange

ArrayRanges describes a list of RangeBuffers within a DAOS array

type ArrayRecordRequest

type ArrayRecordRequest struct {
	// Key is the attribute key of the record
	Key []byte
	// Extents is a slice of extents, where each extent
	// defines the index of the first record in the extent
	// and the number of records to access
	Extents []Extent
	// Epochs is an optional slice of epochs which if supplied
	// will override the epoch given to daos_obj_(fetch|update)
	Epochs []Epoch
	// Buffers is a slice of Go-allocated memory for reading or
	// writing the records
	Buffers RequestBuffers
}

ArrayRecordRequest represents an IOD for a multi-record fetch/update on an akey

type ArrayRequest

type ArrayRequest struct {
	Ranges ArrayRanges
}

ArrayRequest describes a data structure used for writing to or reading from a DAOS Array

func NewArrayRequest

func NewArrayRequest(rl ...*BufferedRange) *ArrayRequest

NewArrayRequest accepts an optional list of *BufferedRange items to add to a new *ArrayRequest

func (*ArrayRequest) AddRange

func (ar *ArrayRequest) AddRange(br *BufferedRange)

AddRange adds a BufferedRange to the ArrayRequest and allocates a buffer for it if one was not provided

func (*ArrayRequest) Buffers

func (ar *ArrayRequest) Buffers() []RequestBuffers

Buffers implements the RequestBufferSlicer interface. In this case, we'll only ever need a single SGL buffer per request.

func (*ArrayRequest) Length

func (ar *ArrayRequest) Length() int

Length implements the RequestBufferSlicer interface. In this case, we only ever want to create a single SGL per request.

func (*ArrayRequest) Native

func (ar *ArrayRequest) Native() (*C.daos_array_ranges_t, func(), error)

Native constructs a C.daos_array_ranges_t from the request's Range list and returns a pointer to it along with a callback to free the C memory that was allocated for it.

func (*ArrayRequest) Size

func (ar *ArrayRequest) Size() (total int64)

Size returns the total size of all ranges in the request.

type BufferedRange

type BufferedRange struct {
	Buffer []byte
	Length int64
	Offset int64
}

BufferedRange describes a byte range within a DAOS Array

type ContHandle

type ContHandle C.daos_handle_t

ContHandle refers to an open container.

func (*ContHandle) ArrayOpen

func (coh *ContHandle) ArrayOpen(oid *ObjectID, e Epoch, mode ObjectOpenFlag) (*Array, error)

ArrayOpen opens an Array Object

func (*ContHandle) AttributeGet

func (coh *ContHandle) AttributeGet(names []string) ([]byte, error)

AttributeGet returns values for given set of attributes.

func (*ContHandle) AttributeSet

func (coh *ContHandle) AttributeSet(names []string, values []byte) error

AttributeSet set named attributes to the provided values.

func (*ContHandle) Attributes

func (coh *ContHandle) Attributes() ([]string, error)

Attributes returns slide of attribute names

func (*ContHandle) Close

func (coh *ContHandle) Close() error

Close the container handle

func (*ContHandle) Destroy

func (coh *ContHandle) Destroy(uuid string, force bool) error

Destroy the container identified by the UUID

func (*ContHandle) EpochCommit

func (coh *ContHandle) EpochCommit(e Epoch) (*EpochState, error)

EpochCommit commits an epoch for the container handle.

func (*ContHandle) EpochDiscard

func (coh *ContHandle) EpochDiscard(e Epoch) (*EpochState, error)

EpochDiscard discards the epoch and returns current epoch state.

func (*ContHandle) EpochFlush

func (coh *ContHandle) EpochFlush(e Epoch) (*EpochState, error)

EpochFlush completes the epoch and returns the epoch state.

func (*ContHandle) EpochHold

func (coh *ContHandle) EpochHold(e Epoch) (Epoch, error)

EpochHold propose a new lowest held epoch on this container handle.

func (*ContHandle) EpochQuery

func (coh *ContHandle) EpochQuery() (*EpochState, error)

EpochQuery returns current epoch state.

func (*ContHandle) EpochSlip

func (coh *ContHandle) EpochSlip(e Epoch) (*EpochState, error)

EpochSlip increases the lowest referenced epoch of the container handle.

func (*ContHandle) EpochWait

func (coh *ContHandle) EpochWait(e Epoch) (*EpochState, error)

EpochWait waits an epoch to be committed.

func (*ContHandle) H

func (coh *ContHandle) H() C.daos_handle_t

H returns C-typed handle

func (*ContHandle) Info

func (coh *ContHandle) Info() (*ContInfo, error)

Info returns current container info

func (*ContHandle) ObjectDeclare

func (coh *ContHandle) ObjectDeclare(oid *ObjectID, e Epoch, oa *ObjectAttribute) error

ObjectDeclare declares the object with the specified attributes

func (*ContHandle) ObjectOpen

func (coh *ContHandle) ObjectOpen(oid *ObjectID, e Epoch, mode ObjectOpenFlag) (*ObjectHandle, error)

ObjectOpen opens the specified object with the supplied flags

func (*ContHandle) Pointer

func (coh *ContHandle) Pointer() *C.daos_handle_t

Pointer returns pointer C-typed container handle

func (*ContHandle) Zero

func (coh *ContHandle) Zero()

Zero resets the handle to the invalid state

type ContInfo

type ContInfo C.daos_cont_info_t

ContInfo is current status of a container.

func (*ContInfo) EpochState

func (info *ContInfo) EpochState() *EpochState

EpochState returns a pointer to the container's current EpochState

func (*ContInfo) Snapshots

func (info *ContInfo) Snapshots() []Epoch

Snapshots returns a slice of Epochs representing stable snapshots

func (*ContInfo) UUID

func (info *ContInfo) UUID() string

UUID returns the container's UUID as a string

type Epoch

type Epoch C.daos_epoch_t

Epoch identifiers (uint64)

func (Epoch) Native

func (e Epoch) Native() C.daos_epoch_t

Native returns native C-type epoch

func (*Epoch) Pointer

func (e *Epoch) Pointer() *C.daos_epoch_t

Pointer returns a pointer to the native C-type epoch

func (Epoch) String

func (e Epoch) String() string

type EpochState

type EpochState C.daos_epoch_state_t

EpochState is current epoch status.

func (*EpochState) GHCE

func (s *EpochState) GHCE() Epoch

GHCE Global Highest Committted Epoch

func (*EpochState) GHPCE

func (s *EpochState) GHPCE() Epoch

GHPCE Global Highest Partially Committted Epoch

func (*EpochState) GLRE

func (s *EpochState) GLRE() Epoch

GLRE Global Lowest Referenced Epoch

func (*EpochState) HCE

func (s *EpochState) HCE() Epoch

HCE returns Highest Committed Epoch

func (*EpochState) LHE

func (s *EpochState) LHE() Epoch

LHE returns Lowest Held Epoch

func (*EpochState) LRE

func (s *EpochState) LRE() Epoch

LRE returns Lowest Referenced Epoch

func (*EpochState) Pointer

func (s *EpochState) Pointer() *C.daos_epoch_state_t

Pointer turns C-typed EpochState pointer

func (*EpochState) String

func (s *EpochState) String() string

type Error

type Error int

func (Error) String

func (e Error) String() string

type Extent

type Extent struct {
	// Index of the first record within the extent
	Index uint64
	// Count is the number of contiguous records in the extent
	Count uint64
}

Extent is a range of contiguous records of the same size inside an array

type Handle

type Handle interface {
	Pointer() *C.daos_handle_t
	H() C.daos_handle_t
	Zero()
}

Handle is an interface for DAOS handle types

type Hash

type Hash C.daos_hash_out_t

Hash wraps a C.daos_hash_out_t

type IoRequest

type IoRequest struct {
	DistKey []byte
	Records []RecordRequest
	// contains filtered or unexported fields
}

IoRequest encapsulates a set of record requests which are co-located on the same distribution key

func NewIoRequest

func NewIoRequest(key []byte, records ...RecordRequest) *IoRequest

NewIoRequest creates a new *IoRequest

func (*IoRequest) AddRecordRequest

func (ir *IoRequest) AddRecordRequest(rr RecordRequest)

AddRecordRequest adds a RecordRequest to the list

func (*IoRequest) Complete

func (ir *IoRequest) Complete() error

Complete performs any necessary data copying between C/Go memory and other housekeeping after a Fetch or Inspect

func (*IoRequest) DKey

func (ir *IoRequest) DKey() *C.daos_key_t

DKey returns a *C.daos_key_t representing the distribution key for the request

func (*IoRequest) Free

func (ir *IoRequest) Free()

Free releases all C memory used by the request

func (*IoRequest) IODs

func (ir *IoRequest) IODs() *C.daos_iod_t

IODs returns a pointer to a slice of IODs

func (*IoRequest) Length

func (ir *IoRequest) Length() int

Length returns the number of record requests

func (*IoRequest) NeedsPrefetch

func (ir *IoRequest) NeedsPrefetch() bool

NeedsPrefetch indicates whether or not we need to determine the size of any of the records being fetched before fetching them

func (*IoRequest) SGLs

func (ir *IoRequest) SGLs() *C.daos_sg_list_t

SGLs returns a pointer to a slice of SGLs

func (*IoRequest) StringKey

func (ir *IoRequest) StringKey() string

StringKey returns the request's distribution key as a string

type IoVector

type IoVector C.daos_iov_t

IoVector wraps a C.daos_iov_t

func NewIoVector

func NewIoVector(buf []byte) *IoVector

NewIoVector returns a new *IoVector for the given []byte

func (*IoVector) Free

func (iov *IoVector) Free()

Free releases the allocated C memory for the IoVector

func (*IoVector) String

func (iov *IoVector) String() string

type KeyDescriptor

type KeyDescriptor C.daos_key_desc_t

KeyDescriptor wraps a C.daos_key_desc_t

type KeyDescriptorSlice

type KeyDescriptorSlice []KeyDescriptor

KeyDescriptorSlice is a slice of KeyDescriptor

func (KeyDescriptorSlice) Pointer

func (kdl KeyDescriptorSlice) Pointer() *C.daos_key_desc_t

Pointer returns a *C.daos_key_desc_t

type OClassID

type OClassID C.daos_oclass_id_t

OClassID wraps a C.daos_oclass_id_t

func ObjectClassList

func ObjectClassList() []OClassID

ObjectClassList returns a slice of known ObjectClasses

func (OClassID) Native

func (c OClassID) Native() C.daos_oclass_id_t

Native returns a C.daos_oclass_id_t

func (*OClassID) Set

func (c *OClassID) Set(value string) error

Set attempts to parse the supplied string as an OClassID

func (OClassID) String

func (c OClassID) String() string

type ObjectAttribute

type ObjectAttribute C.daos_obj_attr_t

ObjectAttribute is an object attribute

func (*ObjectAttribute) Pointer

func (oa *ObjectAttribute) Pointer() *C.daos_obj_attr_t

Pointer returns a *C.daos_obj_attr_t

type ObjectHandle

type ObjectHandle C.daos_handle_t

ObjectHandle refers to an open object

func (ObjectHandle) AttrKeys

func (oh ObjectHandle) AttrKeys(e Epoch, dkey []byte, anchor *Anchor) ([][]byte, error)

AttrKeys returns a slice of akeys as []bytes

func (*ObjectHandle) Close

func (oh *ObjectHandle) Close() error

Close closes the object

func (ObjectHandle) DistKeys

func (oh ObjectHandle) DistKeys(e Epoch, anchor *Anchor) ([][]byte, error)

DistKeys returns a slice of dkeys as []bytes

func (*ObjectHandle) Fetch

func (oh *ObjectHandle) Fetch(e Epoch, ir *IoRequest) error

Fetch reads the specified extents and returns them in newly allocated KeyRequest Buffers. If any extents have a RecSize set to RecAny, then a second fetch will done iff all the extents have a valid record size after first fetch.

func (*ObjectHandle) Get

func (oh *ObjectHandle) Get(e Epoch, dkey string, akey string) ([]byte, error)

Get returns first record for a-key.

func (*ObjectHandle) GetKeys

func (oh *ObjectHandle) GetKeys(e Epoch, dkey string, akeys []string) (map[string][]byte, error)

GetKeys returns first record for each a-key available in the specified epoch.

func (*ObjectHandle) Getb

func (oh *ObjectHandle) Getb(e Epoch, dkey []byte, akey []byte) ([]byte, error)

Getb returns first record for a-key.

func (*ObjectHandle) H

func (oh *ObjectHandle) H() C.daos_handle_t

H returns a C.daos_daos_handle_t

func (*ObjectHandle) Inspect

func (oh *ObjectHandle) Inspect(e Epoch, ir *IoRequest) error

Inspect attempts to fetch the record size for each akey provided in the KeyRequest Buffers. No data will be fetched, but the updated

func (*ObjectHandle) Pointer

func (oh *ObjectHandle) Pointer() *C.daos_handle_t

Pointer returns a *C.daos_daos_handle_t

func (*ObjectHandle) Punch

func (oh *ObjectHandle) Punch(e Epoch) error

Punch performs a punch operation on the object

func (*ObjectHandle) Put

func (oh *ObjectHandle) Put(e Epoch, dkey string, akey string, value []byte) error

Put sets the first record of a-key to value, with record size is len(value).

func (*ObjectHandle) PutKeys

func (oh *ObjectHandle) PutKeys(e Epoch, dkey string, akeys map[string][]byte) error

PutKeys stores a map of akey->val on the specified dkey

func (*ObjectHandle) Putb

func (oh *ObjectHandle) Putb(e Epoch, dkey []byte, akey []byte, value []byte) error

Putb sets the first record of a-key to value, with record size is len(value).

func (*ObjectHandle) Query

func (oh *ObjectHandle) Query(e Epoch) (*ObjectAttribute, error)

Query queries the object's attributes

func (*ObjectHandle) Update

func (oh *ObjectHandle) Update(e Epoch, ir *IoRequest) error

Update submits the extents and buffers to the object.

func (*ObjectHandle) Zero

func (oh *ObjectHandle) Zero()

Zero resets the handle to the invalid state

type ObjectID

type ObjectID C.daos_obj_id_t

ObjectID wraps a C.daos_obj_id_t

func GenerateOID

func GenerateOID(oc OClassID) *ObjectID

GenerateOID returns a random OID The ID is derived from a Random UUID, so should reasonably unique.

func ObjectIDInit

func ObjectIDInit(hi uint32, mid, lo uint64, class OClassID) *ObjectID

ObjectIDInit initializes an ObjectID

func ParseOID

func ParseOID(s string) (*ObjectID, error)

ParseOID attempts to parse the supplied string as an ObjectID

func (*ObjectID) Class

func (o *ObjectID) Class() OClassID

Class returns the OClassID for the ObjectID

func (*ObjectID) Hi

func (o *ObjectID) Hi() uint32

Hi returns the top part of the ObjectID

func (*ObjectID) Lo

func (o *ObjectID) Lo() uint64

Lo returns the lower part of the ObjectID

func (*ObjectID) MarshalBinary

func (o *ObjectID) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*ObjectID) MarshalJSON

func (o *ObjectID) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ObjectID to a JSON-formatted []byte

func (*ObjectID) Mid

func (o *ObjectID) Mid() uint64

Mid returns the middle part of the ObjectID

func (*ObjectID) Native

func (o *ObjectID) Native() C.daos_obj_id_t

Native returns a C.daos_obj_id_t

func (*ObjectID) Pointer

func (o *ObjectID) Pointer() *C.daos_obj_id_t

Pointer returns a pointer to a C.daos_obj_id_t

func (*ObjectID) Set

func (o *ObjectID) Set(value string) error

Set attempts to parse the supplied string as an ObjectID and replaces the pointer if successful

func (ObjectID) String

func (o ObjectID) String() string

func (*ObjectID) UnmarshalBinary

func (o *ObjectID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

func (*ObjectID) UnmarshalJSON

func (o *ObjectID) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ObjectID from a JSON-formatted []byte

type ObjectOpenFlag

type ObjectOpenFlag uint

ObjectOpenFlag specifies the object open flags

type PoolHandle

type PoolHandle C.daos_handle_t

PoolHandle is an open conection to a Pool

func PoolConnect

func PoolConnect(pool string, group string, flags uint) (*PoolHandle, error)

PoolConnect returns the pool handle for given pool.

func (*PoolHandle) Disconnect

func (poh *PoolHandle) Disconnect() error

Disconnect closes the pool handle.

func (*PoolHandle) Exclude

func (poh *PoolHandle) Exclude(targets []Rank) error

Exclude ranks from pool.

https://github.com/golang/go/wiki/cgo Convert C array into Go slice

slice := (*[1 << 30]C.YourType)(unsafe.Pointer(theCArray))[:length:length]

func (*PoolHandle) H

func (poh *PoolHandle) H() C.daos_handle_t

H returns C-typed handle

func (*PoolHandle) Info

func (poh *PoolHandle) Info() (*PoolInfo, error)

Info returns current pool info

func (*PoolHandle) NewContainer

func (poh *PoolHandle) NewContainer(uuid string) error

NewContainer creates a container identified by the UUID

func (*PoolHandle) Open

func (poh *PoolHandle) Open(uuid string, flags int) (*ContHandle, error)

Open a the container identified by the UUID

func (*PoolHandle) Pointer

func (poh *PoolHandle) Pointer() *C.daos_handle_t

Pointer returns C-typed handle pointer

func (*PoolHandle) Zero

func (poh *PoolHandle) Zero()

Zero resets the handle to the invalid state

type PoolInfo

type PoolInfo C.daos_pool_info_t

PoolInfo is current state of a pool

func (*PoolInfo) Mode

func (info *PoolInfo) Mode() uint32

Mode returns the Pool's operating mode

func (*PoolInfo) NumDisabled

func (info *PoolInfo) NumDisabled() int

NumDisabled returns the number of disabled targets in the Pool

func (*PoolInfo) NumTargets

func (info *PoolInfo) NumTargets() int

NumTargets returns the number of targets in the Pool

func (*PoolInfo) Space

func (info *PoolInfo) Space() uint64

Space returns the amount of space allocated for the Pool

func (*PoolInfo) UUID

func (info *PoolInfo) UUID() string

UUID returns the Pool's UUID as a string

type Rank

type Rank C.daos_rank_t

Rank is a target index

type RecordRequest

type RecordRequest interface {
	Name() *C.daos_key_t
	StringKey() string
	Buffers() RequestBuffers
	Size() uint64
	SetSize(uint64)
	Free()
	Complete() error
	PrepareIOD(*C.daos_iod_t)
	PrepareSGL(*C.daos_sg_list_t)
}

RecordRequest defines an interface which is implemented by either ArrayRecordRequest or SingleRecordRequest

type RequestBuffers

type RequestBuffers [][]byte

RequestBuffers is a slice of byte slices

type SGList

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

SGList wraps a C.daos_sg_list_t

func NewSGList

func NewSGList(bufs RequestBuffers) *SGList

NewSGList creates a DAOS Scatter-Gather list set up to do I/O based on the supplied slice of buffers

func (*SGList) Complete

func (sgl *SGList) Complete() error

Complete does any required housekeeping after a fetch

func (*SGList) Free

func (sgl *SGList) Free()

Free releases all C-allocated memory used by the SGL

func (*SGList) Pointer

func (sgl *SGList) Pointer() *C.daos_sg_list_t

Pointer returns *C.daos_sg_list_t

type SingleRecordRequest

type SingleRecordRequest struct {
	// Key is the attribute key of the record
	Key []byte
	// Buffer is Go-allocated memory for reading or writing
	// the record
	Buffer []byte
	// contains filtered or unexported fields
}

SingleRecordRequest represents an IOD for a single record fetch/update on an akey

func NewSingleRecordRequest

func NewSingleRecordRequest(name []byte, buffers ...[]byte) *SingleRecordRequest

NewSingleRecordRequest creates a new *SingleRecordRequest

func (*SingleRecordRequest) Buffers

func (srr *SingleRecordRequest) Buffers() RequestBuffers

Buffers returns the request's single buffer wrapped in a slice in order to implement the RecordRequest interface

func (*SingleRecordRequest) Complete

func (srr *SingleRecordRequest) Complete() error

Complete performs any necessary housekeeping after an Inspect/Fetch

func (*SingleRecordRequest) Free

func (srr *SingleRecordRequest) Free()

Free releases all allocated C memory used by the request

func (*SingleRecordRequest) Name

func (srr *SingleRecordRequest) Name() *C.daos_key_t

Name returns the request's attribute name as a *C.daos_key_t

func (*SingleRecordRequest) PrepareIOD

func (srr *SingleRecordRequest) PrepareIOD(iod *C.daos_iod_t)

PrepareIOD sets up the supplied *C.daos_iod_t to reflect this request's layout

func (*SingleRecordRequest) PrepareSGL

func (srr *SingleRecordRequest) PrepareSGL(sgl *C.daos_sg_list_t)

PrepareSGL sets up the supplied *C.daos_sg_list_t to do I/O

func (*SingleRecordRequest) SetSize

func (srr *SingleRecordRequest) SetSize(newSize uint64)

SetSize adjusts the request's buffer to match the supplied size

func (*SingleRecordRequest) Size

func (srr *SingleRecordRequest) Size() uint64

Size returns the length of the request's buffer

func (*SingleRecordRequest) StringKey

func (srr *SingleRecordRequest) StringKey() string

StringKey returns the request's attribute name as a string

Jump to

Keyboard shortcuts

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