mio

package
v0.0.0-...-d848671 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(localEP *string, haxEP *string, profile *string, procFid *string, threads int, enableTrace bool) (bool, error)

initialises mio module.

func ScanID

func ScanID(s string) (fid C.struct_m0_uint128, err error)

ScanID scans object id from string.

Types

type Mio

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

Mio implements io.Reader / io.Writer interfaces for Motr.

func (*Mio) Close

func (mio *Mio) Close() error

Close closes Mio object and releases all the resources that were allocated for it. Implements io.Closer interface.

func (*Mio) Create

func (mio *Mio) Create(id string, sz uint64, anyPool ...string) error

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) GetPool

func (mio *Mio) GetPool() string

GetPool returns the pool the object is located at.

func (*Mio) InPool

func (mio *Mio) InPool(pool string) bool

InPool checks whether the object is located at the pool.

func (*Mio) Open

func (mio *Mio) Open(id string, anySz ...uint64) error

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.)

func (*Mio) Read

func (mio *Mio) Read(p []byte) (n int, err error)

func (*Mio) ReadAt

func (mio *Mio) ReadAt(p []byte, off int64) (n int, err error)

ReadAt implements io.ReaderAt interface

func (*Mio) Seek

func (mio *Mio) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker interface

func (*Mio) Write

func (mio *Mio) Write(p []byte) (n int, err error)

func (*Mio) WriteAt

func (mio *Mio) WriteAt(p []byte, off int64) (n int, err error)

WriteAt implements io.WriterAt interface

type Mkv

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

Mkv provides key-value API to Motr

func (*Mkv) Close

func (mkv *Mkv) Close() error

Close closes Mkv index releasing all the resources that were allocated for it.

func (*Mkv) Delete

func (mkv *Mkv) Delete(key []byte) error

Delete deletes the record by key.

func (*Mkv) Get

func (mkv *Mkv) Get(key []byte) ([]byte, error)

Get gets value from the index by key.

func (*Mkv) GetSize

func (mkv *Mkv) GetSize(key []byte) (int, error)

func (*Mkv) Has

func (mkv *Mkv) Has(key []byte) (bool, error)

func (*Mkv) Open

func (mkv *Mkv) Open(id string, create bool) error

Open opens Mkv index for key-value operations.

func (*Mkv) Put

func (mkv *Mkv) Put(key []byte, value []byte, update bool) error

Put puts key-value into the index.

Jump to

Keyboard shortcuts

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