Documentation ¶
Index ¶
- Constants
- Variables
- func WithCancel(parent *Context) (*Context, CancelFunc)
- func WithDeadline(parent *Context, d time.Time) (*Context, CancelFunc)
- func WithTimeout(parent *Context, timeout time.Duration) (*Context, CancelFunc)
- type CancelFunc
- type ClientContext
- type Command
- type Context
- type ServerContext
Constants ¶
View Source
const (
// DefaultNamespace default namespce
DefaultNamespace = "default"
)
Variables ¶
View Source
var ( ReleaseVersion = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" GitLog = "None" GolangVersion = "None" ConfigFile = "None" )
Version information.
Functions ¶
func WithCancel ¶
func WithCancel(parent *Context) (*Context, CancelFunc)
WithCancel returns a copy of parent with a new Done channel
func WithDeadline ¶
func WithDeadline(parent *Context, d time.Time) (*Context, CancelFunc)
WithDeadline returns a copy of the parent context with the deadline adjusted to be no later than d
func WithTimeout ¶
func WithTimeout(parent *Context, timeout time.Duration) (*Context, CancelFunc)
WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
Types ¶
type CancelFunc ¶
type CancelFunc context.CancelFunc
CancelFunc tells an operation to abandon its work
type ClientContext ¶
type ClientContext struct { DB *db.DB Authenticated bool // Client has be authenticated Namespace string // Namespace of database RemoteAddr string // Client remote address ID int64 // Client uniq ID Name string // Name is set by client setname Created time.Time Updated time.Time LastCmd string SkipN int // Skip N following commands, (-1 for skipping all commands) Close func() error // When client is in multi...exec block, the Txn is assigned and Multi is set to be true // Before exec, all command called will be queued in Commands Txn *db.Transaction // Txn is set when client is in transaction which is triggered by watch command Multi bool Commands []*Command Done chan struct{} }
ClientContext is the runtime context of a client
func NewClientContext ¶
func NewClientContext(id int64, conn net.Conn) *ClientContext
NewClientContext new client context object ,id must be uniq
type Context ¶
type Context struct { context.Context Client *ClientContext Server *ServerContext }
Context combines the client and server context
Click to show internal directories.
Click to hide internal directories.