Documentation ¶
Index ¶
- Constants
- Variables
- func Dump(id uint64) (t time.Time, workerID uint64, sequense uint64)
- func SetLogLevel(str string) error
- func StdLogger() *stdlog.Logger
- func ToID(t time.Time) uint64
- func ToTime(id uint64) time.Time
- type App
- func (app *App) BytesToBinaryCmd(req bRequest) (cmd MemdCmd, err error)
- func (app *App) BytesToCmd(data []byte) (cmd MemdCmd, err error)
- func (app *App) GetStats() MemdStats
- func (app *App) IsBinaryProtocol(r *bufio.Reader) (bool, error)
- func (app *App) Listen(ctx context.Context, l net.Listener) error
- func (app *App) ListenSock(ctx context.Context, sockpath string) error
- func (app *App) ListenTCP(ctx context.Context, addr string) error
- func (app *App) NextID() (uint64, error)
- func (app *App) Ready() chan interface{}
- func (app *App) RespondToBinary(r io.Reader, conn net.Conn)
- type Client
- type Generator
- type ListenFunc
- type MemdBCmdGet
- type MemdBCmdVersion
- type MemdCmd
- type MemdCmdGet
- type MemdCmdQuit
- type MemdCmdStats
- type MemdCmdVersion
- type MemdStats
- type MemdValue
- type Option
Constants ¶
const ( WorkerIDBits = 10 SequenceBits = 12 )
for bitshift
Variables ¶
var ( // DefaultIdleTimeout is the default idle timeout. DefaultIdleTimeout = 600 * time.Second // InfiniteIdleTimeout means that idle timeout is disabled. InfiniteIdleTimeout = time.Duration(0) )
var ( ErrInvalidWorkerID = errors.New("invalid worker id") ErrDuplicatedWorkerID = errors.New("duplicated worker") )
errors
var Epoch = time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)
Epoch is katsubushi epoch time (2015-01-01 00:00:00 UTC) Generated ID includes elapsed time from Epoch.
var (
// Version number
Version = "development"
)
Functions ¶
func SetLogLevel ¶
SetLogLevel sets log level. Log level must be one of debug, info, warning, error, fatal and panic.
Types ¶
type App ¶
App is main struct of the Application.
func (*App) BytesToBinaryCmd ¶ added in v1.5.0
BytesToCmd converts byte array to a MemdBCmd and returns it.
func (*App) BytesToCmd ¶
BytesToCmd converts byte array to a MemdCmd and returns it.
func (*App) IsBinaryProtocol ¶ added in v1.5.0
IsBinaryProtocol judges whether a protocol is binary or text
func (*App) ListenSock ¶
ListenSock starts listen Unix Domain Socket on sockpath.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is katsubushi client
type Generator ¶
type Generator struct { WorkerID uint // contains filtered or unexported fields }
Generator is generater for unique ID.
func NewGenerator ¶
NewGenerator returns new generator.
type ListenFunc ¶
ListenFunc is the type for listeners.
type MemdBCmdGet ¶ added in v1.5.0
MemdCmdGet defines binary Get command.
type MemdBCmdVersion ¶ added in v1.5.0
type MemdBCmdVersion struct {
Opaque [4]byte
}
MemdBCmdVersion defines binary VERSION command.
type MemdCmdGet ¶
MemdCmdGet defines Get command.
type MemdStats ¶
type MemdStats struct { Pid int `memd:"pid"` Uptime int64 `memd:"uptime"` Time int64 `memd:"time"` Version string `memd:"version"` CurrConnections int64 `memd:"curr_connections"` TotalConnections int64 `memd:"total_connections"` CmdGet int64 `memd:"cmd_get"` GetHits int64 `memd:"get_hits"` GetMisses int64 `memd:"get_misses"` }
MemdStats defines result of STATS command.