Documentation ¶
Index ¶
- type Client
- type CmdTask
- type DataStorage
- func (d *DataStorage) Del(key string)
- func (d *DataStorage) Freeze() error
- func (d *DataStorage) Get(key string) interface{}
- func (d *DataStorage) GetOrigin() map[string]*Item
- func (d *DataStorage) Idx() int
- func (d *DataStorage) Set(key string, value interface{}, expire int64) interface{}
- func (d *DataStorage) ToMove() error
- type Item
- type ModTask
- type MultiInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Conn net.Conn // database index selected Data *DataStorage // transaction info Multi *MultiInfo // collect stat Stat bool }
Client entity: client information stored
func NewClient ¶
func NewClient(conn net.Conn, dataStorage *DataStorage) *Client
NewClient returns a client selecting database 0, transaction state false
type CmdTask ¶
CmdTask is the structure hold by the channel which sends task to execute command from server client managers to processor.
type DataStorage ¶
type DataStorage struct {
// contains filtered or unexported fields
}
DataStorage stores key-value data, expiration control heap, watched key-client map
func NewDataArray ¶
func NewDataArray(n int) []*DataStorage
func NewDataStorage ¶
func NewDataStorage() *DataStorage
NewDataStorage returns data storage entity with default constructor
func (*DataStorage) Del ¶
func (d *DataStorage) Del(key string)
Del deletes the value of correspond key
func (*DataStorage) Freeze ¶
func (d *DataStorage) Freeze() error
Freeze and following logic ensure the origin data won't change until "ToMove"
func (*DataStorage) Get ¶
func (d *DataStorage) Get(key string) interface{}
Get returns the value of correspond key
func (*DataStorage) GetOrigin ¶
func (d *DataStorage) GetOrigin() map[string]*Item
GetOrigin returns the original data of the data storage.
func (*DataStorage) Idx ¶
func (d *DataStorage) Idx() int
Idx returns the index position in the data array
func (*DataStorage) Set ¶
func (d *DataStorage) Set(key string, value interface{}, expire int64) interface{}
Set puts the new value of key
func (*DataStorage) ToMove ¶
func (d *DataStorage) ToMove() error
ToMove notifies data storage to move items from new data to old data
type Item ¶
type Item struct { Row interface{} Expire int64 // contains filtered or unexported fields }
Item is key-value pair stored in model