Documentation ¶
Index ¶
- Constants
- Variables
- func AssertTrue(p bool)
- func EncodeMeta(l *LeaseMeta) []byte
- type Bucket
- type ConsistencyLevel
- type LeaseMeta
- type Store
- func (s *Store) Close()
- func (s *Store) Delete(key string) error
- func (s *Store) DeleteMeta(key string) error
- func (s *Store) Get(key string, lvl ConsistencyLevel) ([]byte, error)
- func (s *Store) GetLeaseKV(prefix, key string) ([]string, error)
- func (s *Store) GetMeta(key string) (m string, err error)
- func (s *Store) Join(nodeID, httpAddr string, addr string) error
- func (s *Store) LeaderAPIAddr() string
- func (s *Store) LeaderAddr() string
- func (s *Store) LeaderID() (string, error)
- func (s *Store) LeaseGrant(name string, ttl int) (uint64, error)
- func (s *Store) LeaseKeepAlive(leaseId, key string, value []byte) error
- func (s *Store) LeaseRevoke(leaseId string) error
- func (s *Store) LeaseTimeToAlive() error
- func (s *Store) Open(enableSingle bool, localID string) error
- func (s *Store) RecoverStatus()
- func (s *Store) Set(key string, value []byte) error
- func (s *Store) SetMeta(key, value string) error
- func (s *Store) WaitForApplied(timeout time.Duration) error
- func (s *Store) WaitForAppliedIndex(idx uint64, timeout time.Duration) error
- func (s *Store) WaitForLeader(timeout time.Duration) (string, error)
- type ValuePair
- type ValuePairs
- type WaitGroupWrapper
Constants ¶
View Source
const ( IndexSize = 5 * 4 // ko+ks+vo+vs+ttl BlockIndexSize = 4 + 1024*IndexSize // currOffset + 1024*(ko+ks+vo+vs+ttl) )
View Source
const ( DefaultKVBucketName = "impact-eintr" DefaultLeaseBucketName = "raftd-lease-system" )
View Source
const ( CREATE = iota ALIVE DEAD )
Variables ¶
View Source
var ( ErrInvalidKV = errors.New("Invalid Key Value Pair!") ErrEmptyBucket = errors.New("A empty Bucket!") )
View Source
var ( // ErrNotLeader is returned when a node attempts to execute a leader-only // operation. ErrNotLeader = errors.New("not leader") // ErrOpenTimeout is returned when the Store does not apply its initial // logs within the specified time. ErrOpenTimeout = errors.New("timeout waiting for initial logs application") ErrLeaseNotFound = errors.New("can not find this Lease") ErrLeaseExpire = errors.New("this Lease has been expired") )
Functions ¶
func AssertTrue ¶ added in v0.2.0
func AssertTrue(p bool)
func EncodeMeta ¶ added in v0.2.0
Types ¶
type Bucket ¶ added in v0.2.0
type Bucket struct { Meta LeaseMeta KV ValuePairs }
type ConsistencyLevel ¶
type ConsistencyLevel int
const ( Default ConsistencyLevel = iota Stale Consistent )
type LeaseMeta ¶ added in v0.1.0
type LeaseMeta struct { Name string `msgpack:"name"` TTL int `msgpack:"ttl"` Status int `msgpack:"status"` Count int `msgpack:"count"` }
func DecodeMeta ¶ added in v0.2.0
type Store ¶
type Store struct { RaftDir string RaftBind string DBDir string DB2Dir string // contains filtered or unexported fields }
func (*Store) DeleteMeta ¶
func (*Store) GetLeaseKV ¶ added in v0.1.0
func (*Store) Join ¶
Join joins a node, identified by nodeID and located at addr, to this store. The node must be ready to respond to Raft communications at that address.
func (*Store) LeaderAPIAddr ¶
func (*Store) LeaderAddr ¶
func (*Store) LeaseGrant ¶ added in v0.1.0
创建新的租约
func (*Store) LeaseKeepAlive ¶ added in v0.1.0
func (*Store) LeaseRevoke ¶ added in v0.1.0
func (*Store) LeaseTimeToAlive ¶ added in v0.1.0
func (*Store) RecoverStatus ¶ added in v0.1.1
func (s *Store) RecoverStatus()
RecoverStatus 节点状态机恢复后 根据状态机最新状态恢复服务现场
func (*Store) WaitForApplied ¶
WaitForApplied waits for all Raft log entries to to be applied to the underlying database.
func (*Store) WaitForAppliedIndex ¶
WaitForAppliedIndex blocks until a given log index has been applied, or the timeout expires.
type ValuePairs ¶ added in v0.2.0
type WaitGroupWrapper ¶ added in v0.1.0
func (*WaitGroupWrapper) Wrap ¶ added in v0.1.0
func (w *WaitGroupWrapper) Wrap(cb func())
Click to show internal directories.
Click to hide internal directories.