Back to godoc.org

Package k2hdkc

v1.0.0
Latest Go to latest

The latest major version is .

Published: Sep 24, 2020 | License: MIT | Module: github.com/yahoojapan/k2hdkc_go

Overview

Package k2hdkc implements a k2hdkc client.

Index

Constants

const (
	SeveritySilent logSeverity = 1 << iota
	SeverityError
	SeverityWarning
	SeverityInfo
	SeverityDump
)

SeveritySilent means this library logs nothing. SeverityError means this library logs only error message. SeverityWarning means this library logs warning and error message. SeverityInfo means this library logs normal, warning and error message. SeverityDump means this library logs all message.

const (
	LibSeveritySilent logSeverity = 1 << iota
	LibComlog
	LibK2hdkc
	LibChmpx
	LibK2hash
)

LibSeveritySilent means dependent libs logs nothing. LibComlog means dependent libraries logs only communication message. LibK2hdkc means k2hdkc library logs in the current severity level. LibChmpx means chmpx and k2hdkc libraries logs only communication message. Libk2hash means k2hash, chmpx and k2hdkc libraries logs only communication message.

type AddSubKey

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

AddSubKey holds C.k2hdkc_pm_set_subkey_wa arguments and a *AddSubKeyResult.

func NewAddSubKey

func NewAddSubKey(k interface{}, sk interface{}, sv interface{}) (*AddSubKey, error)

NewAddSubKey returns a new AddSubKey.

func (*AddSubKey) Execute

func (r *AddSubKey) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_set_subkey_wa function that adds subkey to the k2hdkc cluster.

func (*AddSubKey) Result

func (r *AddSubKey) Result() *AddSubKeyResult

Result returns the pointer of AddSubKeyResult that has the result of Execute method. nil returns if no result exists.

func (*AddSubKey) String

func (r *AddSubKey) String() string

String returns a text representation of the object.

type AddSubKeyResult

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

AddSubKeyResult holds the result of AddSubKey.Execute().

func (*AddSubKeyResult) Bool

func (r *AddSubKeyResult) Bool() bool

Bool returns the result whether C.k2hdkc_pm_set_subkey_wa is success.

func (*AddSubKeyResult) Error

func (r *AddSubKeyResult) Error() string

Error returns the errno of C.k2hdkc_pm_set_subkey_wa in string format.

func (*AddSubKeyResult) String

func (r *AddSubKeyResult) String() string

String returns a text representation of the object.

type Attr

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

Attr holds attribute names and values.

func (*Attr) String

func (r *Attr) String() string

String returns a text representation of the object.

type CasGet

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

CasGet holds arguments for C.k2hdkc_pm_cas{8,16,32,64}_get and a pointer of CasGetResult. bool k2hdkc_pm_cas64_get_wa(k2hdkc_chmpx_h handle, const unsigned char* pkey, size_t keylength, const char* encpass, uint64_t* pval)

func NewCasGet

func NewCasGet(k interface{}) (*CasGet, error)

NewCasGet returns a new CasGet.

func NewCasGetWithCasType

func NewCasGetWithCasType(k interface{}, ct CasType) (*CasGet, error)

NewCasGetWithCasType returns a new CasGet.

func (*CasGet) Execute

func (r *CasGet) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_cas{8,16,32,64}_get_wa function.

func (*CasGet) Result

func (r *CasGet) Result() *CasGetResult

Result returns the pointer of CasGetResult that has the result of Execute method.

func (*CasGet) SetEncPass

func (r *CasGet) SetEncPass(s string)

SetEncPass sets the pass member.

func (*CasGet) SetValueLen

func (r *CasGet) SetValueLen(vl uint8)

SetValueLen sets the vlen member.

func (*CasGet) String

func (r *CasGet) String() string

String returns a text representation of the object.

type CasGetResult

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

CasGetResult holds the result of CasGet.Execute().

func (*CasGetResult) Bool

func (r *CasGetResult) Bool() bool

Bool returns true if C.k2hdkc_pm_cas{8,16,32,64}_get_wa has been successfully called.

func (*CasGetResult) Bytes

func (r *CasGetResult) Bytes() []byte

Bytes returns the C.k2hdkc_pm_cas{8,16,32,64}_get_wa response in binary format.

func (*CasGetResult) Error

func (r *CasGetResult) Error() string

Error returns the errno of C.k2hdkc_pm_cas{8,16,32,64}_get_wa in string format.

func (*CasGetResult) String

func (r *CasGetResult) String() string

String returns a text representation of the object.

type CasIncDec

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

CasIncDec holds arguments for C.k2hdkc_pm_cas{8,16,32,64}_{in,de}crement and a pointer of CasIncDecResult.

func NewCasIncDec

func NewCasIncDec(k interface{}, i bool) (*CasIncDec, error)

NewCasIncDec returns a new CasIncDec.

func (*CasIncDec) Decrement

func (r *CasIncDec) Decrement(s *Session) (bool, error)

Decrement calls the C.k2hdkc_pm_cas_decrement_wa function.

func (*CasIncDec) Execute

func (r *CasIncDec) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_cas_{in,de}crement_wa function.

func (*CasIncDec) Increment

func (r *CasIncDec) Increment(s *Session) (bool, error)

Increment calls the C.k2hdkc_pm_cas_increment_wa function.

func (*CasIncDec) Result

func (r *CasIncDec) Result() *CasIncDecResult

Result returns the pointer of CasIncDecResult that has the result of Execute method.

func (*CasIncDec) SetEncPass

func (r *CasIncDec) SetEncPass(s string)

SetEncPass sets the pass member.

func (*CasIncDec) SetExpire

func (r *CasIncDec) SetExpire(t int64)

SetExpire sets the expire member.

func (*CasIncDec) String

func (r *CasIncDec) String() string

String returns a text representation of the object.

type CasIncDecResult

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

CasIncDecResult holds the result of CasIncDec.Execute().

func (*CasIncDecResult) Bool

func (r *CasIncDecResult) Bool() bool

Bool returns true if C.k2hdkc_pm_cas_{in,de}crement_wa has been successfully called.

func (*CasIncDecResult) Error

func (r *CasIncDecResult) Error() string

Error returns the errno of C.k2hdkc_pm_cas_{in,de}crement_wa in string format.

func (*CasIncDecResult) String

func (r *CasIncDecResult) String() string

String returns a text representation of the object.

type CasInit

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

CasInit holds arguments for C.k2hdkc_pm_cas{8,16,32,64}_init and a pointer of CasInitResult.

func NewCasInit

func NewCasInit(k interface{}) (cmd *CasInit, err error)

NewCasInit returns a new CasInit.

func NewCasInitWithValue

func NewCasInitWithValue(k interface{}, v interface{}) (*CasInit, error)

NewCasInitWithValue returns a new CasInit

func (*CasInit) Execute

func (r *CasInit) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_cas{8,16,32,64}_init_wa function that initialize the key in the k2hdkc cluster.

func (*CasInit) Result

func (r *CasInit) Result() *CasInitResult

Result returns the pointer of CasInitResult that has the result of Execute method.

func (*CasInit) SetEncPass

func (r *CasInit) SetEncPass(s string)

SetEncPass sets the pass member.

func (*CasInit) SetExpire

func (r *CasInit) SetExpire(t int64)

SetExpire sets the expire member.

func (*CasInit) SetValue

func (r *CasInit) SetValue(v []byte)

SetValue sets the val member.

func (*CasInit) String

func (r *CasInit) String() string

String returns a text representation of the object.

type CasInitResult

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

CasInitResult holds the result of CasInit.Execute().

func (*CasInitResult) Bool

func (r *CasInitResult) Bool() bool

Bool returns true if C.k2hdkc_pm_cas{8,16,32,64}_init_wa has been successfully called.

func (*CasInitResult) Error

func (r *CasInitResult) Error() string

Error returns the errno of C.k2hdkc_pm_cas{8,16,32,64}_init_wa in string format.

func (*CasInitResult) String

func (r *CasInitResult) String() string

String returns a text representation of the object.

type CasSet

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

CasSet holds arguments for C.k2hdkc_pm_cas{8,16,32,64}_set and a pointer of CasSetResult. bool k2hdkc_pm_cas64_set_wa(k2hdkc_chmpx_h handle, const unsigned char* pkey, size_t keylength, uint64_t oldval, uint64_t newval, const char* encpass, const time_t* expire)

func NewCasSet

func NewCasSet(k interface{}, o interface{}, n interface{}) (*CasSet, error)

NewCasSet returns a new CasSet.

func (*CasSet) Execute

func (r *CasSet) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_cas{8,16,32,64}_set_wa function that swap the key in the k2hdkc cluster.

func (*CasSet) Result

func (r *CasSet) Result() *CasSetResult

Result returns the pointer of CasSetResult that has the result of Execute method.

func (*CasSet) SetEncPass

func (r *CasSet) SetEncPass(s string)

SetEncPass sets the pass member.

func (*CasSet) SetExpire

func (r *CasSet) SetExpire(t int64)

SetExpire sets the expire member.

func (*CasSet) String

func (r *CasSet) String() string

String returns a text representation of the object.

type CasSetResult

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

CasSetResult holds the result of CasSet.Execute().

func (*CasSetResult) Bool

func (r *CasSetResult) Bool() bool

Bool returns true if C.k2hdkc_pm_cas{8,16,32,64}_set_wa has been successfully called.

func (*CasSetResult) Error

func (r *CasSetResult) Error() string

Error returns the errno of C.k2hdkc_pm_cas{8,16,32,64}_set_wa in string format.

func (*CasSetResult) String

func (r *CasSetResult) String() string

String returns a text representation of the object.

type CasType

type CasType uint8

CasType defines cas value data type and length.

const (
	// CasType8 is the type def of unit8
	CasType8 CasType = 8
	// CasType16 is the type def of unit16
	CasType16 CasType = 16
	// CasType32 is the type def of unit32
	CasType32 CasType = 32
	// CasType64 is the type def of unit64
	CasType64 CasType = 64
)

type ClearSubKeys

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

ClearSubKeys holds arguments for C.k2hdkc_pm_set_subkeys and a pointer of ClearSubKeys.

func NewClearSubKeys

func NewClearSubKeys(k interface{}) (*ClearSubKeys, error)

NewClearSubKeys return a new ClearSubKeys.

func (*ClearSubKeys) Execute

func (r *ClearSubKeys) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_set_subkeys function that clear the subkey to the k2hdkc cluster.

func (*ClearSubKeys) Result

func (r *ClearSubKeys) Result() *ClearSubKeysResult

Result returns the pointer of ClearSubKeysResult that has the result of Execute method.

func (*ClearSubKeys) String

func (r *ClearSubKeys) String() string

String returns a text representation of the object.

type ClearSubKeysResult

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

ClearSubKeysResult holds the result of ClearSubKeys.Execute().

func (*ClearSubKeysResult) Bool

func (r *ClearSubKeysResult) Bool() bool

Bool returns true if C.k2hdkc_pm_set_subkeys has been successfully called.

func (*ClearSubKeysResult) Error

func (r *ClearSubKeysResult) Error() string

Error returns the errno of C.k2hdkc_pm_set_subkeys in string format.

func (*ClearSubKeysResult) String

func (r *ClearSubKeysResult) String() string

String returns a text representation of the object.

type Client

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

Client holds settings to connect a chmpx slave server. Client is responsible for logging messages to a log file. Client is not responsible for managing request handlers with a k2hdkc cluster.

func NewClient

func NewClient(f string, p uint16) *Client

NewClient returns the pointer to a Client after initializing members.

func (*Client) Close

func (c *Client) Close()

Close calls the K2hLogger.Close(). NOTICE You must call Close() to avoid leaking file descriptor.

func (*Client) CreateSession

func (c *Client) CreateSession() (*Session, error)

CreateSession returns the pointer to a session with chmpx which handler is open..

func (*Client) Get

func (c *Client) Get(k string) (*GetResult, error)

Get returns a pointer of GetResult.

func (*Client) GetSubKeys

func (c *Client) GetSubKeys(k string) (*GetSubKeysResult, error)

GetSubKeys returns a pointer of GetSubKeysResult.

func (*Client) Send

func (c *Client) Send(cmd Command) (Command, error)

Send returns a pointer of a Command.

func (*Client) Set

func (c *Client) Set(k string, v string) (*SetResult, error)

Set returns a pointer of SetResult.

func (*Client) SetAutoRejoin

func (c *Client) SetAutoRejoin(b bool) *Client

SetAutoRejoin sets a rejoin member flag.

func (*Client) SetAutoRejoinRetry

func (c *Client) SetAutoRejoinRetry(b bool) *Client

SetAutoRejoinRetry sets a rejoinRetry member flag.

func (*Client) SetChmpxFile

func (c *Client) SetChmpxFile(f string) *Client

SetChmpxFile sets a chmpx file.

func (*Client) SetCleanup

func (c *Client) SetCleanup(b bool) *Client

SetCleanup sets a cleanup member flag.

func (*Client) SetCtlPort

func (c *Client) SetCtlPort(p uint16) *Client

SetCtlPort sets a control port.

func (*Client) SetCuk

func (c *Client) SetCuk(u string) *Client

SetCuk sets a cuk string.

func (*Client) SetLibLogSeverity

func (c *Client) SetLibLogSeverity(p logSeverity) *Client

SetLibLogSeverity changes the log serverity of libraries.

func (*Client) SetLogFile

func (c *Client) SetLogFile(f string) *Client

SetLogFile changes the logger output file.

func (*Client) SetLogSeverity

func (c *Client) SetLogSeverity(p logSeverity) *Client

SetLogSeverity changes the log serverity of k2hdkc_go and it's libraries.

func (*Client) SetLogger

func (c *Client) SetLogger(l *K2hLog) *Client

SetLogger sets a new logger.

func (*Client) SetSubKeys

func (c *Client) SetSubKeys(k string, skeys []string) (*SetSubKeysResult, error)

SetSubKeys returns a pointer of SetSubKeysResult.

func (*Client) String

func (c *Client) String() string

String returns a text representation of the object.

type Command

type Command interface {
	Execute(s *Session) (bool, error)
	String() string
}

Command is the interface of commands which are executed by Sessions.

type Get

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

Get holds arguments for C.k2hdkc_pm_get_value_wp and a pointer of GetResult.

func NewGet

func NewGet(k interface{}) (*Get, error)

NewGet returns the pointer to a Command struct.

func (*Get) Execute

func (r *Get) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_get_value_wp function which is the lowest C API.

func (*Get) Result

func (r *Get) Result() *GetResult

Result returns the pointer of GetResult that has the result of Execute method.

func (*Get) SetEncPass

func (r *Get) SetEncPass(s string)

SetEncPass set the password.

func (*Get) String

func (r *Get) String() string

String returns a text representation of the object.

type GetAttrs

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

GetAttrs holds arguments for C.k2hdkc_pm_get_attrs and a pointer of GetAttrsResult.

func NewGetAttrs

func NewGetAttrs(k interface{}) (*GetAttrs, error)

NewGetAttrs returns a new GetAttrs.

func (*GetAttrs) Execute

func (r *GetAttrs) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_get_attrs function that get key attributes from the k2hdkc cluster.

func (*GetAttrs) Result

func (r *GetAttrs) Result() *GetAttrsResult

Result returns the pointer of GetAttrs that has the result of Execute method.

func (*GetAttrs) String

func (r *GetAttrs) String() string

String returns a text representation of the object.

type GetAttrsResult

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

GetAttrsResult holds the result of GetAttrs.Execute().

func (*GetAttrsResult) Bool

func (r *GetAttrsResult) Bool() bool

Bool returns true if C.k2hdkc_pm_get_attrs has been successfully called.

func (*GetAttrsResult) Bytes

func (r *GetAttrsResult) Bytes() []*Attr

Bytes returns the C.k2hdkc_pm_get_attrs response in binary format.

func (*GetAttrsResult) Error

func (r *GetAttrsResult) Error() string

Error returns the errno of C.k2hdkc_pm_get_attrs in string format.

func (*GetAttrsResult) String

func (r *GetAttrsResult) String() map[string]string

String returns the C.k2hdkc_pm_get_attrs response in string format.

type GetResult

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

GetResult holds the result of Get.Execute().

func (*GetResult) Bool

func (r *GetResult) Bool() bool

Bool returns true if C.k2hdkc_pm_get_value_wp has been successfully called.

func (*GetResult) Bytes

func (r *GetResult) Bytes() []byte

Bytes returns the C.k2hdkc_pm_get_value_wp response in binary format.

func (*GetResult) Error

func (r *GetResult) Error() string

Error returns the errno of C.k2hdkc_pm_get_value_wp in string format.

func (*GetResult) String

func (r *GetResult) String() string

String returns the C.k2hdkc_pm_get_value_wp response in text format.

type GetSubKeys

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

GetSubKeys holds arguments for C.k2hdkc_pm_get_subkeys and a pointer of GetSubKeysResult.

func NewGetSubKeys

func NewGetSubKeys(k interface{}) (*GetSubKeys, error)

NewGetSubKeys returns a new GetSubKeys.

func (*GetSubKeys) Execute

func (r *GetSubKeys) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_get_subkeys function that gets subkey to the k2hdkc cluster.

func (*GetSubKeys) Result

func (r *GetSubKeys) Result() *GetSubKeysResult

Result returns the pointer of GetSubKeysResult that has the result of Execute method.

func (*GetSubKeys) String

func (r *GetSubKeys) String() string

String returns a text representation of the object.

type GetSubKeysResult

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

GetSubKeysResult holds the result of GetSubKeys.Execute().

func (*GetSubKeysResult) Bool

func (r *GetSubKeysResult) Bool() bool

Bool returns true if C.k2hdkc_pm_get_subkeys() has been successfully called.

func (*GetSubKeysResult) Bytes

func (r *GetSubKeysResult) Bytes() [][]byte

Bytes returns the C.k2hdkc_pm_get_subkeys() response in binary format.

func (*GetSubKeysResult) Error

func (r *GetSubKeysResult) Error() string

Error returns the errno of C.k2hdkc_pm_get_subkeys() in string format.

func (*GetSubKeysResult) String

func (r *GetSubKeysResult) String() []string

String returns the C.k2hdkc_pm_get_subkeys() response in string format.

type K2hLog

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

K2hLog holds pointer to log.Logger and logging configurations.

func K2hLogInstance

func K2hLogInstance() *K2hLog

K2hLogInstance initializes a K2hLog structure

func (*K2hLog) BundleLibLog

func (l *K2hLog) BundleLibLog(b bool)

BundleLibLog sets the log file for dependent libraries.

func (*K2hLog) Close

func (l *K2hLog) Close()

Close closes the file descriptor. NOTICE You must call Close() to avoid leaking file descriptor.

func (*K2hLog) Dump

func (l *K2hLog) Dump(msg string)

Dump prints a debug message.

func (*K2hLog) Dumpf

func (l *K2hLog) Dumpf(format string, v ...interface{})

Dumpf prints a formatted debug message.

func (*K2hLog) Error

func (l *K2hLog) Error(msg string)

Error prints an error message.

func (*K2hLog) Errorf

func (l *K2hLog) Errorf(format string, v ...interface{})

Errorf prints a formatted error message.

func (*K2hLog) Info

func (l *K2hLog) Info(msg string)

Info prints a normal severity message.

func (*K2hLog) Infof

func (l *K2hLog) Infof(format string, v ...interface{})

Infof prints a formatted normal severity message.

func (*K2hLog) SetChmpxLog

func (l *K2hLog) SetChmpxLog(b bool)

SetChmpxLog sets the serverity of chmpx library logger.

func (*K2hLog) SetComlog

func (l *K2hLog) SetComlog(b bool)

SetComlog enables the k2hdkc communication logging.

func (*K2hLog) SetK2hashLog

func (l *K2hLog) SetK2hashLog(b bool)

SetK2hashLog sets the serverity of k2hash library logger.

func (*K2hLog) SetK2hdkcLog

func (l *K2hLog) SetK2hdkcLog(b bool)

SetK2hdkcLog sets the serverity of k2hdkc library logger.

func (*K2hLog) SetLibLogSeverity

func (l *K2hLog) SetLibLogSeverity(p logSeverity)

SetLibLogSeverity enables logging of the dependent libraries.

func (*K2hLog) SetLogFile

func (l *K2hLog) SetLogFile(f string)

SetLogFile sets the file to be logged.

func (*K2hLog) SetLogSeverity

func (l *K2hLog) SetLogSeverity(p logSeverity)

SetLogSeverity sets the severity member.

func (*K2hLog) SetOutput

func (l *K2hLog) SetOutput(w io.Writer)

SetOutput sets the destination for the logger.

func (*K2hLog) String

func (l *K2hLog) String() string

String returns a text representation of the object.

func (*K2hLog) Warn

func (l *K2hLog) Warn(msg string)

Warn prints a warning message.

func (*K2hLog) Warnf

func (l *K2hLog) Warnf(format string, v ...interface{})

Warnf prints a formatted warning message.

type QueuePop

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

QueuePop holds arguments for C.k2hdkc_pm_q_pop_wa and C.k2hdkc_pm_keyq_pop_wa. It also holds a pointer of QueuePopResult.

func NewQueuePop

func NewQueuePop(p interface{}) (cmd *QueuePop, err error)

NewQueuePop returns a QueuePop which can pop a value.

func NewQueuePopWithKeyQueue

func NewQueuePopWithKeyQueue(p interface{}, kq bool) (cmd *QueuePop, err error)

NewQueuePopWithKeyQueue returns a QueuePop which can specify a key to pop a value.

func (*QueuePop) Execute

func (r *QueuePop) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp function that pops from the k2hdkc cluster.

func (*QueuePop) Result

func (r *QueuePop) Result() *QueuePopResult

Result returns the pointer of QueuePopResult that has the result of Execute method.

func (*QueuePop) SetEncPass

func (r *QueuePop) SetEncPass(s string)

SetEncPass sets the pass member.

func (*QueuePop) String

func (r *QueuePop) String() string

String returns a text representation of the object.

func (*QueuePop) UseFifo

func (r *QueuePop) UseFifo(b bool)

UseFifo sets the filo member.

func (*QueuePop) UseKeyQueue

func (r *QueuePop) UseKeyQueue(b bool)

UseKeyQueue sets the useKq member.

type QueuePopResult

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

QueuePopResult holds the result of QueuePop.Execute().

func (*QueuePopResult) Bool

func (r *QueuePopResult) Bool() bool

Bool returns true if C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp has been successfully called.

func (*QueuePopResult) Error

func (r *QueuePopResult) Error() string

Error returns the errno of C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp in string format.

func (*QueuePopResult) KeyBytes

func (r *QueuePopResult) KeyBytes() []byte

KeyBytes returns the key data in C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp response in binary format.

func (*QueuePopResult) KeyString

func (r *QueuePopResult) KeyString() string

KeyString returns the key data in C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp response in text format.

func (*QueuePopResult) String

func (r *QueuePopResult) String() string

String returns a text representation of the object.

func (*QueuePopResult) ValBytes

func (r *QueuePopResult) ValBytes() []byte

ValBytes returns the value data in C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp response in string format.

func (*QueuePopResult) ValString

func (r *QueuePopResult) ValString() string

ValString returns the value data in C.k2hdkc_pm_q_pop_wp and C.k2hdkc_pm_keyq_pop_wp response in text format.

type QueuePush

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

QueuePush holds arguments for C.k2hdkc_pm_q_push_wa and C.k2hdkc_pm_keyq_push_wa. It also holds a pointer of QueuePushResult.

func NewQueuePush

func NewQueuePush(p interface{}, v interface{}) (cmd *QueuePush, err error)

NewQueuePush returns a new QueuePush which can push a value to a queue.

func NewQueuePushWithKey

func NewQueuePushWithKey(p interface{}, v interface{}, k interface{}) (*QueuePush, error)

NewQueuePushWithKey returns a new QueuePush which can use a key to push a value.

func (*QueuePush) Execute

func (r *QueuePush) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_q_push_wa or C.k2hdkc_pm_keyq_push_wa function that push data to a queue.

func (*QueuePush) Result

func (r *QueuePush) Result() *QueuePushResult

Result returns the pointer of QueuePushResult that has the result of Execute method.

func (*QueuePush) SetAttr

func (r *QueuePush) SetAttr(b bool)

SetAttr sets the attr member.

func (*QueuePush) SetEncPass

func (r *QueuePush) SetEncPass(s string)

SetEncPass sets the pass member.

func (*QueuePush) SetExpire

func (r *QueuePush) SetExpire(t int64)

SetExpire sets the expire member.

func (*QueuePush) SetKey

func (r *QueuePush) SetKey(k interface{}) (bool, error)

SetKey sets the key member.

func (*QueuePush) String

func (r *QueuePush) String() string

String returns a text representation of the object.

func (*QueuePush) UseFifo

func (r *QueuePush) UseFifo(b bool)

UseFifo sets the fifo member.

type QueuePushResult

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

QueuePushResult holds the result of QueuePush.Execute().

func (*QueuePushResult) Bool

func (r *QueuePushResult) Bool() bool

Bool returns true if C.k2hdkc_pm_keyq_push_wa and C.k2hdkc_pm_q_push_wa has been successfully called.

func (*QueuePushResult) Error

func (r *QueuePushResult) Error() string

Error returns the errno of C.k2hdkc_pm_keyq_push_wa and C.k2hdkc_pm_q_push_wa in string format.

func (*QueuePushResult) String

func (r *QueuePushResult) String() string

String returns a text representation of the object.

type QueueRemove

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

QueueRemove holds arguments for C.k2hdkc_pm_q_remove_wa and C.k2hdkc_pm_keyq_remove_wa. It also holds a pointer of QueueRemoveResult.

func NewQueueRemove

func NewQueueRemove(p interface{}, cnt int64) (*QueueRemove, error)

NewQueueRemove returns a new QueueRemove.

func NewQueueRemoveWithKeyQueue

func NewQueueRemoveWithKeyQueue(p interface{}, cnt int64, kq bool) (cmd *QueueRemove, err error)

NewQueueRemoveWithKeyQueue returns a new QueueRemove using key queue.

func (*QueueRemove) Execute

func (r *QueueRemove) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_q_remove_wp and C.k2hdkc_pm_keyq_remove_wp function that remove data in the queue.

func (*QueueRemove) Result

func (r *QueueRemove) Result() *QueueRemoveResult

Result returns the pointer of QueueRemoveResult that has the result of Execute method.

func (*QueueRemove) SetEncPass

func (r *QueueRemove) SetEncPass(s string)

SetEncPass sets the pass member.

func (*QueueRemove) String

func (r *QueueRemove) String() string

String returns a text representation of the object.

func (*QueueRemove) UseFifo

func (r *QueueRemove) UseFifo(b bool)

UseFifo sets the fifo member.

func (*QueueRemove) UseKeyQueue

func (r *QueueRemove) UseKeyQueue(b bool)

UseKeyQueue sets the userKq member.

type QueueRemoveResult

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

QueueRemoveResult holds the result of QueueRemove.Execute().

func (*QueueRemoveResult) Bool

func (r *QueueRemoveResult) Bool() bool

Bool returns true if C.k2hdkc_pm_q_remove_wp and C.k2hdkc_pm_keyq_remove_wp has been successfully called.

func (*QueueRemoveResult) Error

func (r *QueueRemoveResult) Error() string

Error returns the errno of C.k2hdkc_pm_q_remove_wp and C.k2hdkc_pm_keyq_remove_wp in string format.

func (*QueueRemoveResult) String

func (r *QueueRemoveResult) String() string

String returns a text representation of the object.

type Remove

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

Remove holds arguments for C.k2hdkc_pm_remove and a pointer of RemoveResult.

func NewRemove

func NewRemove(k interface{}) (cmd *Remove, err error)

NewRemove returns the pointer to a Command struct.

func (*Remove) Execute

func (r *Remove) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_remove function which is the lowest C API.

func (*Remove) Result

func (r *Remove) Result() *RemoveResult

Result returns the pointer of RemoveResult that has the result of Execute method.

func (*Remove) String

func (r *Remove) String() string

String returns a text representation of the object.

type RemoveResult

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

RemoveResult holds the result of RemoveResult.Execute().

func (*RemoveResult) Bool

func (r *RemoveResult) Bool() bool

Bool returns true if C.k2hdkc_pm_remove has been successfully called.

func (*RemoveResult) Error

func (r *RemoveResult) Error() string

Error returns the errno of C.k2hdkc_pm_remove in string format.

func (*RemoveResult) String

func (r *RemoveResult) String() string

String returns a text representation of the object.

type RemoveSubKey

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

RemoveSubKey holds arguments C.k2hdkc_pm_remove_subkey for and a pointer of RemoveSubKeyResult.

func NewRemoveSubKey

func NewRemoveSubKey(k interface{}, sk interface{}) (*RemoveSubKey, error)

NewRemoveSubKey returns a new RemoveSubKey.

func (*RemoveSubKey) Execute

func (r *RemoveSubKey) Execute(s *Session) (bool, error)

Execute calls C.k2hdkc_pm_remove_subkey that remove a subkey.

func (*RemoveSubKey) Result

func (r *RemoveSubKey) Result() *RemoveSubKeyResult

Result returns the pointer of RemoveSubKeyResult that has the result of Execute method.

func (*RemoveSubKey) String

func (r *RemoveSubKey) String() string

String returns a text representation of the object.

type RemoveSubKeyResult

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

RemoveSubKeyResult holds the result of RemoveSubKey.Execute().

func (*RemoveSubKeyResult) Bool

func (r *RemoveSubKeyResult) Bool() bool

Bool returns true if C.k2hdkc_pm_remove_subkey has been successfully called.

func (*RemoveSubKeyResult) Error

func (r *RemoveSubKeyResult) Error() string

Error returns the errno of C.k2hdkc_pm_remove_subkey() in string format.

func (*RemoveSubKeyResult) String

func (r *RemoveSubKeyResult) String() string

String returns a text representation of the object.

type Rename

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

Rename holds arguments for C.k2hdkc_pm_rename_with_parent_wa and a pointer of RenameResult.

func NewRename

func NewRename(o interface{}, n interface{}) (cmd *Rename, err error)

NewRename returns a Rename.

func (*Rename) Execute

func (r *Rename) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_rename_with_parent_wa function.

func (*Rename) Result

func (r *Rename) Result() *RenameResult

Result returns the pointer of RenameResult that has the result of Execute method.

func (*Rename) SetAttr

func (r *Rename) SetAttr(b bool)

SetAttr sets the attr member.

func (*Rename) SetEncPass

func (r *Rename) SetEncPass(p string)

SetEncPass sets the pass member.

func (*Rename) SetExpire

func (r *Rename) SetExpire(t int64)

SetExpire sets the expire member.

func (*Rename) SetParentKey

func (r *Rename) SetParentKey(p interface{}) (bool, error)

SetParentKey sets the parentKey member.

func (*Rename) String

func (r *Rename) String() string

String returns a text representation of the object.

type RenameResult

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

RenameResult holds the result of Rename.Execute().

func (*RenameResult) Bool

func (r *RenameResult) Bool() bool

Bool returns true if C.k2hdkc_pm_rename_with_parent_wa has been successfully called.

func (*RenameResult) Error

func (r *RenameResult) Error() string

Error returns the errno of C.k2hdkc_pm_rename_with_parent_wa in string format.

func (*RenameResult) String

func (r *RenameResult) String() string

String returns a text representation of the object.

type Result

type Result interface {
	Bool() bool
	String() string
}

Result is the interface of getting a result of a Command.

type Session

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

Session keeps configurations and is responsible for creating request handlers with a k2hdkc cluster and closing them.

func NewSession

func NewSession(c *Client) (*Session, error)

NewSession returns a new chmpx session with a k2hdkc cluster.

func (*Session) Close

func (s *Session) Close() error

Close closes a chmpx session with the k2hdkc cluster. NOTICE You must call Close() to avoid leaking file descriptor.

func (*Session) String

func (s *Session) String() string

String returns a text representation of the object.

type Set

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

Set holds arguments for C.k2hdkc_pm_set_value_wa and a pointer of SetResult.

func NewSet

func NewSet(k interface{}, v interface{}) (*Set, error)

NewSet returns a new Set.

func (*Set) Execute

func (r *Set) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_set_value_wa function that adds subkey to the k2hdkc cluster.

func (*Set) Result

func (r *Set) Result() *SetResult

Result returns the pointer of SetResult that has the result of Execute method.

func (*Set) SetEncPass

func (r *Set) SetEncPass(s string)

SetEncPass sets the pass member.

func (*Set) SetExpire

func (r *Set) SetExpire(t int64)

SetExpire sets the expire member.

func (*Set) SetRmSubKeyList

func (r *Set) SetRmSubKeyList(b bool)

SetRmSubKeyList sets the rmSubKeyList member.

func (*Set) String

func (r *Set) String() string

String returns a text representation of the object.

type SetAll

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

SetAll holds arguments for C.k2hdkc_pm_set_all_wa and a pointer of SetAllResult.

func NewSetAll

func NewSetAll(k interface{}, v interface{}, sk interface{}) (*SetAll, error)

NewSetAll returns a new SetAll.

func (*SetAll) Execute

func (r *SetAll) Execute(s *Session) (bool, error)

Execute calls the C.k2hdkc_pm_set_all_wa function.

func (*SetAll) Result

func (r *SetAll) Result() *SetAllResult

Result returns the pointer of SetAllResult that has the result of Execute method.

func (*SetAll) String

func (r *SetAll) String() string

String returns a text representation of the object.

type SetAllResult

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

SetAllResult holds the result of SetAll.Execute().

func (*SetAllResult) Bool

func (r *SetAllResult) Bool() bool

Bool returns true if C.k2hdkc_pm_set_all_wa has been successfully called.

func (*SetAllResult) Error

func (r *SetAllResult) Error() string

Error returns the errno of C.k2hdkc_pm_set_all_wa in string format.

func (*SetAllResult) String

func (r *SetAllResult) String() string

String returns a text representation of the object.

type SetResult

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

SetResult holds the result of Set.Execute().

func (*SetResult) Bool

func (r *SetResult) Bool() bool

Bool returns true if C.k2hdkc_pm_set_value_wa has been successfully called.

func (*SetResult) Error

func (r *SetResult) Error() string

Error returns the errno of C.k2hdkc_pm_set_value_wa in string format.

func (*SetResult) String

func (r *SetResult) String() string

String returns a text representation of the object.

type SetSubKeys

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

SetSubKeys holds arguments for C.k2hdkc_pm_set_subkeys and a pointer of SetSubKeysResult.

func NewSetSubKeys

func NewSetSubKeys(k interface{}, sk interface{}) (*SetSubKeys, error)

NewSetSubKeys returns a new SetSubKeys.

func (*SetSubKeys) Execute

func (r *SetSubKeys) Execute(s *Session) (bool, error)

Execute calls C.k2hdkc_pm_set_subkeys that set a subkey.

func (*SetSubKeys) Result

func (r *SetSubKeys) Result() *SetSubKeysResult

Result returns the result of Execute method.

func (*SetSubKeys) String

func (r *SetSubKeys) String() string

String returns a text representation of the object.

type SetSubKeysResult

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

SetSubKeysResult holds the result of SetSubKeys.Execute().

func (*SetSubKeysResult) Bool

func (r *SetSubKeysResult) Bool() bool

Bool returns whether C.k2hdkc_pm_set_subkeys returned success or not.

func (*SetSubKeysResult) Error

func (r *SetSubKeysResult) Error() string

Error returns the errno of C.k2hdkc_pm_set_subkeys() in string format.

func (*SetSubKeysResult) String

func (r *SetSubKeysResult) String() string

String returns a text representation of the object.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier