Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultTimeFormat = "2006-01-02 15:04:05.000000"
DefaultTimeFormat for logger
Variables ¶
View Source
var ( ErrApplyFuncRegistered = errors.New("apply func already registered") ErrApplyFuncDoesNotExist = errors.New("apply func does not exist") )
Errors
View Source
var ( ErrNodeNameEmpty = errors.New("config NodeName is empty") ErrBackendEmpty = errors.New("config Backend is empty") ErrNodeIsNotALeader = errors.New("node is not a leader") ErrInternalError = errors.New("internal error") )
errors
Functions ¶
This section is empty.
Types ¶
type ApplyRegistrator ¶ added in v0.1.3
type ApplyRegistrator interface { RegisterApplyWrite(name string, fn dbApi.ApplyFunc) error RegisterApplyRead(name string, fn dbApi.ApplyFunc) error UnRegisterApply(name string) error GetApplyFunc(name string) (dbApi.ApplyFunc, bool, error) }
ApplyRegistrator is an interface to reg/unreg function to work with db
type Client ¶
type Client interface { Put(tab, key, value []byte) error Get(level ConsistencyLevel, tab, key []byte) ([]byte, error) Delete(tab, key []byte) error Logger(subSystem string) *log.Logger Shutdown() error Leader() (host, ip string) IsLeader() bool // Apply ApplyRegistrator ApplyRead(roLevel ConsistencyLevel, fn string, args ...[]byte) (interface{}, error) ApplyWrite(fn string, args ...[]byte) (interface{}, error) }
Client is a client interface to rkv
type Config ¶
type Config struct { Raft raft.Config NodeName string DataDir string // Backend Backend dbApi.Backend // Membership ip:port used by Serf to discover nodes and create cluster DiscoveryAddr string // DiscoveryJoinAddrs is empty for leader // For followers contains leader address [+running followers addresses] DiscoveryJoinAddrs []string RaftPort int RPCPort int HTTPAddr string // Log options Logger hlog.Logger // LogLevel: error | warn | info | debug | trace LogLevel string // default stderr LogOutput io.Writer LogIncludeLocation bool LotTimeFormat string // OnChangeLeaderFn func(isLeader bool) Registry ApplyRegistrator }
Config to create client
type ConsistencyLevel ¶ added in v0.0.8
type ConsistencyLevel int
ConsistencyLevel represents the available read consistency levels
const ( // Read direct from db at any node ReadAny ConsistencyLevel = iota // Read direct from db at leader node ReadLeader // Read linearizable from leader node ReadCluster )
Consistency level values
type RoutingPolicy ¶ added in v0.1.3
type RoutingPolicy int
RoutingPolicy type
const ( RouteToLeader RoutingPolicy = 0 RouteReturnRedirect RoutingPolicy = 1 )
Available routing policies for mutate state operations
Click to show internal directories.
Click to hide internal directories.