Documentation ¶
Index ¶
- Constants
- type HTTPServer
- type Options
- type Server
- type TCPClient
- func (tc *TCPClient) Close() (err error)
- func (tc *TCPClient) Delete(key string) error
- func (tc *TCPClient) Get(key string) ([]byte, error)
- func (tc *TCPClient) Nodes() ([]string, error)
- func (tc *TCPClient) Set(key string, value []byte, ttl int64) error
- func (tc *TCPClient) Status() (*caches.Status, error)
- type TCPServer
Constants ¶
View Source
const (
// APIVersion is the version of serving APIs.
APIVersion = "v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is a http type server.
func NewHTTPServer ¶
func NewHTTPServer(cache *caches.Cache, options *Options) (*HTTPServer, error)
NewHTTPServer returns a http server holder.
func (*HTTPServer) Run ¶
func (hs *HTTPServer) Run() error
Run runs the server and returns an error if something wrong.
type Options ¶
type Options struct { // Address is the address used to listen. Address string // Port is the port used to listen. Port int // ServerType is the type of server. ServerType string // VirtualNodeCount is the number of virtual nodes, which is set to consistent hash. VirtualNodeCount int // UpdateCircleDuration is the duration between two circle updating operations. // The unit is second. UpdateCircleDuration int // cluster is all nodes in cluster that will be joined. Cluster []string }
Options is the options of servers.
type Server ¶
type Server interface { // Run runs a server and returns ann error if something wrong. Run() error }
Server is an interface of servers.
type TCPClient ¶
type TCPClient struct {
// contains filtered or unexported fields
}
TCPClient is a tcp client for tcp server.
func NewTCPClient ¶
NewTCPClient returns a tcp client holder connected to address. Returns an error if failed.
Click to show internal directories.
Click to hide internal directories.