Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultNamespace is default namespace of DB
DefaultNamespace = "default"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientFlag ¶
type ClientFlag int
const ( ClientNone ClientFlag = 0 // This client is a slave monitor ClientMonitor ClientFlag = 1 << iota )
type ClientType ¶
type ClientType int
const ( ClientNormal ClientType = iota // 0 ClientTypeMax )
func GetClientTypeByName ¶
func GetClientTypeByName(str string) ClientType
type CodecContext ¶
type CodecContext struct {
Conn net.Conn
ID int64
DB *storage.DB
StartTime time.Time
CloseChan chan struct{}
Authenticated bool
Reader *bufio.Reader
TotalBytes *int64
TotalArgvLen int64
ArgvMem int64
Fd int // set -1 if get fd of conn failed
Name string
LastCmdTime time.Time
LastArgvLen int64
LastCmd string
RespVer int // only support 2 currently
Flag ClientFlag // only support ClientNone currently
Type ClientType // only support ClientNormal currently
QueLimit int64
QueNum *atomic.Int64
}
CodecContext completes interface of OBKV RPC Server
func NewCodecCtx ¶
NewCodecCtx creates a new client context
type ReadCounter ¶
type ReadCounter struct {
TotalBytes int64
// contains filtered or unexported fields
}
ReadCounter record totoal bytes read from reader
type ServerContext ¶
type ServerContext struct {
Storage storage.Storage
StartTime time.Time
Password string
DbNum int64
SuperMode SupervisedMode
RunID string
Port int
ModisPath string
ConfigPath string
ClientNum int
MaxClientNum int
TotalClientNum int64
RejectClientNum int64
Backend string
// [cliend id, CodecContext], record all clients
Clients map[int64]*CodecContext
// [cliend id, CodecContext], record clients with monitor
Monitors map[int64]*CodecContext
// atomic, include all clients
TotalCmdNum *metrics.Metrics
TotalReadBytes *metrics.Metrics
TotalWriteBytes *metrics.Metrics
ClientsPeakMemInput int64
ClientsPeakMemOutput int64
// contains filtered or unexported fields
}
ServerContext connect server and clients
func NewServerContext ¶
func NewServerContext(s storage.Storage, cfg *config.Config, cfgPath string) (*ServerContext, error)
NewServerContext creates a new client context
func (*ServerContext) GetDB ¶
func (sc *ServerContext) GetDB(index int64) (*storage.DB, error)
GetDB prevents visit db out of range
func (*ServerContext) IsDBInit ¶
func (sc *ServerContext) IsDBInit(index int64) bool
func (*ServerContext) StartMetricsTicker ¶
func (sc *ServerContext) StartMetricsTicker()
type SupervisedMode ¶
type SupervisedMode int
const ( SupervisedNone SupervisedMode = iota // 0 SupervisedUnknown // 1 SupervisedSystemd // 2 SupervisedUpstart // 3 )
Click to show internal directories.
Click to hide internal directories.