Documentation
¶
Overview ¶
chunks.go provides a base parser that loads rladmin output and parses it into chunks for each section. Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
databases.go provides a parser for the database information in the rladmin output Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
endpoints.go provides a parser for the node information in the rladmin output Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
nodes.go provides a parser for the node information in the rladmin output Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
shards.go provides a parser for the shard information in the rladmin output Copyright © 2024 Nic Gibson <nic.gibson@redis.com>
Index ¶
- Constants
- type Chunks
- func (c *Chunks) ExtractTimeStamp() (time.Time, error)
- func (c *Chunks) Parse(input io.Reader) error
- func (c *Chunks) ParseDatabases(parent *ClusterInfo) (Databases, error)
- func (c *Chunks) ParseEndpoints(parent *ClusterInfo) (Endpoints, error)
- func (c *Chunks) ParseNodes(parent *ClusterInfo) (Nodes, error)
- func (c *Chunks) ParseShards(parent *ClusterInfo) (Shards, error)
- type ClusterInfo
- type ComponentBase
- type DBEndPoints
- type DBNodes
- type DBShards
- type Database
- type Databases
- type Endpoint
- type Endpoints
- type IP
- type MemoryInfo
- type Node
- type Nodes
- type RAMFloat
- type Shard
- type ShardInfo
- type Shards
Constants ¶
const ( ChunkNone = iota ChunkCluster ChunkNodes ChunkDatabases ChunkEndpoints ChunkShards )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chunks ¶
Chunks is used to store the output of the base parser.
func (*Chunks) ExtractTimeStamp ¶
ExtractTimeStamp finds the timestamp at the start of the output and returns it as time.Time
func (*Chunks) ParseDatabases ¶
func (c *Chunks) ParseDatabases(parent *ClusterInfo) (Databases, error)
func (*Chunks) ParseEndpoints ¶
func (c *Chunks) ParseEndpoints(parent *ClusterInfo) (Endpoints, error)
func (*Chunks) ParseNodes ¶
func (c *Chunks) ParseNodes(parent *ClusterInfo) (Nodes, error)
func (*Chunks) ParseShards ¶
func (c *Chunks) ParseShards(parent *ClusterInfo) (Shards, error)
type ClusterInfo ¶
type ClusterInfo struct {
Key string `json:"key"`
Source string `json:"source"`
Unparsed *Chunks `json:"-"`
Databases Databases `json:"databases"`
Endpoints Endpoints `json:"endpoints"`
Shards Shards `json:"shards"`
Nodes Nodes `json:"nodes"`
TimeStamp time.Time `json:"timeStamp"`
}
ClusterInfo represents all the data loaded from the rladmin status output
func NewClusterInfo ¶
func NewClusterInfo(key string, in io.Reader) (*ClusterInfo, error)
func (*ClusterInfo) CSV ¶ added in v0.1.4
func (c *ClusterInfo) CSV(skipHeaders bool) (map[string]string, error)
func (*ClusterInfo) JSON ¶
func (c *ClusterInfo) JSON() (string, error)
type ComponentBase ¶ added in v0.1.6
type ComponentBase struct {
Key string `column:"-" json:"key" csv:"key"`
Source string `column:"-" json:"source" csv:"source"`
TimeStamp time.Time `json:"timeStamp" csv:"timeStamp" column:"-"`
// contains filtered or unexported fields
}
func (*ComponentBase) SetParent ¶ added in v0.1.6
func (cb *ComponentBase) SetParent(info *ClusterInfo)
type DBEndPoints ¶
type DBEndPoints []string
func (*DBEndPoints) UnmarshalText ¶
func (db *DBEndPoints) UnmarshalText(text []byte) error
type DBNodes ¶
func (*DBNodes) MarshalCSV ¶
type Database ¶
type Database struct {
ComponentBase
Id string `column:"DB:ID" json:"id" csv:"id"`
Name string `column:"NAME" json:"name" csv:"name"`
Type string `column:"TYPE" json:"type" csv:"type"`
Status string `column:"STATUS" json:"status" csv:"status"`
MasterShards uint16 `column:"SHARDS" json:"shards" csv:"shards"`
Placement string `column:"PLACEMENT" json:"placement" csv:"placement"`
Replication string `column:"REPLICATION" json:"replication" csv:"replication"`
Persistence string `column:"PERSISTENCE" json:"persistence" csv:"persistence"`
Endpoint DBEndPoints `column:"ENDPOINT" json:"endpoints" csv:"endpoints"`
ExecState string `column:"EXEC_STATE" json:"execState" csv:"execState"`
ExecStateMachine string `column:"EXEC_STATE_MACHINE" json:"execStateMachine" csv:"execStateMachine"`
BackupProgress string `column:"BACKUP_PROGRESS" json:"backupProgress" csv:"backupProgress"`
MissingBackupTime string `column:"MISSING_BACKUP_TIME" json:"missingBackupTime" csv:"missingBackupTime"`
RedisVersion string `column:"REDIS_VERSION" json:"redisVersion" csv:"redisVersion"`
}
func (*Database) ClusterName ¶ added in v0.1.6
ClusterName builds a cluster name from the database endpoints and returns it
type Databases ¶
type Databases []*Database
func (Databases) CSV ¶
Marshal the databases to a string and return it. If the skipHeaders parameter is true, marshall without headers
func (Databases) ClusterName ¶ added in v0.1.6
ClusterName gets the cluster name from the first database in the list
func (Databases) SetParent ¶ added in v0.1.6
func (d Databases) SetParent(info *ClusterInfo)
Set the parent (and associated fields) for all dbs
type Endpoint ¶
type Endpoint struct {
ComponentBase
Id string `column:"ID" json:"id" csv:"endpointId"`
DBId string `column:"DB:ID" json:"dbId" csv:"dbid"`
Name string `column:"NAME" json:"name" csv:"name"`
Node string `column:"NODE" json:"node" csv:"node"`
Role string `column:"ROLE" json:"role" csv:"endpointRole"`
SSL bool `column:"SSL" json:"ssl" csv:"ssl"`
WatchdogStatus string `column:"WATCHDOG_STATUS" json:"watchdogStatus" csv:"watchDogStatus"`
}
type Endpoints ¶
type Endpoints []*Endpoint
func (Endpoints) SetParent ¶ added in v0.1.6
func (endpoints Endpoints) SetParent(info *ClusterInfo)
Set the parent (and associated fields) for all endpoints
type IP ¶
func (*IP) UnmarshalText ¶
type MemoryInfo ¶
func (*MemoryInfo) UnmarshalText ¶
func (m *MemoryInfo) UnmarshalText(input []byte) error
type Node ¶
type Node struct {
ComponentBase
Id string `json:"nodeId" csv:"nodeId" column:"NODE:ID" `
Role string `json:"role" csv:"role" column:"ROLE"`
Address IP `json:"address" csv:"address" column:"ADDRESS"`
ExternalAddress IP `json:"externalAddress" csv:"externalAddress" column:"EXTERNAL_ADDRESS"`
HostName string `json:"hostName" csv:"hostName" column:"HOSTNAME"`
OverbookingDepth RAMFloat `json:"overbookingDepth" csv:"overbookingDepth" column:"OVERBOOKING_DEPTH"`
Masters uint16 `json:"masters" csv:"masters" column:"MASTERS"`
Replicas uint16 `json:"replicas" csv:"replicas" column:"SLAVES"`
ShardUsage ShardInfo `json:"shards" csv:"shards" column:"SHARDS"`
Cores uint16 `json:"cores" csv:"cores" column:"CORES"`
RedisRAM MemoryInfo `json:"redisRAM" csv:"redisRAM" column:"FREE_RAM"`
ProvisionalRAM MemoryInfo `json:"provisionalRAM" csv:"provisionalRAM" column:"PROVISIONAL_RAM"`
Version string `json:"version" csv:"version" column:"VERSION"`
SHA string `json:"sha" csv:"sha" column:"SHA"`
RackId string `json:"rackId" csv:"rackId" column:"RACK-ID"`
Status string `json:"status" csv:"status" column:"STATUS"`
Quorum bool `json:"quorum" csv:"quorum" column:"-"`
}
type RAMFloat ¶
type RAMFloat float64
func (*RAMFloat) MarshalText ¶
func (*RAMFloat) UnmarshalText ¶
type Shard ¶
type Shard struct {
ComponentBase
Id string `column:"ID" json:"id" csv:"shardid"`
DBId string `column:"DB:ID" json:"dbId" csv:"dbid"`
Name string `column:"NAME" json:"name" csv:"name"`
Node string `column:"NODE" json:"node" csv:"node"`
Role string `column:"ROLE" json:"role" csv:"role"`
Slots string `column:"SLOTS" json:"slots" csv:"slots"`
UsedMemory RAMFloat `column:"USED_MEMORY" json:"usedMemory" csv:"usedMemory"`
BackupProgress string `column:"BACKUP_PROGRESS" json:"backupProgress" csv:"backupProgress"`
RAMFrag RAMFloat `column:"RAM_FRAG" json:"ramFrag" csv:"ramFrag"`
WatchdogStatus string `column:"WATCHDOG_STATUS" json:"watchdogStatus" csv:"watchdogStatus"`
Status string `column:"STATUS" json:"status" csv:"status"`
}