elliptics

package
v0.0.0-...-d8b30bb Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2017 License: LGPL-3.0 Imports: 17 Imported by: 3

Documentation

Overview

Package provides interface to work with Elliptics. Elliptics is distributed fault-tolerant key-value storage system, it also supports secondary indexes.

More information about Elliptics here: http://reverbrain.com/.

Index

Constants

View Source
const (
	DNET_IO_FLAGS_SKIP_SENDING           = IOflag(C.DNET_IO_FLAGS_SKIP_SENDING)
	DNET_IO_FLAGS_MIX_STATES             = IOflag(C.DNET_IO_FLAGS_MIX_STATES)
	DNET_IO_FLAGS_APPEND                 = IOflag(C.DNET_IO_FLAGS_APPEND)
	DNET_IO_FLAGS_PREPARE                = IOflag(C.DNET_IO_FLAGS_PREPARE)
	DNET_IO_FLAGS_COMMIT                 = IOflag(C.DNET_IO_FLAGS_COMMIT)
	DNET_IO_FLAGS_REMOVED                = IOflag(C.DNET_IO_FLAGS_REMOVED)
	DNET_IO_FLAGS_OVERWRITE              = IOflag(C.DNET_IO_FLAGS_OVERWRITE)
	DNET_IO_FLAGS_NOCSUM                 = IOflag(C.DNET_IO_FLAGS_NOCSUM)
	DNET_IO_FLAGS_PLAIN_WRITE            = IOflag(C.DNET_IO_FLAGS_PLAIN_WRITE)
	DNET_IO_FLAGS_NODATA                 = IOflag(C.DNET_IO_FLAGS_NODATA)
	DNET_IO_FLAGS_CACHE                  = IOflag(C.DNET_IO_FLAGS_CACHE)
	DNET_IO_FLAGS_CACHE_ONLY             = IOflag(C.DNET_IO_FLAGS_CACHE_ONLY)
	DNET_IO_FLAGS_CACHE_REMOVE_FROM_DISK = IOflag(C.DNET_IO_FLAGS_CACHE_REMOVE_FROM_DISK)
	DNET_IO_FLAGS_COMPARE_AND_SWAP       = IOflag(C.DNET_IO_FLAGS_COMPARE_AND_SWAP)
	DNET_IO_FLAGS_CHECKSUM               = IOflag(C.DNET_IO_FLAGS_CHECKSUM)
	DNET_IO_FLAGS_WRITE_NO_FILE_INFO     = IOflag(C.DNET_IO_FLAGS_WRITE_NO_FILE_INFO)
	DNET_IO_FLAGS_CAS_TIMESTAMP          = IOflag(C.DNET_IO_FLAGS_CAS_TIMESTAMP)
)
View Source
const (
	DNET_FLAGS_NEED_ACK       = Cflag(C.DNET_FLAGS_NEED_ACK)
	DNET_FLAGS_MORE           = Cflag(C.DNET_FLAGS_MORE)
	DNET_FLAGS_DESTROY        = Cflag(C.DNET_FLAGS_DESTROY)
	DNET_FLAGS_DIRECT         = Cflag(C.DNET_FLAGS_DIRECT)
	DNET_FLAGS_NOLOCK         = Cflag(C.DNET_FLAGS_NOLOCK)
	DNET_FLAGS_CHECKSUM       = Cflag(C.DNET_FLAGS_CHECKSUM)
	DNET_FLAGS_NOCACHE        = Cflag(C.DNET_FLAGS_NOCACHE)
	DNET_FLAGS_DIRECT_BACKEND = Cflag(C.DNET_FLAGS_DIRECT_BACKEND)
	DNET_FLAGS_TRACE_BIT      = Cflag(C.DNET_FLAGS_TRACE_BIT)
	DNET_FLAGS_REPLY          = Cflag(C.DNET_FLAGS_REPLY)
)
View Source
const (
	DNET_ITYPE_NETWORK     = uint64(C.DNET_ITYPE_NETWORK)
	DNET_ITYPE_SERVER_SEND = uint64(C.DNET_ITYPE_SERVER_SEND)

	DNET_IFLAGS_DATA      = uint64(C.DNET_IFLAGS_DATA)
	DNET_IFLAGS_KEY_RANGE = uint64(C.DNET_IFLAGS_KEY_RANGE)
	DNET_IFLAGS_TS_RANGE  = uint64(C.DNET_IFLAGS_TS_RANGE)
	DNET_IFLAGS_NO_META   = uint64(C.DNET_IFLAGS_NO_META)
	DNET_IFLAGS_MOVE      = uint64(C.DNET_IFLAGS_MOVE)
	DNET_IFLAGS_OVERWRITE = uint64(C.DNET_IFLAGS_OVERWRITE)
)
View Source
const (
	DNET_RECORD_FLAGS_REMOVE       = uint64(C.DNET_RECORD_FLAGS_REMOVE)
	DNET_RECORD_FLAGS_NOCSUM       = uint64(C.DNET_RECORD_FLAGS_NOCSUM)
	DNET_RECORD_FLAGS_APPEND       = uint64(C.DNET_RECORD_FLAGS_APPEND)
	DNET_RECORD_FLAGS_EXTHDR       = uint64(C.DNET_RECORD_FLAGS_EXTHDR)
	DNET_RECORD_FLAGS_UNCOMMITTED  = uint64(C.DNET_RECORD_FLAGS_UNCOMMITTED)
	DNET_RECORD_FLAGS_CHUNKED_CSUM = uint64(C.DNET_RECORD_FLAGS_CHUNKED_CSUM)
)
View Source
const (
	SessionFilterAll      = iota
	SessionFilterPositive = iota
	SessionFilterMax      = iota
)
View Source
const (
	StatCategoryCache    int64  = 1 << 0
	StatCategoryIO       int64  = 1 << 1
	StatCategoryCommands int64  = 1 << 2
	StatCategoryBackend  int64  = 1 << 4
	StatCategoryProcFS   int64  = 1 << 6
	StatSectorSize       uint64 = 512

	BackendStateDisabled     int32 = 0
	BackendStateEnabled      int32 = 1
	BackendStateActivating   int32 = 2
	BackendStateDeactivating int32 = 3

	DefragStateNotStarted int32 = 0
	DefragStateInProgress int32 = 1
)
View Source
const (
	PIDKe float64 = 1.0

	// Integral part has to be zero in this case
	// since there is no continuous 'force' to check/change in our case
	// we can not infinitely increase integral part in attempt to compensate
	// for difference of the error from zero (or no-matter-what like 100 MB/s)
	// integral part has to compensate speed of wind when we are trying to achieve
	// desired velocity, but in our case there is no engine controller which
	// can output continuous power to driver the vehicle, instead we have to
	// determine which of the backends is currently the fastest
	PIDKi float64 = 0
	PIDKd float64 = 0.3
)

Variables

View Source
var (
	InvalidKeyArgument = errors.New("InvalidKeyArgument")

	DNET_ID_SIZE     = int(C.DNET_ID_SIZE)
	ErrInvalidDnetID = fmt.Errorf("Id must be shorter than %d", DNET_ID_SIZE)
)
View Source
var (
	BackendStateString = map[int32]string{
		BackendStateDisabled:     "disabled",
		BackendStateEnabled:      "enabled",
		BackendStateActivating:   "activating",
		BackendStateDeactivating: "deactivating",
	}
	DefragStateString = map[int32]string{
		DefragStateNotStarted: "not-started",
		DefragStateInProgress: "in-progress",
	}
)
View Source
var (
	KeyError = errors.New("No key")
)
View Source
var Pool = contextPool{/* contains filtered or unexported fields */}

Functions

func ErrorCode

func ErrorCode(err error) int

func ErrorData

func ErrorData(err error) string

func NextContext

func NextContext() uint64

Types

type AddressBackend

type AddressBackend struct {
	Addr    RawAddr
	Backend int32
}

func NewAddressBackend

func NewAddressBackend(addr *DnetAddr, backend int32) AddressBackend

func (*AddressBackend) String

func (ab *AddressBackend) String() string

type Backend

type Backend struct {
	Config       Config               `json:"config"`
	GlobalStats  GlobalStats          `json:"global_stats"`
	SummaryStats BlobStats            `json:"summary_stats"`
	BaseStats    map[string]BlobStats `json:"base_stats"`
	VFS          VStat                `json:"vfs"`
	DStat        DStatRaw             `json:"dstat"`
	Error        BackendError         `json:"error"`
}

type BackendError

type BackendError struct {
	Code int32 `json:"code"`
}

type BlobStats

type BlobStats struct {
	RecordsTotal       uint64 `json:"records_total"`
	RecordsRemoved     uint64 `json:"records_removed"`
	RecordsRemovedSize uint64 `json:"records_removed_size"`
	RecordsCorrupted   uint64 `json:"records_corrupted"`
	BaseSize           uint64 `json:"base_size"`
	WantDefrag         int32  `json:"want_defrag"`
	IsSorted           int32  `json:"is_sorted"`
}

type ByRawID

type ByRawID []DnetRawID

func (ByRawID) Len

func (a ByRawID) Len() int

func (ByRawID) Less

func (a ByRawID) Less(i, j int) bool

func (ByRawID) Swap

func (a ByRawID) Swap(i, j int)

type CStat

type CStat struct {
	RequestsSuccess  uint64
	RequestsFailures uint64
	Bytes            uint64

	RPSFailures float64
	RPSSuccess  float64
	BPS         float64
}

type Cflag

type Cflag uint64

type Command

type Command struct {
	Cache LayerStat `json:"cache"`
	Disk  LayerStat `json:"disk"`
	Total DstStat   `json:"total"`
}

func (*Command) Bytes

func (c *Command) Bytes() uint64

func (*Command) RequestsFailures

func (c *Command) RequestsFailures() uint64

func (*Command) RequestsSuccess

func (c *Command) RequestsSuccess() uint64

type CommandStat

type CommandStat struct {
	Success  uint64 `json:"successes"`
	Failures uint64 `json:"failures"`
	Size     uint64 `json:"size"`
	Time     uint64 `json:"time"`
}

func (*CommandStat) Bytes

func (c *CommandStat) Bytes() uint64

func (*CommandStat) RequestsFailures

func (c *CommandStat) RequestsFailures() uint64

func (*CommandStat) RequestsSuccess

func (c *CommandStat) RequestsSuccess() uint64

type Config

type Config struct {
	Group            uint32 `json:"group"`
	Data             string `json:"data"`
	Sync             int32  `json:"sync"`
	BlobFlags        uint64 `json:"blob_flags"`
	BlobSize         uint64 `json:"blob_size"`
	BlobSizeLimit    uint64 `json:"blob_size_limit"`
	MaxRecords       uint64 `json:"records_in_blob"`
	DefragPercentage uint64 `json:"defrag_percentage"`
	DefragTimeout    uint64 `json:"defrag_timeout"`
	DefragTime       uint64 `json:"defrag_time"`
	DefragSplay      uint64 `json:"defrag_splay"`
}

type DChannel

type DChannel struct {
	In  chan interface{}
	Out chan interface{}
	// contains filtered or unexported fields
}

func NewDChannel

func NewDChannel() *DChannel

type DStat

type DStat struct {
	WSectors uint64
	RSectors uint64
	IOTicks  uint64

	WBS  float64
	RBS  float64
	Util float64
}

type DStatRaw

type DStatRaw struct {
	ReadIOs      uint64 `json:"read_ios"`
	ReadMerges   uint64 `json:"read_merges"`
	ReadSectors  uint64 `json:"read_sectors"`
	ReadTicks    uint64 `json:"read_ticks"`
	WriteIOs     uint64 `json:"write_ios"`
	WriteMerges  uint64 `json:"write_merges"`
	WriteSectors uint64 `json:"write_sectors"`
	WriteTicks   uint64 `json:"write_ticks"`
	InFlight     uint64 `json:"in_flight"`
	IOTicks      uint64 `json:"io_ticks"`
	TimeInQueue  uint64 `json:"time_in_queue"`
}

type DnetAddr

type DnetAddr struct {
	Addr   []byte
	Family uint16
}

func NewDnetAddr

func NewDnetAddr(addr *C.struct_dnet_addr) DnetAddr

func NewDnetAddrStr

func NewDnetAddrStr(addr_str string) (DnetAddr, error)

func (*DnetAddr) CAddr

func (a *DnetAddr) CAddr(tmp *C.struct_dnet_addr)

func (*DnetAddr) HostString

func (a *DnetAddr) HostString() string

func (*DnetAddr) String

func (a *DnetAddr) String() string

type DnetBackendStatus

type DnetBackendStatus struct {
	Backend      int32
	State        int32
	DefragState  int32
	LastStart    time.Time
	LastStartErr int32
	RO           bool
	Delay        uint32
}

type DnetBackendsStatus

type DnetBackendsStatus struct {
	Backends []DnetBackendStatus
	Error    error
}

type DnetCmd

type DnetCmd struct {
	ID      DnetID
	Status  int32
	Cmd     int32
	Backend int32
	Trace   uint64
	Flags   uint64
	Trans   uint64
	Size    uint64
}

func NewDnetCmd

func NewDnetCmd(cmd *C.struct_dnet_cmd) DnetCmd

type DnetError

type DnetError struct {
	Code    int
	Flags   uint64
	Message string
}

func DnetErrorFromError

func DnetErrorFromError(err error) *DnetError

func (*DnetError) Error

func (err *DnetError) Error() string

type DnetFileInfo

type DnetFileInfo struct {
	Csum   []byte
	Offset uint64
	Size   uint64
	Mtime  time.Time
}

func NewDnetFileInfo

func NewDnetFileInfo(info *C.struct_dnet_file_info) DnetFileInfo

type DnetID

type DnetID struct {
	ID    []byte
	Group uint32
}

type DnetIOAttr

type DnetIOAttr struct {
	Parent []byte
	ID     []byte

	Start uint64
	Num   uint64

	Timestamp time.Time
	UserFlags uint64

	TotalSize uint64

	Flags uint32

	Offset uint64
	Size   uint64

	RecordFlags uint64
}

func NewDnetIOAttr

func NewDnetIOAttr(io *C.struct_dnet_io_attr) DnetIOAttr

type DnetIteratorRange

type DnetIteratorRange struct {
	Begin, End DnetRawID
}

type DnetIteratorResponse

type DnetIteratorResponse struct {
	ID           uint64
	Key          DnetRawID
	Status       int
	Timestamp    time.Time
	UserFlags    uint64
	Size         uint64
	IteratedKeys uint64
	TotalKeys    uint64
	Flags        uint64
}

type DnetRawID

type DnetRawID struct {
	ID []byte
}

func NewDnetRawID

func NewDnetRawID() *DnetRawID

func NewDnetRawIDraw

func NewDnetRawIDraw(raw *C.struct_dnet_raw_id) *DnetRawID

func (*DnetRawID) Equal

func (id *DnetRawID) Equal(other *DnetRawID) bool

func (*DnetRawID) Less

func (id *DnetRawID) Less(other *DnetRawID) bool

func (*DnetRawID) String

func (id *DnetRawID) String() string

type DnetRawIDKeys

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

func NewDnetRawIDKeys

func NewDnetRawIDKeys(ids []DnetRawID) (kk *DnetRawIDKeys, err error)

func (*DnetRawIDKeys) Free

func (kk *DnetRawIDKeys) Free()

func (*DnetRawIDKeys) InsertID

func (kk *DnetRawIDKeys) InsertID(id *DnetRawID)

func (*DnetRawIDKeys) Size

func (kk *DnetRawIDKeys) Size() int

type DnetStat

type DnetStat struct {
	Time  time.Time
	Group map[uint32]*StatGroup
}

func (*DnetStat) AddRouteEntry

func (stat *DnetStat) AddRouteEntry(entry *RouteEntry)

func (*DnetStat) AddStatEntry

func (stat *DnetStat) AddStatEntry(entry *StatEntry)

func (*DnetStat) Diff

func (stat *DnetStat) Diff(prev *DnetStat)

@Diff() updates differential counters like success/failure RPS and BPS i.e. those counters which require difference measured for some time

func (*DnetStat) Finalize

func (stat *DnetStat) Finalize()

func (*DnetStat) FindCreateBackend

func (stat *DnetStat) FindCreateBackend(group uint32, addr *DnetAddr, backend_id int32) *StatBackend

func (*DnetStat) StatData

func (stat *DnetStat) StatData() (reply map[string]interface{})

type DstStat

type DstStat struct {
	Storage PacketOnlyCommandStat `json:"storage"`
	Proxy   PacketOnlyCommandStat `json:"proxy"`
}

type GlobalStats

type GlobalStats struct {
	DataSortStartTime        uint64 `json:"datasort_start_time"`
	DataSortCompletionTime   uint64 `json:"datasort_completion_time"`
	DataSortCompletionStatus int32  `json:"datasort_completion_status"`
}

type IOflag

type IOflag uint32

type IteratorResult

type IteratorResult interface {
	Reply() *DnetIteratorResponse
	ReplyData() []byte
	ID() uint64
	Error() error
}

type Key

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

func NewKey

func NewKey(args ...interface{}) (key *Key, err error)

func NewKeyFromIdStr

func NewKeyFromIdStr(id string) (key *Key, err error)

func (*Key) ById

func (k *Key) ById() bool

func (*Key) CmpID

func (k *Key) CmpID(id []uint8) int

func (*Key) Free

func (k *Key) Free()

func (*Key) SetId

func (k *Key) SetId(id []byte, group_id uint32) error

func (*Key) SetRawId

func (k *Key) SetRawId(id []byte) error

type Keys

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

func NewKeys

func NewKeys(keys []string) (ret Keys, err error)

func (*Keys) Find

func (kk *Keys) Find(id []uint8) (ret string, err error)

func (*Keys) Free

func (kk *Keys) Free()

type LayerStat

type LayerStat struct {
	Outside  CommandStat `json:"outside"`
	Internal CommandStat `json:"internal"`
}

func (*LayerStat) Bytes

func (l *LayerStat) Bytes() uint64

func (*LayerStat) RequestsFailures

func (l *LayerStat) RequestsFailures() uint64

func (*LayerStat) RequestsSuccess

func (l *LayerStat) RequestsSuccess() uint64

type Logger

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

Logger provides file logger for Elliptics Node.

type Lookuper

type Lookuper interface {
	// server's reply
	Cmd() *DnetCmd

	// server's address
	Addr() *DnetAddr

	// dnet_file_info structure contains basic information about key location
	Info() *DnetFileInfo

	// address of the node which hosts given key
	StorageAddr() *DnetAddr

	//Path returns a path to file hosting given key on the storage.
	Path() string

	//Error returns string respresentation of error.
	Error() error
}

Lookuper represents one result of Write and Lookup operations.

type Node

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

A Node is responsible for the connection with a server side. Also it is responsible for checking timeouts, maintenance and checking of communication. To initialize the Node you should use NewNode.

func NewNode

func NewNode(logfile string, level string) (node *Node, err error)

NewNode returns new Node with a given Logger.

func NewNodeConfig

func NewNodeConfig(logfile string, level string, cfg *NodeConfig) (node *Node, err error)

NewNode returns new Node with a given Logger.

func (*Node) AddRemote

func (node *Node) AddRemote(addr string) (err error)

* AddRemote adds a connection to elliptics servers. * * Address is specified as Host:Port:Family. Family can be omitted. * Suitable Family values are: 2 (AF_INET) and 10 (AF_INET6).

func (*Node) AddRemotes

func (node *Node) AddRemotes(addrs []string) (err error)

func (*Node) Free

func (node *Node) Free()

Free disposes given Node instance. Do not destroy the Node used by any Session.

func (*Node) GetRawPointer

func (node *Node) GetRawPointer() unsafe.Pointer

Get raw elliptics node pointer

func (*Node) SetTimeouts

func (node *Node) SetTimeouts(waitTimeout int, checkTimeout int)

* SetTimeouts overrides the default values for timeouts. * * waitTimeout affects to any transaction, which is sent to the cluster. * Default value is 5 seconds. * * checkTimeout is responsible for updating the routing table * and checking the network connection. * By default it's 60 seconds.

type NodeConfig

type NodeConfig struct {
	IOThreadNum            int    `json:"io-thread-num"`
	NonBlockingIOThreadNum int    `json:"nonblocking-io-thread-num"`
	NetThreadNum           int    `json:"net-thread-num"`
	WaitTimeout            uint64 `json:"wait-timeout"`
	CheckTimeout           uint64 `json:"check-timeout"`
	Flags                  int    `json:"flags"`
	StallCount             int    `json:"stall-count"`
}

type PID

type PID struct {
	sync.RWMutex

	Error         float64
	IntegralError float64
	ErrorTime     time.Time
	Pain          float64
}

func NewPIDController

func NewPIDController() *PID

type PacketOnlyCommandStat

type PacketOnlyCommandStat struct {
	Success  uint64 `json:"successes"`
	Failures uint64 `json:"failures"`
}

type RawAddr

type RawAddr struct {
	Addr   [32]byte
	Len    int
	Family uint16
}

func (*RawAddr) DnetAddr

func (a *RawAddr) DnetAddr() *DnetAddr

func (*RawAddr) String

func (a *RawAddr) String() string

type ReadResult

type ReadResult interface {
	// server's reply
	Cmd() *DnetCmd

	// server's address
	Addr() *DnetAddr

	// IO parameters for given
	IO() *DnetIOAttr

	//Data returns string represntation of read data
	Data() []byte

	// read error
	Error() error
}

ReadResult wraps one result of read operation.

type ReadSeeker

type ReadSeeker struct {
	TotalSize   uint64
	RecordFlags uint64

	Mtime time.Time
	// contains filtered or unexported fields
}

implements Reader and Seeker interfaces

func NewEmptyReadSeeker

func NewEmptyReadSeeker() (*ReadSeeker, error)

func NewReadSeeker

func NewReadSeeker(session *Session, kstr string) (*ReadSeeker, error)

func NewReadSeekerKeyOffsetSize

func NewReadSeekerKeyOffsetSize(session *Session, key *Key, offset, size uint64) (*ReadSeeker, error)

func NewReadSeekerOffsetSize

func NewReadSeekerOffsetSize(session *Session, kstr string, offset, size uint64) (*ReadSeeker, error)

func (*ReadSeeker) Free

func (r *ReadSeeker) Free()

func (*ReadSeeker) Read

func (r *ReadSeeker) Read(p []byte) (n int, err error)

func (*ReadSeeker) ReadInternal

func (r *ReadSeeker) ReadInternal(buf []byte) (n int, err error)

func (*ReadSeeker) Seek

func (r *ReadSeeker) Seek(offset int64, whence int) (int64, error)

func (*ReadSeeker) SetKey

func (r *ReadSeeker) SetKey(session *Session, key *Key) error

type Remover

type Remover interface {
	// server's reply
	Cmd() *DnetCmd

	// key to be removed, only set for error results
	Key() string

	//Error of remove operation.
	Error() error
}

Remover wraps information about remove operation.

type Response

type Response struct {
	Timestamp     Time               `json:"timestamp"`
	MonitorStatus string             `json:"monitor_status"`
	Backends      map[string]VNode   `json:"backends"`
	Commands      map[string]Command `json:"commands"`
}

type RouteEntry

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

func NewRouteEntry

func NewRouteEntry(entry *C.struct_dnet_route_entry) *RouteEntry

func (*RouteEntry) ID

func (entry *RouteEntry) ID() []byte

func (*RouteEntry) String

func (r *RouteEntry) String() string

type Session

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

Session allows to perfom any operations with data and indexes.

Most of methods return channel. Channel will be closed after results end or error occurs. In case of error last value received from channel returns non nil value from Error method.

For example Remove:

if rm, ok := <-session.Remove(KEY); !ok {
    //Remove normally doesn't return any value, so chanel was closed.
    log.Println("Remove successfully")
} else {
    //We's received value from channel. It should be error message.
    log.Println("Error occured: ", rm.Error())
}

func CloneSession

func CloneSession(session *Session) (*Session, error)

CloneSession returns clone of the given Session.

func NewSession

func NewSession(node *Node) (*Session, error)

NewSession returns Session connected with given Node.

func (*Session) BackendDisable

func (s *Session) BackendDisable(addr *DnetAddr, backend_id int32) *DChannel

func (*Session) BackendEnable

func (s *Session) BackendEnable(addr *DnetAddr, backend_id int32) *DChannel

func (*Session) BackendMakeReadOnly

func (s *Session) BackendMakeReadOnly(addr *DnetAddr, backend_id int32) *DChannel

func (*Session) BackendMakeWritable

func (s *Session) BackendMakeWritable(addr *DnetAddr, backend_id int32) *DChannel

func (*Session) BackendSetDelay

func (s *Session) BackendSetDelay(addr *DnetAddr, backend_id int32, delay uint32) *DChannel

func (*Session) BackendStartDefrag

func (s *Session) BackendStartDefrag(addr *DnetAddr, backend_id int32) *DChannel

func (*Session) BackendsStatus

func (s *Session) BackendsStatus(addr *DnetAddr) *DChannel

func (*Session) BulkRemove

func (s *Session) BulkRemove(keys_str []string) <-chan Remover

BulkRemove removes keys from array. It returns error for every key it could not delete.

func (*Session) CopyIteratorStart

func (s *Session) CopyIteratorStart(id *DnetRawID, ranges []DnetIteratorRange,
	groups []uint32, iflags uint64, timeFrame ...time.Time) *DChannel

func (*Session) Delete

func (s *Session) Delete()

func (*Session) DnetStat

func (s *Session) DnetStat() *DnetStat

func (*Session) GetCflags

func (s *Session) GetCflags() Cflag

func (*Session) GetGroups

func (s *Session) GetGroups() []uint32

GetGroups returns array of groups this session holds

func (*Session) GetIOflags

func (s *Session) GetIOflags() IOflag

func (*Session) GetRoutes

func (s *Session) GetRoutes(stat *DnetStat)

func (*Session) GetTimeout

func (s *Session) GetTimeout() int

func (*Session) GetTimestamp

func (s *Session) GetTimestamp() time.Time

func (*Session) GetTraceID

func (s *Session) GetTraceID() TraceID

func (*Session) IteratorCancel

func (s *Session) IteratorCancel(id *DnetRawID, iteratorId uint64) *DChannel

func (*Session) IteratorContinue

func (s *Session) IteratorContinue(id *DnetRawID, iteratorId uint64) *DChannel

func (*Session) IteratorPause

func (s *Session) IteratorPause(id *DnetRawID, iteratorId uint64) *DChannel

func (*Session) IteratorStart

func (s *Session) IteratorStart(id *DnetRawID, ranges []DnetIteratorRange,
	itype uint64, iflags uint64, timeFrame ...time.Time) *DChannel

func (*Session) Lookup

func (s *Session) Lookup(key *Key) <-chan Lookuper

Lookup returns an information about given Key. It only returns the first group where key has been found.

func (*Session) LookupBackend

func (s *Session) LookupBackend(key string, group_id uint32) (addr *DnetAddr, backend_id int32, err error)

func (*Session) ParallelLookup

func (s *Session) ParallelLookup(kstr string) <-chan Lookuper

func (*Session) ParallelLookupID

func (s *Session) ParallelLookupID(id *DnetRawID) <-chan Lookuper

func (*Session) ParallelLookupKey

func (s *Session) ParallelLookupKey(key *Key) <-chan Lookuper

ParallelLookupKey returns all information about given Key, it sends multiple lookup requests in parallel to all session groups and returns information about all specified group where given key has been found.

func (*Session) ReadData

func (s *Session) ReadData(key string, offset, size uint64) <-chan ReadResult

ReadKey performs a read operation by string representation of key.

func (*Session) ReadInto

func (s *Session) ReadInto(key *Key, offset uint64, p []byte) <-chan ReadResult

ReadInto reads data into specified buffer.

func (*Session) ReadKey

func (s *Session) ReadKey(key *Key, offset, size uint64) <-chan ReadResult

ReadKey performs a read operation by key.

func (*Session) Remove

func (s *Session) Remove(key string) <-chan Remover

Remove performs remove operation by a string.

func (*Session) RemoveKey

func (s *Session) RemoveKey(key *Key) <-chan Remover

RemoveKey performs remove operation by key.

func (*Session) ServerSend

func (s *Session) ServerSend(keys []DnetRawID, flags uint64, groups []uint32) (*DChannel, error)

func (*Session) SetCflags

func (s *Session) SetCflags(cflags Cflag)

SetCflags sets command flags (DNET_FLAGS_* in API documentation) like nolock

func (*Session) SetFilter

func (s *Session) SetFilter(filter int)

func (*Session) SetGroups

func (s *Session) SetGroups(groups []uint32)

SetGroups points groups Session should work with.

func (*Session) SetIOflags

func (s *Session) SetIOflags(ioflags IOflag)

SetIOflags sets IO flags (DNET_IO_FLAGS_* in API documentation), i.e. flags for IO operations like read/write/delete

func (*Session) SetNamespace

func (s *Session) SetNamespace(namespace string)

* @SetNamespace sets the namespace for the Session. Default namespace is empty string. * * This feature allows you to share a single storage between services. * And each service which uses own namespace will have own independent space of keys.

func (*Session) SetTimeout

func (s *Session) SetTimeout(timeout int)

SetTimeout sets wait timeout in seconds (time to wait for operation to complete) for all subsequent session operations

func (*Session) SetTimestamp

func (s *Session) SetTimestamp(ts time.Time)

func (*Session) SetTraceID

func (s *Session) SetTraceID(trace TraceID)

func (*Session) Transform

func (s *Session) Transform(key string) string

func (*Session) WriteChunk

func (s *Session) WriteChunk(key string, input io.Reader, initial_offset, total_size uint64) <-chan Lookuper

func (*Session) WriteData

func (s *Session) WriteData(key string, input io.Reader, offset, total_size uint64) <-chan Lookuper

WriteData writes blob by a given string representation of Key.

func (*Session) WriteKey

func (s *Session) WriteKey(key *Key, input io.Reader, offset, total_size uint64) <-chan Lookuper

WriteKey writes blob by Key.

type StatBackend

type StatBackend struct {
	// Address+Backend for given stats, do not put it into json
	// since @RawAddr is an array of bytes and it can not be parsed by human
	Ab AddressBackend `json:"-"`

	Error BackendError `json:"error"`

	// All range starts (IDs) for given node (server address + backend)
	ID []DnetRawID `json:"-"`

	// percentage of the whole IDs ring currently occupied by given ids
	// and thus node (address + backend)
	Percentage float64

	// defragmentation status: 0 - not started, 1 - in progress
	DefragState            int32
	DefragStateStr         string
	DefragStartTime        time.Time
	DefragCompletionTime   time.Time
	DefragCompletionStatus int32

	// backend is in read-only mode
	RO bool

	// backend has delay of @Delay ms for every operation
	Delay uint32

	// VFS statistics: available, used and total space
	VFS VFS

	// PID-controller used for data writing
	PID *PID

	// per-command size/number counters
	// difference between the two divided by the time difference equals to RPS/BPS
	Commands map[string]*CStat
	// contains filtered or unexported fields
}

func NewStatBackend

func NewStatBackend(ab AddressBackend) *StatBackend

func (*StatBackend) IDString

func (sb *StatBackend) IDString() string

func (*StatBackend) Len

func (sb *StatBackend) Len() int

func (*StatBackend) Less

func (sb *StatBackend) Less(i, j int) bool

func (*StatBackend) PIDPain

func (backend *StatBackend) PIDPain() float64

func (*StatBackend) PIDUpdate

func (backend *StatBackend) PIDUpdate(e float64)

func (*StatBackend) Swap

func (sb *StatBackend) Swap(i, j int)

type StatBackendData

type StatBackendData struct {
	Address string
	Backend int32
	Stat    *StatBackend
}

type StatEntry

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

func (*StatEntry) AddressBackend

func (entry *StatEntry) AddressBackend() AddressBackend

func (*StatEntry) Group

func (entry *StatEntry) Group() uint32

type StatGroup

type StatGroup struct {
	Ab map[AddressBackend]*StatBackend
}

@StatGroup hosts mapping from node address + backend into per-backend statistics Every group in elliptics contains one or more servers each of which contains one or more backends Basically, the lowest IO entitiy is backend which is tightly bound with server node (or node's address)

func NewStatGroup

func NewStatGroup() StatGroup

func (*StatGroup) Finalize

func (rg *StatGroup) Finalize()

func (*StatGroup) FindStatBackend

func (sg *StatGroup) FindStatBackend(addr *DnetAddr, backend_id int32) (*StatBackend, error)

func (*StatGroup) FindStatBackendKey

func (sg *StatGroup) FindStatBackendKey(s *Session, key string, group_id uint32) (*StatBackend, error)

func (*StatGroup) StatGroupData

func (sg *StatGroup) StatGroupData() (reply *StatGroupData)

type StatGroupData

type StatGroupData struct {
	Backends []*StatBackendData
}

type Status

type Status struct {
	State        int32  `json:"state"`
	DefragState  int32  `json:"defrag_state"`
	LastStart    Time   `json:"last_start"`
	LastStartErr int32  `json:"last_start_err"`
	RO           bool   `json:"read_only"`
	Delay        uint32 `json:"delay"`
}

type Time

type Time struct {
	Sec  uint64 `json:"tv_sec"`
	USec uint64 `json:"tv_usec"`
}

type TraceID

type TraceID C.trace_id_t

type VFS

type VFS struct {
	// space in bytes for given backend
	Total, Avail uint64

	// logical size limitation for backends which support it
	// blob backend may set this (configuration must allow blob size checks, bit-4 must be zero)
	// for all others this field equals to @VFS.Total
	TotalSizeLimit uint64

	BackendRemovedSize uint64
	BackendUsedSize    uint64

	RecordsTotal     uint64
	RecordsRemoved   uint64
	RecordsCorrupted uint64
}

type VNode

type VNode struct {
	BackendID int                `json:"backend_id"`
	Status    Status             `json:"status"`
	Backend   Backend            `json:"backend"`
	Commands  map[string]Command `json:"commands"`
}

type VStat

type VStat struct {
	BSize  uint64 `json:"bsize"`
	FrSize uint64 `json:"frsize"`
	Blocks uint64 `json:"blocks"`
	BFree  uint64 `json:"bfree"`
	BAvail uint64 `json:"bavail"`
}

type WriteSeeker

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

implements Writer and Seeker interfaces

func NewEmptyWriteSeeker

func NewEmptyWriteSeeker() (*WriteSeeker, error)

func NewWriteSeeker

func NewWriteSeeker(session *Session, kstr string, remote_offset int64, total_size, reserve_size uint64) (*WriteSeeker, error)

func NewWriteSeekerKey

func NewWriteSeekerKey(session *Session, key *Key, remote_offset int64, total_size, reserve_size uint64) (*WriteSeeker, error)

func (*WriteSeeker) Flush

func (w *WriteSeeker) Flush(buf []byte, final bool) (err error)

func (*WriteSeeker) Free

func (w *WriteSeeker) Free()

func (*WriteSeeker) Seek

func (w *WriteSeeker) Seek(offset int64, whence int) (int64, error)

func (*WriteSeeker) SetKey

func (w *WriteSeeker) SetKey(session *Session, key *Key, remote_offset int64, total_size, reserve_size uint64) error

func (*WriteSeeker) Write

func (w *WriteSeeker) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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