Documentation ¶
Overview ¶
Package mio implements io.Reader/io.Writer interface over Motr client I/O API. This allows writing Motr client applications quickly and efficiently in the Go language.
mio automatically determines the optimal unit (stripe) size for the newly created object (based on the object size provided by user in the mio.Create(obj, sz) call), as well as the optimal block size for Motr I/O based on the cluster configuration. So users don't have to bother about tuning these Motr-specific parameters for each specific object to reach maximum I/O performance on it and yet don't waste space (in case of a small objects).
mio allows to read/write the blocks to Motr in parallel threads (see -threads option) provided the buffer size (len(p)) is big enough to accomodate several of such blocks in one Read(p)/Write(p) request.
For the usage example, refer to mcp utility.
Index ¶
- func Init(localEP *string, haxEP *string, profile *string, procFid *string, threads int, ...) (bool, error)
- func ScanID(s string) (fid C.struct_m0_uint128, err error)
- type Mio
- func (mio *Mio) Close() error
- func (mio *Mio) Create(id string, sz uint64, anyPool ...string) error
- func (mio *Mio) GetPool() string
- func (mio *Mio) InPool(pool string) bool
- func (mio *Mio) Open(id string, anySz ...uint64) error
- func (mio *Mio) Read(p []byte) (n int, err error)
- func (mio *Mio) ReadAt(p []byte, off int64) (n int, err error)
- func (mio *Mio) Seek(offset int64, whence int) (int64, error)
- func (mio *Mio) Write(p []byte) (n int, err error)
- func (mio *Mio) WriteAt(p []byte, off int64) (n int, err error)
- type Mkv
- func (mkv *Mkv) Close() error
- func (mkv *Mkv) Delete(key []byte) error
- func (mkv *Mkv) Get(key []byte) ([]byte, error)
- func (mkv *Mkv) GetSize(key []byte) (int, error)
- func (mkv *Mkv) Has(key []byte) (bool, error)
- func (mkv *Mkv) Open(id string, create bool) error
- func (mkv *Mkv) Put(key []byte, value []byte, update bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mio ¶
type Mio struct {
// contains filtered or unexported fields
}
Mio implements io.Reader / io.Writer interfaces for Motr.
func (*Mio) Close ¶
Close closes Mio object and releases all the resources that were allocated for it. Implements io.Closer interface.
func (*Mio) Create ¶
Create creates object. Estimated object size must be specified so that the optimal object unit size and block size for the best I/O performance on the object could be calculated. Optionally, the pool fid can be provided, if the object to be created on a non-default pool.
func (*Mio) Open ¶
Open opens Mio object for reading ant/or writing. The size must be specified when openning object for reading. Otherwise, nothing will be read. (Motr doesn't store objects metadata along with the objects.)
type Mkv ¶
type Mkv struct {
// contains filtered or unexported fields
}
Mkv provides key-value API to Motr