Documentation ¶
Index ¶
- Constants
- Variables
- type BinaryClientProtocol
- func (self *BinaryClientProtocol) Close() error
- func (self *BinaryClientProtocol) GetStream() *Stream
- func (self *BinaryClientProtocol) LocalAddr() net.Addr
- func (self *BinaryClientProtocol) Read() (protocol.CommandDecode, error)
- func (self *BinaryClientProtocol) ReadCommand() (protocol.CommandDecode, error)
- func (self *BinaryClientProtocol) RemoteAddr() net.Addr
- func (self *BinaryClientProtocol) Write(command protocol.CommandEncode) error
- func (self *BinaryClientProtocol) WriteCommand(command protocol.CommandEncode) error
- type Client
- func (self *Client) Close() error
- func (self *Client) CloseSubscribe(s ISubscriber) error
- func (self *Client) Event(eventKey [16]byte, timeout uint32, expried uint32, defaultSeted bool) *Event
- func (self *Client) ExecuteCommand(command protocol.ICommand, timeout int) (protocol.ICommand, error)
- func (self *Client) GenRequestId() [16]byte
- func (self *Client) GetDefaultExpriedFlag() uint16
- func (self *Client) GetDefaultTimeoutFlag() uint16
- func (self *Client) GroupEvent(groupKey [16]byte, clientId uint64, versionId uint64, timeout uint32, ...) *GroupEvent
- func (self *Client) Lock(lockKey [16]byte, timeout uint32, expried uint32) *Lock
- func (self *Client) MaxConcurrentFlow(flowKey [16]byte, count uint16, timeout uint32, expried uint32) *MaxConcurrentFlow
- func (self *Client) Open() error
- func (self *Client) RLock(lockKey [16]byte, timeout uint32, expried uint32) *RLock
- func (self *Client) RWLock(lockKey [16]byte, timeout uint32, expried uint32) *RWLock
- func (self *Client) SelectDB(dbId uint8) *Database
- func (self *Client) Semaphore(semaphoreKey [16]byte, timeout uint32, expried uint32, count uint16) *Semaphore
- func (self *Client) SendCommand(command protocol.ICommand) error
- func (self *Client) SetDefaultExpriedFlag(expriedFlag uint16)
- func (self *Client) SetDefaultTimeoutFlag(timeoutFlag uint16)
- func (self *Client) State(dbId uint8) *protocol.StateResultCommand
- func (self *Client) Subscribe(expried uint32, maxSize uint32) (ISubscriber, error)
- func (self *Client) SubscribeMask(lockKeyMask [16]byte, expried uint32, maxSize uint32) (ISubscriber, error)
- func (self *Client) TokenBucketFlow(flowKey [16]byte, count uint16, timeout uint32, period float64) *TokenBucketFlow
- func (self *Client) TreeLock(lockKey [16]byte, parentKey [16]byte, timeout uint32, expried uint32) *TreeLock
- func (self *Client) Unavailable() chan bool
- func (self *Client) UpdateSubscribe(s ISubscriber) error
- type ClientProtocol
- type Database
- func (self *Database) Close() error
- func (self *Database) Event(eventKey [16]byte, timeout uint32, expried uint32, defaultSeted bool) *Event
- func (self *Database) GenLockId() [16]byte
- func (self *Database) GenRequestId() [16]byte
- func (self *Database) GetDefaultExpriedFlag() uint16
- func (self *Database) GetDefaultTimeoutFlag() uint16
- func (self *Database) GroupEvent(groupKey [16]byte, clientId uint64, versionId uint64, timeout uint32, ...) *GroupEvent
- func (self *Database) ListLockLockeds(lockKey [16]byte, timeout int) (*protobuf.LockDBListLockedResponse, error)
- func (self *Database) ListLockWaits(lockKey [16]byte, timeout int) (*protobuf.LockDBListWaitResponse, error)
- func (self *Database) ListLocks(timeout int) (*protobuf.LockDBListLockResponse, error)
- func (self *Database) Lock(lockKey [16]byte, timeout uint32, expried uint32) *Lock
- func (self *Database) MaxConcurrentFlow(flowKey [16]byte, count uint16, timeout uint32, expried uint32) *MaxConcurrentFlow
- func (self *Database) RLock(lockKey [16]byte, timeout uint32, expried uint32) *RLock
- func (self *Database) RWLock(lockKey [16]byte, timeout uint32, expried uint32) *RWLock
- func (self *Database) Semaphore(semaphoreKey [16]byte, timeout uint32, expried uint32, count uint16) *Semaphore
- func (self *Database) SetDefaultExpriedFlag(expriedFlag uint16)
- func (self *Database) SetDefaultTimeoutFlag(timeoutFlag uint16)
- func (self *Database) State() *protocol.StateResultCommand
- func (self *Database) TokenBucketFlow(flowKey [16]byte, count uint16, timeout uint32, period float64) *TokenBucketFlow
- func (self *Database) TreeLock(lockKey [16]byte, parentKey [16]byte, timeout uint32, expried uint32) *TreeLock
- type Event
- func (self *Event) Clear() (*protocol.LockResultCommand, error)
- func (self *Event) ClearWithUnsetData() (*protocol.LockResultCommand, error)
- func (self *Event) GetEventKey() [16]byte
- func (self *Event) GetExpried() uint32
- func (self *Event) GetTimeout() uint32
- func (self *Event) IsSet() (bool, error)
- func (self *Event) Mode() uint8
- func (self *Event) Set() (*protocol.LockResultCommand, error)
- func (self *Event) SetWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Event) Wait(timeout uint32) (*protocol.LockResultCommand, error)
- func (self *Event) WaitAndTimeoutRetryClear(timeout uint32) (*protocol.LockResultCommand, error)
- type GroupEvent
- func (self *GroupEvent) Clear() (*protocol.LockResultCommand, error)
- func (self *GroupEvent) ClearWithUnsetData() (*protocol.LockResultCommand, error)
- func (self *GroupEvent) GetClientId() uint64
- func (self *GroupEvent) GetExpried() uint32
- func (self *GroupEvent) GetGroupKey() [16]byte
- func (self *GroupEvent) GetTimeout() uint32
- func (self *GroupEvent) GetVersionId() uint64
- func (self *GroupEvent) IsSet() (bool, error)
- func (self *GroupEvent) Set() (*protocol.LockResultCommand, error)
- func (self *GroupEvent) SetWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *GroupEvent) Wait(timeout uint32) (*protocol.LockResultCommand, error)
- func (self *GroupEvent) WaitAndTimeoutRetryClear(timeout uint32) (*protocol.LockResultCommand, error)
- func (self *GroupEvent) Wakeup() (*protocol.LockResultCommand, error)
- func (self *GroupEvent) WakeupWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- type IClient
- type ISubscriber
- type Lock
- func (self *Lock) CancelWait() (*protocol.LockResultCommand, error)
- func (self *Lock) GetCount() uint16
- func (self *Lock) GetExpried() uint16
- func (self *Lock) GetExpriedFlag() uint16
- func (self *Lock) GetLockId() [16]byte
- func (self *Lock) GetLockKey() [16]byte
- func (self *Lock) GetRcount() uint8
- func (self *Lock) GetTimeout() uint16
- func (self *Lock) GetTimeoutFlag() uint16
- func (self *Lock) Lock() (*protocol.LockResultCommand, error)
- func (self *Lock) LockShow() (*protocol.LockResultCommand, error)
- func (self *Lock) LockUpdate() (*protocol.LockResultCommand, error)
- func (self *Lock) LockUpdateWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Lock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Lock) SendLock() error
- func (self *Lock) SendLockWithData(data *protocol.LockCommandData) error
- func (self *Lock) SendUnlock() error
- func (self *Lock) SendUnlockWithData(data *protocol.LockCommandData) error
- func (self *Lock) SetCount(count uint16) uint16
- func (self *Lock) SetExpriedFlag(flag uint16) uint16
- func (self *Lock) SetRcount(rcount uint8) uint8
- func (self *Lock) SetTimeoutFlag(flag uint16) uint16
- func (self *Lock) Unlock() (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockHead() (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockHeadRetoLockWait() (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockHeadRetoLockWaitWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockHeadWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockRetoLockWait() (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockRetoLockWaitWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *Lock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- type LockError
- type MaxConcurrentFlow
- func (self *MaxConcurrentFlow) Acquire() (*protocol.LockResultCommand, error)
- func (self *MaxConcurrentFlow) GetExpriedFlag() uint16
- func (self *MaxConcurrentFlow) GetTimeoutFlag() uint16
- func (self *MaxConcurrentFlow) Release() (*protocol.LockResultCommand, error)
- func (self *MaxConcurrentFlow) SetExpriedFlag(flag uint16) uint16
- func (self *MaxConcurrentFlow) SetTimeoutFlag(flag uint16) uint16
- type RLock
- func (self *RLock) GetExpried() uint32
- func (self *RLock) GetLockKey() [16]byte
- func (self *RLock) GetTimeout() uint32
- func (self *RLock) Lock() (*protocol.LockResultCommand, error)
- func (self *RLock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *RLock) Unlock() (*protocol.LockResultCommand, error)
- func (self *RLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- type RWLock
- func (self *RWLock) GetExpried() uint32
- func (self *RWLock) GetLockKey() [16]byte
- func (self *RWLock) GetTimeout() uint32
- func (self *RWLock) Lock() (*protocol.LockResultCommand, error)
- func (self *RWLock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *RWLock) RLock() (*protocol.LockResultCommand, error)
- func (self *RWLock) RLockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *RWLock) RUnlock() (*protocol.LockResultCommand, error)
- func (self *RWLock) RUnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *RWLock) Unlock() (*protocol.LockResultCommand, error)
- func (self *RWLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- type ReplsetClient
- func (self *ReplsetClient) Close() error
- func (self *ReplsetClient) CloseSubscribe(s ISubscriber) error
- func (self *ReplsetClient) Event(eventKey [16]byte, timeout uint32, expried uint32, defaultSeted bool) *Event
- func (self *ReplsetClient) ExecuteCommand(command protocol.ICommand, timeout int) (protocol.ICommand, error)
- func (self *ReplsetClient) GenRequestId() [16]byte
- func (self *ReplsetClient) GetClient() *Client
- func (self *ReplsetClient) GetDefaultExpriedFlag() uint16
- func (self *ReplsetClient) GetDefaultTimeoutFlag() uint16
- func (self *ReplsetClient) GroupEvent(groupKey [16]byte, clientId uint64, versionId uint64, timeout uint32, ...) *GroupEvent
- func (self *ReplsetClient) Lock(lockKey [16]byte, timeout uint32, expried uint32) *Lock
- func (self *ReplsetClient) MaxConcurrentFlow(flowKey [16]byte, count uint16, timeout uint32, expried uint32) *MaxConcurrentFlow
- func (self *ReplsetClient) Open() error
- func (self *ReplsetClient) RLock(lockKey [16]byte, timeout uint32, expried uint32) *RLock
- func (self *ReplsetClient) RWLock(lockKey [16]byte, timeout uint32, expried uint32) *RWLock
- func (self *ReplsetClient) SelectDB(dbId uint8) *Database
- func (self *ReplsetClient) Semaphore(semaphoreKey [16]byte, timeout uint32, expried uint32, count uint16) *Semaphore
- func (self *ReplsetClient) SendCommand(command protocol.ICommand) error
- func (self *ReplsetClient) SetDefaultExpriedFlag(expriedFlag uint16)
- func (self *ReplsetClient) SetDefaultTimeoutFlag(timeoutFlag uint16)
- func (self *ReplsetClient) Subscribe(expried uint32, maxSize uint32) (ISubscriber, error)
- func (self *ReplsetClient) SubscribeMask(lockKeyMask [16]byte, expried uint32, maxSize uint32) (ISubscriber, error)
- func (self *ReplsetClient) TokenBucketFlow(flowKey [16]byte, count uint16, timeout uint32, period float64) *TokenBucketFlow
- func (self *ReplsetClient) TreeLock(lockKey [16]byte, parentKey [16]byte, timeout uint32, expried uint32) *TreeLock
- func (self *ReplsetClient) Unavailable() chan bool
- func (self *ReplsetClient) UpdateSubscribe(s ISubscriber) error
- type ReplsetSubscriber
- type Semaphore
- func (self *Semaphore) Acquire() (*protocol.LockResultCommand, error)
- func (self *Semaphore) Count() (int, error)
- func (self *Semaphore) GetExpried() uint32
- func (self *Semaphore) GetSemaphoreKey() [16]byte
- func (self *Semaphore) GetTimeout() uint32
- func (self *Semaphore) Release() (*protocol.LockResultCommand, error)
- func (self *Semaphore) ReleaseAll() error
- func (self *Semaphore) ReleaseN(n int) (int, error)
- type Stream
- func (self *Stream) Close() error
- func (self *Stream) LocalAddr() net.Addr
- func (self *Stream) Read(buf []byte) (int, error)
- func (self *Stream) ReadBytes(buf []byte) (int, error)
- func (self *Stream) ReadBytesFrame() ([]byte, error)
- func (self *Stream) ReadBytesSize(size int) ([]byte, error)
- func (self *Stream) ReadFromConn(buf []byte) (int, error)
- func (self *Stream) ReadSize(size int) ([]byte, error)
- func (self *Stream) RemoteAddr() net.Addr
- func (self *Stream) SetDeadline(t time.Time) error
- func (self *Stream) SetReadDeadline(t time.Time) error
- func (self *Stream) SetWriteDeadline(t time.Time) error
- func (self *Stream) Write(b []byte) (int, error)
- func (self *Stream) WriteBytes(b []byte) error
- type StreamReaderBuffer
- type Subscriber
- type TextClientProtocol
- func (self *TextClientProtocol) ArgsToLockComandResult(args []string) (*protocol.LockResultCommand, error)
- func (self *TextClientProtocol) ArgsToLockComandResultParseId(argId string, lockId *[16]byte)
- func (self *TextClientProtocol) Close() error
- func (self *TextClientProtocol) GetParser() *protocol.TextParser
- func (self *TextClientProtocol) GetStream() *Stream
- func (self *TextClientProtocol) LocalAddr() net.Addr
- func (self *TextClientProtocol) Read() (protocol.CommandDecode, error)
- func (self *TextClientProtocol) ReadCommand() (protocol.CommandDecode, error)
- func (self *TextClientProtocol) RemoteAddr() net.Addr
- func (self *TextClientProtocol) Write(result protocol.CommandEncode) error
- func (self *TextClientProtocol) WriteCommand(result protocol.CommandEncode) error
- type TokenBucketFlow
- func (self *TokenBucketFlow) Acquire() (*protocol.LockResultCommand, error)
- func (self *TokenBucketFlow) GetExpriedFlag() uint16
- func (self *TokenBucketFlow) GetTimeoutFlag() uint16
- func (self *TokenBucketFlow) SetExpriedFlag(flag uint16) uint16
- func (self *TokenBucketFlow) SetTimeoutFlag(flag uint16) uint16
- type TreeLeafLock
- func (self *TreeLeafLock) GetLockId() [16]byte
- func (self *TreeLeafLock) GetLockKey() [16]byte
- func (self *TreeLeafLock) Lock() (*protocol.LockResultCommand, error)
- func (self *TreeLeafLock) Unlock() (*protocol.LockResultCommand, error)
- func (self *TreeLeafLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- type TreeLock
- func (self *TreeLock) GetLockKey() [16]byte
- func (self *TreeLock) GetParentKey() [16]byte
- func (self *TreeLock) LoadChild(lockKey [16]byte) *TreeLock
- func (self *TreeLock) LoadLeafLock(lockId [16]byte) *TreeLeafLock
- func (self *TreeLock) Lock() (*protocol.LockResultCommand, error)
- func (self *TreeLock) NewChild() *TreeLock
- func (self *TreeLock) NewLeafLock() *TreeLeafLock
- func (self *TreeLock) Unlock() (*protocol.LockResultCommand, error)
- func (self *TreeLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
- func (self *TreeLock) Wait(timeout uint32) (*protocol.LockResultCommand, error)
Constants ¶
View Source
const EVENT_MODE_DEFAULT_CLEAR = 1
View Source
const EVENT_MODE_DEFAULT_SET = 0
Variables ¶
View Source
var RootKey = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
View Source
var WaitTimeout = errors.New("timeout")
Functions ¶
This section is empty.
Types ¶
type BinaryClientProtocol ¶
type BinaryClientProtocol struct {
// contains filtered or unexported fields
}
func NewBinaryClientProtocol ¶
func NewBinaryClientProtocol(stream *Stream) *BinaryClientProtocol
func (*BinaryClientProtocol) Close ¶
func (self *BinaryClientProtocol) Close() error
func (*BinaryClientProtocol) GetStream ¶
func (self *BinaryClientProtocol) GetStream() *Stream
func (*BinaryClientProtocol) LocalAddr ¶
func (self *BinaryClientProtocol) LocalAddr() net.Addr
func (*BinaryClientProtocol) Read ¶
func (self *BinaryClientProtocol) Read() (protocol.CommandDecode, error)
func (*BinaryClientProtocol) ReadCommand ¶
func (self *BinaryClientProtocol) ReadCommand() (protocol.CommandDecode, error)
func (*BinaryClientProtocol) RemoteAddr ¶
func (self *BinaryClientProtocol) RemoteAddr() net.Addr
func (*BinaryClientProtocol) Write ¶
func (self *BinaryClientProtocol) Write(command protocol.CommandEncode) error
func (*BinaryClientProtocol) WriteCommand ¶
func (self *BinaryClientProtocol) WriteCommand(command protocol.CommandEncode) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CloseSubscribe ¶
func (self *Client) CloseSubscribe(s ISubscriber) error
func (*Client) ExecuteCommand ¶
func (*Client) GenRequestId ¶
func (*Client) GetDefaultExpriedFlag ¶
func (*Client) GetDefaultTimeoutFlag ¶
func (*Client) GroupEvent ¶
func (*Client) MaxConcurrentFlow ¶
func (*Client) SetDefaultExpriedFlag ¶
func (*Client) SetDefaultTimeoutFlag ¶
func (*Client) Subscribe ¶
func (self *Client) Subscribe(expried uint32, maxSize uint32) (ISubscriber, error)
func (*Client) SubscribeMask ¶
func (*Client) TokenBucketFlow ¶
func (*Client) Unavailable ¶
func (*Client) UpdateSubscribe ¶
func (self *Client) UpdateSubscribe(s ISubscriber) error
type ClientProtocol ¶
type ClientProtocol interface { Close() error Read() (protocol.CommandDecode, error) Write(protocol.CommandEncode) error ReadCommand() (protocol.CommandDecode, error) WriteCommand(protocol.CommandEncode) error GetStream() *Stream RemoteAddr() net.Addr LocalAddr() net.Addr }
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func (*Database) GenRequestId ¶
func (*Database) GetDefaultExpriedFlag ¶
func (*Database) GetDefaultTimeoutFlag ¶
func (*Database) GroupEvent ¶
func (*Database) ListLockLockeds ¶
func (*Database) ListLockWaits ¶
func (*Database) ListLocks ¶
func (self *Database) ListLocks(timeout int) (*protobuf.LockDBListLockResponse, error)
func (*Database) MaxConcurrentFlow ¶
func (*Database) SetDefaultExpriedFlag ¶
func (*Database) SetDefaultTimeoutFlag ¶
func (*Database) State ¶
func (self *Database) State() *protocol.StateResultCommand
func (*Database) TokenBucketFlow ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func NewDefaultClearEvent ¶
func NewDefaultSetEvent ¶
func (*Event) ClearWithUnsetData ¶
func (self *Event) ClearWithUnsetData() (*protocol.LockResultCommand, error)
func (*Event) GetEventKey ¶
func (*Event) GetExpried ¶
func (*Event) GetTimeout ¶
func (*Event) SetWithData ¶
func (self *Event) SetWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Event) WaitAndTimeoutRetryClear ¶
func (self *Event) WaitAndTimeoutRetryClear(timeout uint32) (*protocol.LockResultCommand, error)
type GroupEvent ¶
type GroupEvent struct {
// contains filtered or unexported fields
}
func NewGroupEvent ¶
func (*GroupEvent) Clear ¶
func (self *GroupEvent) Clear() (*protocol.LockResultCommand, error)
func (*GroupEvent) ClearWithUnsetData ¶
func (self *GroupEvent) ClearWithUnsetData() (*protocol.LockResultCommand, error)
func (*GroupEvent) GetClientId ¶
func (self *GroupEvent) GetClientId() uint64
func (*GroupEvent) GetExpried ¶
func (self *GroupEvent) GetExpried() uint32
func (*GroupEvent) GetGroupKey ¶
func (self *GroupEvent) GetGroupKey() [16]byte
func (*GroupEvent) GetTimeout ¶
func (self *GroupEvent) GetTimeout() uint32
func (*GroupEvent) GetVersionId ¶
func (self *GroupEvent) GetVersionId() uint64
func (*GroupEvent) IsSet ¶
func (self *GroupEvent) IsSet() (bool, error)
func (*GroupEvent) Set ¶
func (self *GroupEvent) Set() (*protocol.LockResultCommand, error)
func (*GroupEvent) SetWithData ¶
func (self *GroupEvent) SetWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*GroupEvent) Wait ¶
func (self *GroupEvent) Wait(timeout uint32) (*protocol.LockResultCommand, error)
func (*GroupEvent) WaitAndTimeoutRetryClear ¶
func (self *GroupEvent) WaitAndTimeoutRetryClear(timeout uint32) (*protocol.LockResultCommand, error)
func (*GroupEvent) Wakeup ¶
func (self *GroupEvent) Wakeup() (*protocol.LockResultCommand, error)
func (*GroupEvent) WakeupWithData ¶
func (self *GroupEvent) WakeupWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
type IClient ¶
type IClient interface { Open() error Close() error SelectDB(dbId uint8) *Database ExecuteCommand(command protocol.ICommand, timeout int) (protocol.ICommand, error) SendCommand(command protocol.ICommand) error Lock(lockKey [16]byte, timeout uint32, expried uint32) *Lock Event(eventKey [16]byte, timeout uint32, expried uint32, defaultSeted bool) *Event GroupEvent(groupKey [16]byte, clientId uint64, versionId uint64, timeout uint32, expried uint32) *GroupEvent Semaphore(semaphoreKey [16]byte, timeout uint32, expried uint32, count uint16) *Semaphore RWLock(lockKey [16]byte, timeout uint32, expried uint32) *RWLock RLock(lockKey [16]byte, timeout uint32, expried uint32) *RLock MaxConcurrentFlow(flowKey [16]byte, count uint16, timeout uint32, expried uint32) *MaxConcurrentFlow TokenBucketFlow(flowKey [16]byte, count uint16, timeout uint32, period float64) *TokenBucketFlow TreeLock(lockKey [16]byte, parentKey [16]byte, timeout uint32, expried uint32) *TreeLock Subscribe(expried uint32, maxSize uint32) (ISubscriber, error) SubscribeMask(lockKeyMask [16]byte, expried uint32, maxSize uint32) (ISubscriber, error) CloseSubscribe(subscriber ISubscriber) error UpdateSubscribe(subscriber ISubscriber) error GenRequestId() [16]byte SetDefaultTimeoutFlag(timeoutFlag uint16) SetDefaultExpriedFlag(expriedFlag uint16) GetDefaultTimeoutFlag() uint16 GetDefaultExpriedFlag() uint16 }
type ISubscriber ¶
type ISubscriber interface { Close() error Wait() (*protocol.LockResultCommand, error) Push(resultCommand *protocol.LockResultCommand) error }
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
func (*Lock) CancelWait ¶
func (self *Lock) CancelWait() (*protocol.LockResultCommand, error)
func (*Lock) GetExpried ¶
func (*Lock) GetExpriedFlag ¶
func (*Lock) GetLockKey ¶
func (*Lock) GetTimeout ¶
func (*Lock) GetTimeoutFlag ¶
func (*Lock) LockUpdate ¶
func (self *Lock) LockUpdate() (*protocol.LockResultCommand, error)
func (*Lock) LockUpdateWithData ¶
func (self *Lock) LockUpdateWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Lock) LockWithData ¶
func (self *Lock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Lock) SendLockWithData ¶
func (self *Lock) SendLockWithData(data *protocol.LockCommandData) error
func (*Lock) SendUnlock ¶
func (*Lock) SendUnlockWithData ¶
func (self *Lock) SendUnlockWithData(data *protocol.LockCommandData) error
func (*Lock) SetExpriedFlag ¶
func (*Lock) SetTimeoutFlag ¶
func (*Lock) UnlockHead ¶
func (self *Lock) UnlockHead() (*protocol.LockResultCommand, error)
func (*Lock) UnlockHeadRetoLockWait ¶
func (self *Lock) UnlockHeadRetoLockWait() (*protocol.LockResultCommand, error)
func (*Lock) UnlockHeadRetoLockWaitWithData ¶
func (self *Lock) UnlockHeadRetoLockWaitWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Lock) UnlockHeadWithData ¶
func (self *Lock) UnlockHeadWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Lock) UnlockRetoLockWait ¶
func (self *Lock) UnlockRetoLockWait() (*protocol.LockResultCommand, error)
func (*Lock) UnlockRetoLockWaitWithData ¶
func (self *Lock) UnlockRetoLockWaitWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*Lock) UnlockWithData ¶
func (self *Lock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
type LockError ¶
type LockError struct { Result uint8 CommandResult *protocol.LockResultCommand Err error }
func (*LockError) GetBytesData ¶
func (*LockError) GetLockData ¶
func (self *LockError) GetLockData() *protocol.LockResultCommandData
func (*LockError) GetStringData ¶
type MaxConcurrentFlow ¶
type MaxConcurrentFlow struct {
// contains filtered or unexported fields
}
func NewMaxConcurrentFlow ¶
func (*MaxConcurrentFlow) Acquire ¶
func (self *MaxConcurrentFlow) Acquire() (*protocol.LockResultCommand, error)
func (*MaxConcurrentFlow) GetExpriedFlag ¶
func (self *MaxConcurrentFlow) GetExpriedFlag() uint16
func (*MaxConcurrentFlow) GetTimeoutFlag ¶
func (self *MaxConcurrentFlow) GetTimeoutFlag() uint16
func (*MaxConcurrentFlow) Release ¶
func (self *MaxConcurrentFlow) Release() (*protocol.LockResultCommand, error)
func (*MaxConcurrentFlow) SetExpriedFlag ¶
func (self *MaxConcurrentFlow) SetExpriedFlag(flag uint16) uint16
func (*MaxConcurrentFlow) SetTimeoutFlag ¶
func (self *MaxConcurrentFlow) SetTimeoutFlag(flag uint16) uint16
type RLock ¶
type RLock struct {
// contains filtered or unexported fields
}
func (*RLock) GetExpried ¶
func (*RLock) GetLockKey ¶
func (*RLock) GetTimeout ¶
func (*RLock) LockWithData ¶
func (self *RLock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*RLock) UnlockWithData ¶
func (self *RLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
type RWLock ¶
type RWLock struct {
// contains filtered or unexported fields
}
func (*RWLock) GetExpried ¶
func (*RWLock) GetLockKey ¶
func (*RWLock) GetTimeout ¶
func (*RWLock) LockWithData ¶
func (self *RWLock) LockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*RWLock) RLockWithData ¶
func (self *RWLock) RLockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*RWLock) RUnlockWithData ¶
func (self *RWLock) RUnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
func (*RWLock) UnlockWithData ¶
func (self *RWLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
type ReplsetClient ¶
type ReplsetClient struct {
// contains filtered or unexported fields
}
func NewReplsetClient ¶
func NewReplsetClient(hosts []string) *ReplsetClient
func (*ReplsetClient) Close ¶
func (self *ReplsetClient) Close() error
func (*ReplsetClient) CloseSubscribe ¶
func (self *ReplsetClient) CloseSubscribe(s ISubscriber) error
func (*ReplsetClient) ExecuteCommand ¶
func (*ReplsetClient) GenRequestId ¶
func (self *ReplsetClient) GenRequestId() [16]byte
func (*ReplsetClient) GetClient ¶
func (self *ReplsetClient) GetClient() *Client
func (*ReplsetClient) GetDefaultExpriedFlag ¶
func (self *ReplsetClient) GetDefaultExpriedFlag() uint16
func (*ReplsetClient) GetDefaultTimeoutFlag ¶
func (self *ReplsetClient) GetDefaultTimeoutFlag() uint16
func (*ReplsetClient) GroupEvent ¶
func (self *ReplsetClient) GroupEvent(groupKey [16]byte, clientId uint64, versionId uint64, timeout uint32, expried uint32) *GroupEvent
func (*ReplsetClient) Lock ¶
func (self *ReplsetClient) Lock(lockKey [16]byte, timeout uint32, expried uint32) *Lock
func (*ReplsetClient) MaxConcurrentFlow ¶
func (self *ReplsetClient) MaxConcurrentFlow(flowKey [16]byte, count uint16, timeout uint32, expried uint32) *MaxConcurrentFlow
func (*ReplsetClient) Open ¶
func (self *ReplsetClient) Open() error
func (*ReplsetClient) RLock ¶
func (self *ReplsetClient) RLock(lockKey [16]byte, timeout uint32, expried uint32) *RLock
func (*ReplsetClient) RWLock ¶
func (self *ReplsetClient) RWLock(lockKey [16]byte, timeout uint32, expried uint32) *RWLock
func (*ReplsetClient) SelectDB ¶
func (self *ReplsetClient) SelectDB(dbId uint8) *Database
func (*ReplsetClient) SendCommand ¶
func (self *ReplsetClient) SendCommand(command protocol.ICommand) error
func (*ReplsetClient) SetDefaultExpriedFlag ¶
func (self *ReplsetClient) SetDefaultExpriedFlag(expriedFlag uint16)
func (*ReplsetClient) SetDefaultTimeoutFlag ¶
func (self *ReplsetClient) SetDefaultTimeoutFlag(timeoutFlag uint16)
func (*ReplsetClient) Subscribe ¶
func (self *ReplsetClient) Subscribe(expried uint32, maxSize uint32) (ISubscriber, error)
func (*ReplsetClient) SubscribeMask ¶
func (self *ReplsetClient) SubscribeMask(lockKeyMask [16]byte, expried uint32, maxSize uint32) (ISubscriber, error)
func (*ReplsetClient) TokenBucketFlow ¶
func (self *ReplsetClient) TokenBucketFlow(flowKey [16]byte, count uint16, timeout uint32, period float64) *TokenBucketFlow
func (*ReplsetClient) Unavailable ¶
func (self *ReplsetClient) Unavailable() chan bool
func (*ReplsetClient) UpdateSubscribe ¶
func (self *ReplsetClient) UpdateSubscribe(s ISubscriber) error
type ReplsetSubscriber ¶
type ReplsetSubscriber struct {
// contains filtered or unexported fields
}
func NewReplsetSubscriber ¶
func NewReplsetSubscriber(client *ReplsetClient, lockKeyMask [16]byte, expried uint32, maxSize uint32) *ReplsetSubscriber
func (*ReplsetSubscriber) Close ¶
func (self *ReplsetSubscriber) Close() error
func (*ReplsetSubscriber) Push ¶
func (self *ReplsetSubscriber) Push(resultCommand *protocol.LockResultCommand) error
func (*ReplsetSubscriber) Wait ¶
func (self *ReplsetSubscriber) Wait() (*protocol.LockResultCommand, error)
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
func NewSemaphore ¶
func (*Semaphore) GetExpried ¶
func (*Semaphore) GetSemaphoreKey ¶
func (*Semaphore) GetTimeout ¶
func (*Semaphore) ReleaseAll ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) ReadBytesFrame ¶
func (*Stream) RemoteAddr ¶
func (*Stream) WriteBytes ¶
type StreamReaderBuffer ¶
type StreamReaderBuffer struct {
// contains filtered or unexported fields
}
func NewStreamReaderBuffer ¶
func NewStreamReaderBuffer(size int) *StreamReaderBuffer
func (*StreamReaderBuffer) GetCapSize ¶
func (self *StreamReaderBuffer) GetCapSize() int
func (*StreamReaderBuffer) GetSize ¶
func (self *StreamReaderBuffer) GetSize() int
func (*StreamReaderBuffer) Read ¶
func (self *StreamReaderBuffer) Read(buf []byte) int
func (*StreamReaderBuffer) ReadBytesSize ¶
func (self *StreamReaderBuffer) ReadBytesSize(size int) []byte
func (*StreamReaderBuffer) ReadFromConn ¶
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func NewSubscriber ¶
func (*Subscriber) Close ¶
func (self *Subscriber) Close() error
func (*Subscriber) Push ¶
func (self *Subscriber) Push(resultCommand *protocol.LockResultCommand) error
func (*Subscriber) Wait ¶
func (self *Subscriber) Wait() (*protocol.LockResultCommand, error)
type TextClientProtocol ¶
type TextClientProtocol struct {
// contains filtered or unexported fields
}
func NewTextClientProtocol ¶
func NewTextClientProtocol(stream *Stream) *TextClientProtocol
func (*TextClientProtocol) ArgsToLockComandResult ¶
func (self *TextClientProtocol) ArgsToLockComandResult(args []string) (*protocol.LockResultCommand, error)
func (*TextClientProtocol) ArgsToLockComandResultParseId ¶
func (self *TextClientProtocol) ArgsToLockComandResultParseId(argId string, lockId *[16]byte)
func (*TextClientProtocol) Close ¶
func (self *TextClientProtocol) Close() error
func (*TextClientProtocol) GetParser ¶
func (self *TextClientProtocol) GetParser() *protocol.TextParser
func (*TextClientProtocol) GetStream ¶
func (self *TextClientProtocol) GetStream() *Stream
func (*TextClientProtocol) LocalAddr ¶
func (self *TextClientProtocol) LocalAddr() net.Addr
func (*TextClientProtocol) Read ¶
func (self *TextClientProtocol) Read() (protocol.CommandDecode, error)
func (*TextClientProtocol) ReadCommand ¶
func (self *TextClientProtocol) ReadCommand() (protocol.CommandDecode, error)
func (*TextClientProtocol) RemoteAddr ¶
func (self *TextClientProtocol) RemoteAddr() net.Addr
func (*TextClientProtocol) Write ¶
func (self *TextClientProtocol) Write(result protocol.CommandEncode) error
func (*TextClientProtocol) WriteCommand ¶
func (self *TextClientProtocol) WriteCommand(result protocol.CommandEncode) error
type TokenBucketFlow ¶
type TokenBucketFlow struct {
// contains filtered or unexported fields
}
func NewTokenBucketFlow ¶
func (*TokenBucketFlow) Acquire ¶
func (self *TokenBucketFlow) Acquire() (*protocol.LockResultCommand, error)
func (*TokenBucketFlow) GetExpriedFlag ¶
func (self *TokenBucketFlow) GetExpriedFlag() uint16
func (*TokenBucketFlow) GetTimeoutFlag ¶
func (self *TokenBucketFlow) GetTimeoutFlag() uint16
func (*TokenBucketFlow) SetExpriedFlag ¶
func (self *TokenBucketFlow) SetExpriedFlag(flag uint16) uint16
func (*TokenBucketFlow) SetTimeoutFlag ¶
func (self *TokenBucketFlow) SetTimeoutFlag(flag uint16) uint16
type TreeLeafLock ¶
type TreeLeafLock struct {
// contains filtered or unexported fields
}
func (*TreeLeafLock) GetLockId ¶
func (self *TreeLeafLock) GetLockId() [16]byte
func (*TreeLeafLock) GetLockKey ¶
func (self *TreeLeafLock) GetLockKey() [16]byte
func (*TreeLeafLock) Lock ¶
func (self *TreeLeafLock) Lock() (*protocol.LockResultCommand, error)
func (*TreeLeafLock) Unlock ¶
func (self *TreeLeafLock) Unlock() (*protocol.LockResultCommand, error)
func (*TreeLeafLock) UnlockWithData ¶
func (self *TreeLeafLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
type TreeLock ¶
type TreeLock struct {
// contains filtered or unexported fields
}
func NewTreeLock ¶
func (*TreeLock) GetLockKey ¶
func (*TreeLock) GetParentKey ¶
func (*TreeLock) LoadLeafLock ¶
func (self *TreeLock) LoadLeafLock(lockId [16]byte) *TreeLeafLock
func (*TreeLock) NewLeafLock ¶
func (self *TreeLock) NewLeafLock() *TreeLeafLock
func (*TreeLock) UnlockWithData ¶
func (self *TreeLock) UnlockWithData(data *protocol.LockCommandData) (*protocol.LockResultCommand, error)
Click to show internal directories.
Click to hide internal directories.