Documentation ¶
Overview ¶
Package whoson is a generated protocol buffer package.
It is generated from these files:
whoson/sync.proto
It has these top-level messages:
WSRequest WSResponse WSDumpRequest WSDumpResponse
Index ¶
- Constants
- Variables
- func InitLog(output, loglevel string) error
- func ListenAndServe(proto string, addr string) error
- func Log(status, msg string, ses *Session, err error)
- func NewIDGenerator(workerID uint) error
- func NewLogger(output, loglevel string) error
- func NewMainStore()
- func NewMainStoreEnableSyncRemote()
- func RegisterSyncServer(s *grpc.Server, srv SyncServer)
- func RunExpireChecker(ctx context.Context)
- func RunSyncRemote(ctx context.Context, hosts []string)
- func ServeTCP(l *net.TCPListener) error
- func ServeUDP(c *net.UDPConn) error
- type Buffer
- type BufferPool
- type Client
- type ClientConfig
- type MemStore
- func (ms MemStore) Count() int
- func (ms MemStore) Del(k string) bool
- func (ms MemStore) Get(k string) (*StoreData, error)
- func (ms MemStore) Items() map[string]interface{}
- func (ms MemStore) ItemsJSON() ([]byte, error)
- func (ms MemStore) Set(k string, w *StoreData)
- func (ms MemStore) SyncDel(k string) bool
- func (ms MemStore) SyncSet(k string, w *StoreData)
- type MethodType
- type ProtocolType
- type Response
- type ResultType
- type ServerConfig
- type ServerCtl
- type ServerCtlConfig
- type Session
- type Store
- type StoreData
- type Sync
- type SyncClient
- type SyncServer
- type TCPServer
- type UDPServer
- type WSDumpRequest
- type WSDumpResponse
- type WSRequest
- type WSResponse
- type Worker
Constants ¶
Variables ¶
var ( // MainStore holds main store. MainStore Store // Logger halds logging. Logger *zap.Logger // LogWriter is IO Writer. LogWriter reopen.Writer // IDGenerator halds id generator. IDGenerator *katsubushi.Generator // ExpvarMap halds expvar map. ExpvarMap = expvar.NewMap("gowhoson") )
Functions ¶
func ListenAndServe ¶
ListenAndServe simple start whoson server TCP or UDP.
func NewIDGenerator ¶
NewIDGenerator is set id generator to IDGenerator.
func NewMainStoreEnableSyncRemote ¶
func NewMainStoreEnableSyncRemote()
NewMainStoreEnableSyncRemote set MemStore to MainStore, enable sync remote.
func RegisterSyncServer ¶
func RegisterSyncServer(s *grpc.Server, srv SyncServer)
func RunExpireChecker ¶
RunExpireChecker Check expire for all cmap store data.
func RunSyncRemote ¶
RunSyncRemote is sync data to remote grpc servers.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer hold information for buffer pool.
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool hold information for sync.Pool.
func NewBufferPool ¶
func NewBufferPool() *BufferPool
NewBufferPool return new BufferPool struct pointer.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client hold information for whoson API client.
type ClientConfig ¶
ClientConfig hold information for client configration.
type MemStore ¶
MemStore hold information for cmap.
type Response ¶
type Response struct { Msg string // contains filtered or unexported fields }
Response hold information for response values.
type ServerConfig ¶
type ServerConfig struct { TCP string UDP string Log string Loglevel string ServerID int Expvar bool ControlPort string SyncRemote string SaveFile string }
ServerConfig hold information for server configration.
type ServerCtl ¶
type ServerCtl struct {
// contains filtered or unexported fields
}
ServerCtl hold information for server control.
func NewServerCtl ¶
NewServerCtl return new ServerCtl struct pointer.
func (*ServerCtl) WriteTable ¶
WriteTable Output Table with io.Writer
type ServerCtlConfig ¶
ServerCtlConfig hold information for serverctl configration.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session hold information for whoson session.
func NewSessionTCP ¶
NewSessionTCP return new Session struct pointer for TCP.
type Store ¶
type Store interface { Set(k string, w *StoreData) Get(k string) (*StoreData, error) Del(k string) bool Items() map[string]interface{} ItemsJSON() ([]byte, error) Count() int SyncSet(k string, w *StoreData) SyncDel(k string) bool }
Store is hold Store API.
type StoreData ¶
StoreData hold information for whoson data.
func (*StoreData) UpdateExpire ¶
func (sd *StoreData) UpdateExpire()
UpdateExpire Update stored data of expire time.
type Sync ¶
type Sync struct{}
Sync hold information for synchronization.
func (*Sync) Dump ¶
func (s *Sync) Dump(c context.Context, wreq *WSDumpRequest) (*WSDumpResponse, error)
Dump dump to all data
type SyncClient ¶
type SyncClient interface { Set(ctx context.Context, in *WSRequest, opts ...grpc.CallOption) (*WSResponse, error) Del(ctx context.Context, in *WSRequest, opts ...grpc.CallOption) (*WSResponse, error) Dump(ctx context.Context, in *WSDumpRequest, opts ...grpc.CallOption) (*WSDumpResponse, error) }
func NewSyncClient ¶
func NewSyncClient(cc *grpc.ClientConn) SyncClient
type SyncServer ¶
type SyncServer interface { Set(context.Context, *WSRequest) (*WSResponse, error) Del(context.Context, *WSRequest) (*WSResponse, error) Dump(context.Context, *WSDumpRequest) (*WSDumpResponse, error) }
type TCPServer ¶
type TCPServer struct { Addr string // contains filtered or unexported fields }
TCPServer hold information for tcp server.
func NewTCPServer ¶
func NewTCPServer() *TCPServer
NewTCPServer return new TCPServer struct pointer.
func (*TCPServer) ListenAndServe ¶
ListenAndServe simple start tcp server.
type UDPServer ¶
type UDPServer struct { Addr string // contains filtered or unexported fields }
UDPServer hold information for udp server.
func NewUDPServer ¶
func NewUDPServer() *UDPServer
NewUDPServer return new UDPServer struct pointer.
func (*UDPServer) ListenAndServe ¶
ListenAndServe simple start udp server.
type WSDumpRequest ¶
type WSDumpRequest struct { }
func (*WSDumpRequest) Descriptor ¶
func (*WSDumpRequest) Descriptor() ([]byte, []int)
func (*WSDumpRequest) ProtoMessage ¶
func (*WSDumpRequest) ProtoMessage()
func (*WSDumpRequest) Reset ¶
func (m *WSDumpRequest) Reset()
func (*WSDumpRequest) String ¶
func (m *WSDumpRequest) String() string
type WSDumpResponse ¶
type WSDumpResponse struct { Rcode int32 `protobuf:"varint,1,opt,name=Rcode" json:"Rcode,omitempty"` Msg string `protobuf:"bytes,2,opt,name=Msg" json:"Msg,omitempty"` Json []byte `protobuf:"bytes,3,opt,name=Json,proto3" json:"Json,omitempty"` }
func (*WSDumpResponse) Descriptor ¶
func (*WSDumpResponse) Descriptor() ([]byte, []int)
func (*WSDumpResponse) ProtoMessage ¶
func (*WSDumpResponse) ProtoMessage()
func (*WSDumpResponse) Reset ¶
func (m *WSDumpResponse) Reset()
func (*WSDumpResponse) String ¶
func (m *WSDumpResponse) String() string
type WSRequest ¶
type WSRequest struct { Expire int64 `protobuf:"varint,1,opt,name=Expire" json:"Expire,omitempty"` IP string `protobuf:"bytes,2,opt,name=IP" json:"IP,omitempty"` Data string `protobuf:"bytes,3,opt,name=Data" json:"Data,omitempty"` Method string `protobuf:"bytes,4,opt,name=Method" json:"Method,omitempty"` }
func (*WSRequest) Descriptor ¶
func (*WSRequest) ProtoMessage ¶
func (*WSRequest) ProtoMessage()
type WSResponse ¶
type WSResponse struct { Rcode int32 `protobuf:"varint,1,opt,name=Rcode" json:"Rcode,omitempty"` Msg string `protobuf:"bytes,2,opt,name=Msg" json:"Msg,omitempty"` }
func (*WSResponse) Descriptor ¶
func (*WSResponse) Descriptor() ([]byte, []int)
func (*WSResponse) ProtoMessage ¶
func (*WSResponse) ProtoMessage()
func (*WSResponse) Reset ¶
func (m *WSResponse) Reset()
func (*WSResponse) String ¶
func (m *WSResponse) String() string