Documentation
¶
Index ¶
- func GetLocalIP() string
- func UDPRequest(addr string, timeout time.Duration) (response *protocol.AmAlive, err error)
- type CASOperation
- type Conn
- func (c *Conn) AddServerToGroup(addr string) error
- func (c *Conn) CAS(key []byte, value []byte, timeout time.Duration) CASOperation
- func (c *Conn) Close()
- func (c *Conn) Del(key []byte, value []byte, timeout time.Duration) DelOperation
- func (c *Conn) Get(key []byte, timeout time.Duration) GetOperation
- func (c *Conn) GetAccessInfo() ([]byte, error)
- func (c *Conn) GetChunkInfo(chunkID int) (size uint64, err error)
- func (c *Conn) Protect(chunkID int) error
- func (c *Conn) Set(key []byte, value []byte, timeout time.Duration) SetOperation
- func (c *Conn) SetBuffered()
- func (c *Conn) SetNoDelay()
- func (c *Conn) Transfer(addr string, chunkID int) error
- type DelOperation
- type GetOperation
- type Server
- type SetOperation
- type TCPCallback
- type UDPCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CASOperation ¶
type CASOperation struct {
// contains filtered or unexported fields
}
func (*CASOperation) Wait ¶
func (g *CASOperation) Wait() error
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn provides an interface to a possible buffered DB TCP client connection
func CreateConnection ¶
CreateConnection returns a new Conn
func (*Conn) AddServerToGroup ¶
AddServerToGroup request to add this server to the server group
func (*Conn) Get ¶
func (c *Conn) Get(key []byte, timeout time.Duration) GetOperation
Get the value of key
func (*Conn) GetAccessInfo ¶
GetAccessInfo request DB access info
func (*Conn) GetChunkInfo ¶
GetChunkInfo request chunk info
func (*Conn) SetBuffered ¶
func (c *Conn) SetBuffered()
func (*Conn) SetNoDelay ¶
func (c *Conn) SetNoDelay()
type DelOperation ¶
type DelOperation struct {
// contains filtered or unexported fields
}
func (*DelOperation) Wait ¶
func (g *DelOperation) Wait() error
type GetOperation ¶
type GetOperation struct {
// contains filtered or unexported fields
}
func (*GetOperation) Wait ¶
func (g *GetOperation) Wait() result
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listen to TCP & UDP, accepting connections and responding to clients using callback functions
func Start ¶
func Start(localIP string, localPort int, tcpCallback func(protocol.Message) (response protocol.Message), udpCallback UDPCallback) *Server
Start a Treeless server
type SetOperation ¶
type SetOperation struct {
// contains filtered or unexported fields
}
func (*SetOperation) Wait ¶
func (g *SetOperation) Wait() error
type TCPCallback ¶
TCPCallback is the main callback, it returns a response message, if the response message type is 0 the response will be dropped
type UDPCallback ¶
UDPCallback function should respond to incoming UDP pings
Click to show internal directories.
Click to hide internal directories.