Documentation ¶
Index ¶
- Constants
- Variables
- func Equal(u1 *SUID, u2 *SUID) bool
- func TestSUID()
- type Basic
- type Mode
- type NodeInfo
- type NodeInfoGroup
- func (ns *NodeInfoGroup) CloseAllMember()
- func (ns *NodeInfoGroup) Len() int
- func (ns *NodeInfoGroup) Less(i, j int) bool
- func (ns *NodeInfoGroup) Master() *NodeInfo
- func (ns *NodeInfoGroup) Offset() string
- func (ns *NodeInfoGroup) Put(n *NodeInfo)
- func (ns *NodeInfoGroup) Slaves() []*NodeInfo
- func (ns *NodeInfoGroup) Swap(i, j int)
- func (ns *NodeInfoGroup) Update(offset int64)
- type RedisCluster
- func (s *RedisCluster) Group(n *NodeInfo) *NodeInfoGroup
- func (s *RedisCluster) Increment(n *NodeInfo, offset int64)
- func (s *RedisCluster) MarshalToWriter(dst io.Writer) error
- func (s *RedisCluster) Offset(n *NodeInfo) string
- func (s *RedisCluster) Run() Stop
- func (s *RedisCluster) Topology() *ToplogyMapped
- type RedisSentinel
- func (s *RedisSentinel) Group(n *NodeInfo) *NodeInfoGroup
- func (s *RedisSentinel) Increment(n *NodeInfo, offset int64)
- func (s *RedisSentinel) MarshalToWriter(dst io.Writer) error
- func (s *RedisSentinel) Offset(n *NodeInfo) string
- func (s *RedisSentinel) Run() Stop
- func (s *RedisSentinel) Topology() *ToplogyMapped
- type RedisSingle
- func (s *RedisSingle) Group(n *NodeInfo) *NodeInfoGroup
- func (s *RedisSingle) Increment(n *NodeInfo, offset int64)
- func (r *RedisSingle) MarshalToWriter(dst io.Writer) error
- func (s *RedisSingle) Offset(n *NodeInfo) string
- func (r *RedisSingle) Run() Stop
- func (r *RedisSingle) Topology() *ToplogyMapped
- type SUID
- type StateEvent
- type StateType
- type Stop
- type ToplogyMapped
- type Topologist
Constants ¶
View Source
const ( Server sectionType = "Server" Clients sectionType = "Clients" Memory sectionType = "Memory" Persistence sectionType = "Persistence" Stats sectionType = "Stats" Replication sectionType = "Replication" CPU sectionType = "CPU" Cluster sectionType = "Cluster" Keyspace sectionType = "Keyspace" )
View Source
const ( VariantNCS = iota VariantRFC4122 VariantMicrosoft VariantFuture )
UUID layout variants.
Variables ¶
View Source
var SUIDNil = &SUID{make([]byte, 16)}
The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
View Source
var SuidToShortS = suidToShortS
Functions ¶
Types ¶
type NodeInfo ¶
type NodeInfo struct { Id string `json:"node_id"` Addr string `json:"node_addr"` Pass string `json:"node_password"` Ver string `json:"node_version"` Offset int64 `json:"node_offset"` IsMaster bool `json:"is_master"` // contains filtered or unexported fields }
func CreateNodeInfo ¶
func (*NodeInfo) ExclusiveConn ¶
type NodeInfoGroup ¶
type NodeInfoGroup struct { UUID string `json:"uuid"` // Index:0 is master node Members []*NodeInfo `json:"members_node"` // Group offset // In the process of switching, // If the value is greater than the offset value of the instance to be run, then the value is discarded, // And the full amount of data of the new instance is retrieved directly from -1 // Otherwise it continues from the current offset. GroupOffset int64 `json:"group_offset"` // [{ip:port:runid}.String(),...] MemberIds []string `json:"member_ids"` // Node instance count MemberCnt int32 `json:"member_cnt"` // Identify current master run_id MasterId string // External incoming argsments address ArgumentAddrs []string // External incoming argsments password ArgumentPasswrod string }
func CreateMSNodeGroup ¶
func CreateMSNodeGroup(pass string, addrs ...string) *NodeInfoGroup
func CreateNodeInfoGroup ¶
func CreateNodeInfoGroup() *NodeInfoGroup
func (*NodeInfoGroup) CloseAllMember ¶
func (ns *NodeInfoGroup) CloseAllMember()
func (*NodeInfoGroup) Len ¶
func (ns *NodeInfoGroup) Len() int
func (*NodeInfoGroup) Less ¶
func (ns *NodeInfoGroup) Less(i, j int) bool
func (*NodeInfoGroup) Master ¶
func (ns *NodeInfoGroup) Master() *NodeInfo
func (*NodeInfoGroup) Offset ¶
func (ns *NodeInfoGroup) Offset() string
func (*NodeInfoGroup) Put ¶
func (ns *NodeInfoGroup) Put(n *NodeInfo)
func (*NodeInfoGroup) Slaves ¶
func (ns *NodeInfoGroup) Slaves() []*NodeInfo
func (*NodeInfoGroup) Swap ¶
func (ns *NodeInfoGroup) Swap(i, j int)
func (*NodeInfoGroup) Update ¶
func (ns *NodeInfoGroup) Update(offset int64)
type RedisCluster ¶
type RedisCluster struct { // Multiple sets of msater slave information in one cluster Cluster map[string]*NodeInfoGroup `json:"cluster"` }
func CreateRedisCluster ¶
func CreateRedisCluster(pass string, addrss [][]string) *RedisCluster
func (*RedisCluster) Group ¶
func (s *RedisCluster) Group(n *NodeInfo) *NodeInfoGroup
func (*RedisCluster) Increment ¶
func (s *RedisCluster) Increment(n *NodeInfo, offset int64)
func (*RedisCluster) MarshalToWriter ¶
func (s *RedisCluster) MarshalToWriter(dst io.Writer) error
masrshal
func (*RedisCluster) Offset ¶
func (s *RedisCluster) Offset(n *NodeInfo) string
func (*RedisCluster) Run ¶
func (s *RedisCluster) Run() Stop
func (*RedisCluster) Topology ¶
func (s *RedisCluster) Topology() *ToplogyMapped
type RedisSentinel ¶
type RedisSentinel struct {
*NodeInfoGroup `json:"sentinel"`
}
func CreateRedisSentinel ¶
func CreateRedisSentinel(pass string, addrs ...string) *RedisSentinel
func (*RedisSentinel) Group ¶
func (s *RedisSentinel) Group(n *NodeInfo) *NodeInfoGroup
func (*RedisSentinel) Increment ¶
func (s *RedisSentinel) Increment(n *NodeInfo, offset int64)
func (*RedisSentinel) MarshalToWriter ¶
func (s *RedisSentinel) MarshalToWriter(dst io.Writer) error
func (*RedisSentinel) Offset ¶
func (s *RedisSentinel) Offset(n *NodeInfo) string
func (*RedisSentinel) Run ¶
func (s *RedisSentinel) Run() Stop
func (*RedisSentinel) Topology ¶
func (s *RedisSentinel) Topology() *ToplogyMapped
type RedisSingle ¶
type RedisSingle struct {
*NodeInfoGroup `json:"single"`
}
redis single or master->slave architectural model
func CreateRedisSingle ¶
func CreateRedisSingle(pass string, addrs ...string) *RedisSingle
func (*RedisSingle) Group ¶
func (s *RedisSingle) Group(n *NodeInfo) *NodeInfoGroup
func (*RedisSingle) Increment ¶
func (s *RedisSingle) Increment(n *NodeInfo, offset int64)
func (*RedisSingle) MarshalToWriter ¶
func (r *RedisSingle) MarshalToWriter(dst io.Writer) error
func (*RedisSingle) Offset ¶
func (s *RedisSingle) Offset(n *NodeInfo) string
func (*RedisSingle) Run ¶
func (r *RedisSingle) Run() Stop
func (*RedisSingle) Topology ¶
func (r *RedisSingle) Topology() *ToplogyMapped
type SUID ¶
type SUID struct {
// contains filtered or unexported fields
}
UUID representation compliant with specification described in RFC 4122.
func (*SUID) SetVariant ¶
func (this *SUID) SetVariant()
SetVariant sets variant bits as described in RFC 4122.
func (*SUID) StringFull ¶
Returns canonical string representation of UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
type ToplogyMapped ¶
func (*ToplogyMapped) Compares ¶
func (t *ToplogyMapped) Compares(cur *ToplogyMapped) ( newNodes []*NodeInfo, oldNodes []*NodeInfo, hasChanged bool, )
type Topologist ¶
type Topologist interface { // Get redis real server topology Topology() *ToplogyMapped // Increment offset Increment(*NodeInfo, int64) // Group get current node groupAddr Group(*NodeInfo) *NodeInfoGroup // Offset get the string of offset Offset(*NodeInfo) string // marshal MarshalToWriter(io.Writer) error // The implementor needs to implement Basic interface template // Return the service callback method Basic }
func NewTopologyist ¶
func NewTopologyist(mode Mode, pass string, addrs ...string) (t Topologist, err error)
func UnmarshalFromBytes ¶
func UnmarshalFromBytes(mode Mode, p []byte) (Topologist, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.