Documentation ¶
Index ¶
- Constants
- Variables
- func CatAppendOnlyGenericCommand(buf string, argv []*RedisObject) string
- func ConnectWithMaster() int
- func Cron()
- func GetCommandMessage(ss []*RedisObject) []string
- func IsSdsRepresentableAsLongLong(s string) int
- func ParseProtocol()
- func ProtocolArr(messages []string) string
- func ProtocolArrNull() string
- func ProtocolInt(message int) string
- func ProtocolLine(message string) string
- func ProtocolLineErr(message string) string
- func ProtocolMultiLine(messages []string) string
- func ProtocolNull() string
- func ReplicationCron()
- func S2Int(s string) int
- func ServerCron()
- func StartLoading(file *os.File)
- func SyncWithMaster()
- func Test()
- type Aof
- func (a *Aof) Close()
- func (a *Aof) Create()
- func (a *Aof) Load(cl *Client)
- func (a *Aof) LoadAppendOnlyFile(filename string) int
- func (a *Aof) LoadFile(f *os.File, cl *Client) (int, bool)
- func (a *Aof) ParseMultiBulkLen(cl *Client) bool
- func (a *Aof) ParseStart(cl *Client) bool
- func (a *Aof) Write(content string)
- type Client
- func (cl *Client) AddReply(message string)
- func (cl *Client) AddReplyBulk(object *RedisObject)
- func (cl *Client) AddReplyBulkLen(object *RedisObject)
- func (cl *Client) AddReplyError(message string)
- func (cl *Client) AddReplyErrorFormat(args []string, messages ...string)
- func (cl *Client) AddReplyHelp(help []string)
- func (cl *Client) AddReplyLongLong(s int)
- func (cl *Client) AddReplyRedisObject(object *RedisObject)
- func (cl *Client) AddReplySubcommandSyntaxError()
- func (cl *Client) Free()
- func (cl *Client) FreeFakeClient()
- func (cl *Client) GetArgvByIndex(i int) string
- func (cl *Client) LookupKeyReadOrReply(key *RedisObject, reply *RedisObject) *RedisObject
- func (cl *Client) ParseCommand() bool
- func (cl *Client) SelectDb(id int) int
- type ClusterNode
- type ClusterState
- type Dict
- type Pending
- type PubSubPattern
- type Rdb
- type RedisCommand
- type RedisDb
- func (rb *RedisDb) Add(key *RedisObject, value *RedisObject)
- func (rb *RedisDb) LookupKey(key *RedisObject, flags int) *RedisObject
- func (rb *RedisDb) LookupKeyRead(key *RedisObject) *RedisObject
- func (rb *RedisDb) LookupKeyReadWithFlags(key *RedisObject, flags int) *RedisObject
- func (rb RedisDb) LookupKeyWrite(key *RedisObject) *RedisObject
- type RedisObject
- func CreateHashRedisObject() *RedisObject
- func CreateIntSetObject() *RedisObject
- func CreateQuickListObject() *RedisObject
- func CreateSetObject() *RedisObject
- func NewRedisObject(typeFlag int, ptr interface{}) *RedisObject
- func NewStringRedisObject(s string) *RedisObject
- func SetTypeCreate(s string) *RedisObject
- type ReplicationMain
- type ReplicationReplica
- type Server
Constants ¶
View Source
const ( ObjEncodingRaw = iota // raw ObjEncodingInt = iota // int ObjEncodingHt = iota //hash ObjEncodingZipMap = iota // zipmap ObjEncodingLinkedList = iota // No longer used: old list encoding ObjEncodingZipList = iota // ziplist ObjEncodingIntSet = iota // intset ObjEncodingSkipList = iota // skiplist ObjEncodingEmbStr = iota // Embedded sds string encoding ObjEncodingQuickList = iota // linked list of ziplists ObjEncodingStream = iota // radix tree of listpacks )
View Source
const ( ObjString = iota ObjList = iota ObjSet = iota ObjZSet = iota ObjHash = iota ObjModule = iota ObjStream = iota )
View Source
const ( AofOff = 0 AofOn = 1 )
View Source
const CErr = 0
View Source
const COk = 1
View Source
const CRLF = "\r\n"
View Source
const ClientSlave = 1 << 0
View Source
const LongStrSize = 21 /* Bytes needed for long -> str + '\0' */
View Source
const LookupNone = 0
View Source
const ProtoInlineMaxSize = 1024 * 64 /* Max size of inline reads */
View Source
const ProtoIoBufLen = 1024 /* Generic I/O buffer size */
View Source
const ProtoMBulkBigArg = 1024 * 32
View Source
const ProtoMaxQueryBufLen = 1024 * 1024 * 1024 /* 1GB max query buffer. */
View Source
const ProtoReplyChunkBytes = 16 * 1024 /* 16k output buffer */
const ProtoIoBufLen = 1024 * 16 /* Generic I/O buffer size */
View Source
const REPL_STATE_CONNECT = 1
View Source
const REPL_STATE_CONNECTED = 15
View Source
const REPL_STATE_CONNECTING = 2
View Source
const REPL_STATE_NONE = 0
View Source
const REPL_STATE_TRANSFER = 14
View Source
const RedisAutoSyncBytes = 1024 * 1024 * 32 /* fdatasync every 32MB */
View Source
const RedisVersion = "5.0.5"
Variables ¶
View Source
var CommandGroups = [...]string{
"generic",
"string",
"list",
"set",
"sorted_set",
"hash",
"pubsub",
"transactions",
"connection",
"server",
"scripting",
"hyperloglog",
"cluster",
"geo",
"stream",
}
Functions ¶
func CatAppendOnlyGenericCommand ¶
func CatAppendOnlyGenericCommand(buf string, argv []*RedisObject) string
func ConnectWithMaster ¶
func ConnectWithMaster() int
func GetCommandMessage ¶
func GetCommandMessage(ss []*RedisObject) []string
func ParseProtocol ¶
func ParseProtocol()
func ProtocolMultiLine ¶
多行字符串,多行字符串用于表示长度最大为512 MB的单个二进制安全字符串。
func ReplicationCron ¶
func ReplicationCron()
func ServerCron ¶
func ServerCron()
func StartLoading ¶
func SyncWithMaster ¶
func SyncWithMaster()
Types ¶
type Client ¶
type Client struct { Conn net.Conn Index int Name string Log log.ILog Db *RedisDb QueryBuf []byte Query string Argv []*RedisObject LastInteraction string ReqType int // 协议类型 MultiBulkLen int QbPos int BulkLen int Cmd *RedisCommand LastCmd *RedisCommand Pending chan *Pending Flags int PubSubChannel map[string]bool }
func CreateFakeClient ¶
func CreateFakeClient() *Client
func (*Client) AddReplyBulk ¶
func (cl *Client) AddReplyBulk(object *RedisObject)
func (*Client) AddReplyBulkLen ¶
func (cl *Client) AddReplyBulkLen(object *RedisObject)
func (*Client) AddReplyError ¶
func (*Client) AddReplyErrorFormat ¶
func (*Client) AddReplyHelp ¶
func (*Client) AddReplyLongLong ¶
func (*Client) AddReplyRedisObject ¶
func (cl *Client) AddReplyRedisObject(object *RedisObject)
func (*Client) AddReplySubcommandSyntaxError ¶
func (cl *Client) AddReplySubcommandSyntaxError()
func (*Client) FreeFakeClient ¶
func (cl *Client) FreeFakeClient()
func (*Client) GetArgvByIndex ¶
func (*Client) LookupKeyReadOrReply ¶
func (cl *Client) LookupKeyReadOrReply(key *RedisObject, reply *RedisObject) *RedisObject
func (*Client) ParseCommand ¶
type ClusterNode ¶
type ClusterNode struct { }
type ClusterState ¶
type ClusterState struct { }
type Dict ¶
type Dict struct {
Storage map[string]*RedisObject
}
func (*Dict) Add ¶
func (d *Dict) Add(key *RedisObject, value *RedisObject)
func (*Dict) Get ¶
func (d *Dict) Get(key *RedisObject) *RedisObject
type PubSubPattern ¶
type PubSubPattern struct { Client *Client Pattern *RedisObject }
type RedisCommand ¶
type RedisCommand struct { Name string Proc func(c *Client) Arity int SFlags string Flags int GetKeysProc *int FirstKey int LastKey int KeyStep int Microseconds int Calls int }
func LookupCommand ¶
func LookupCommand(cmd string) (*RedisCommand, bool)
func (*RedisCommand) FeedAppendOnlyFile ¶
func (rc *RedisCommand) FeedAppendOnlyFile(dbid int, argv []*RedisObject)
func (*RedisCommand) Propagate ¶
func (rc *RedisCommand) Propagate(dbid int, argv []*RedisObject, flags int)
type RedisDb ¶
func NewRedisDb ¶
func (*RedisDb) Add ¶
func (rb *RedisDb) Add(key *RedisObject, value *RedisObject)
func (*RedisDb) LookupKey ¶
func (rb *RedisDb) LookupKey(key *RedisObject, flags int) *RedisObject
func (*RedisDb) LookupKeyRead ¶
func (rb *RedisDb) LookupKeyRead(key *RedisObject) *RedisObject
func (*RedisDb) LookupKeyReadWithFlags ¶
func (rb *RedisDb) LookupKeyReadWithFlags(key *RedisObject, flags int) *RedisObject
func (RedisDb) LookupKeyWrite ¶
func (rb RedisDb) LookupKeyWrite(key *RedisObject) *RedisObject
type RedisObject ¶
func CreateHashRedisObject ¶
func CreateHashRedisObject() *RedisObject
func CreateIntSetObject ¶
func CreateIntSetObject() *RedisObject
func CreateQuickListObject ¶
func CreateQuickListObject() *RedisObject
func CreateSetObject ¶
func CreateSetObject() *RedisObject
func NewRedisObject ¶
func NewRedisObject(typeFlag int, ptr interface{}) *RedisObject
func NewStringRedisObject ¶
func NewStringRedisObject(s string) *RedisObject
func SetTypeCreate ¶
func SetTypeCreate(s string) *RedisObject
func (*RedisObject) DecrRefCount ¶
func (r *RedisObject) DecrRefCount()
func (*RedisObject) MakeShared ¶
func (r *RedisObject) MakeShared() *RedisObject
type ReplicationMain ¶
Main server info
func NewReplicationMain ¶
func NewReplicationMain(conn net.Conn) *ReplicationMain
func (*ReplicationMain) ReplicationUnsetMaster ¶
func (m *ReplicationMain) ReplicationUnsetMaster()
type ReplicationReplica ¶
type Server ¶
type Server struct { RequirePass bool Log log.ILog Clients map[int]*Client Db []*RedisDb No int StatRejectedConn int CurrentClient chan *Client Listener net.Listener Aof *Aof WaitCloseClients chan int NewClients chan net.Conn Commands map[string]*RedisCommand ClientMaxQueryBufLen int AofState int AofFsync int AofSelectedDb int ReplicaList []*ReplicationReplica Main *ReplicationMain PubSubChannels map[string][]*Client Monitors []*Client }
func (*Server) LoadDataFromDisk ¶
func (s *Server) LoadDataFromDisk()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.