Documentation
¶
Index ¶
- Constants
- func MarshalRegionInfoJSON(ctx context.Context, r *core.RegionInfo) ([]byte, error)
- func MarshalRegionsInfoJSON(ctx context.Context, regions []*core.RegionInfo) ([]byte, error)
- type MetaPeer
- type MetaStore
- type PDPeerStats
- type RegionInfo
- type RegionsInfo
- type ReplicationStatus
- type SlowTrend
- type StoreInfo
- type StoreStatus
- type StoresInfo
Constants ¶
const ( // DisconnectedName is the name when store is disconnected. DisconnectedName = "Disconnected" // DownStateName is the name when store is down. DownStateName = "Down" )
Variables ¶
This section is empty.
Functions ¶
func MarshalRegionInfoJSON ¶
MarshalRegionInfoJSON marshals region to bytes in `RegionInfo`'s JSON format. It is used to reduce the cost of JSON serialization.
func MarshalRegionsInfoJSON ¶
MarshalRegionsInfoJSON marshals regions to bytes in `RegionsInfo`'s JSON format. It is used to reduce the cost of JSON serialization.
Types ¶
type MetaPeer ¶
type MetaPeer struct {
*metapb.Peer
// RoleName is `Role.String()`.
// Since Role is serialized as int by json by default,
// introducing it will make the output of pd-ctl easier to identify Role.
RoleName string `json:"role_name"`
// IsLearner is `Role == "Learner"`.
// Since IsLearner was changed to Role in kvproto in 5.0, this field was introduced to ensure api compatibility.
IsLearner bool `json:"is_learner,omitempty"`
}
MetaPeer is api compatible with *metapb.Peer. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type PDPeerStats ¶
PDPeerStats is api compatible with *pdpb.PeerStats. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type RegionInfo ¶
type RegionInfo struct {
ID uint64 `json:"id"`
StartKey string `json:"start_key"`
EndKey string `json:"end_key"`
RegionEpoch *metapb.RegionEpoch `json:"epoch,omitempty"`
Peers []MetaPeer `json:"peers,omitempty"`
Leader MetaPeer `json:"leader,omitempty"`
DownPeers []PDPeerStats `json:"down_peers,omitempty"`
PendingPeers []MetaPeer `json:"pending_peers,omitempty"`
CPUUsage uint64 `json:"cpu_usage"`
WrittenBytes uint64 `json:"written_bytes"`
ReadBytes uint64 `json:"read_bytes"`
WrittenKeys uint64 `json:"written_keys"`
ReadKeys uint64 `json:"read_keys"`
ApproximateSize int64 `json:"approximate_size"`
ApproximateKeys int64 `json:"approximate_keys"`
ApproximateKvSize int64 `json:"approximate_kv_size"`
Buckets []string `json:"buckets,omitempty"`
ReplicationStatus *ReplicationStatus `json:"replication_status,omitempty"`
}
RegionInfo records detail region info for api usage. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it. easyjson:json
func InitRegion ¶
func InitRegion(r *core.RegionInfo, s *RegionInfo) *RegionInfo
InitRegion init a new API RegionInfo from the core.RegionInfo.
func NewAPIRegionInfo ¶
func NewAPIRegionInfo(r *core.RegionInfo) *RegionInfo
NewAPIRegionInfo create a new API RegionInfo.
func (*RegionInfo) Adjust ¶
func (r *RegionInfo) Adjust()
Adjust is only used in testing, in order to compare the data from json deserialization.
func (RegionInfo) MarshalEasyJSON ¶
func (v RegionInfo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RegionInfo) MarshalJSON ¶
func (v RegionInfo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RegionInfo) UnmarshalEasyJSON ¶
func (v *RegionInfo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RegionInfo) UnmarshalJSON ¶
func (v *RegionInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type RegionsInfo ¶
type RegionsInfo struct {
Count int `json:"count"`
Regions []RegionInfo `json:"regions"`
}
RegionsInfo contains some regions with the detailed region info.
func (*RegionsInfo) Adjust ¶
func (s *RegionsInfo) Adjust()
Adjust is only used in testing, in order to compare the data from json deserialization.
type ReplicationStatus ¶
ReplicationStatus represents the replication mode status of the region. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type SlowTrend ¶
type SlowTrend struct {
// CauseValue is the slow trend detecting raw input, it changes by the performance and pressure along time of the store.
// The value itself is not important, what matter is:
// - The comparison result from store to store.
// - The change magnitude along time (represented by CauseRate).
// Currently, it's one of store's internal latency (duration of waiting in the task queue of raftstore.store).
CauseValue float64 `json:"cause_value"`
// CauseRate is for measuring the change magnitude of CauseValue of the store,
// - CauseRate > 0 means the store is become slower currently
// - CauseRate < 0 means the store is become faster currently
// - CauseRate == 0 means the store's performance and pressure does not have significant changes
CauseRate float64 `json:"cause_rate"`
// ResultValue is the current gRPC QPS of the store.
ResultValue float64 `json:"result_value"`
// ResultRate is for measuring the change magnitude of ResultValue of the store.
ResultRate float64 `json:"result_rate"`
}
SlowTrend contains slow trend information about a store.
type StoreInfo ¶
type StoreInfo struct {
Store *MetaStore `json:"store"`
Status *StoreStatus `json:"status"`
}
StoreInfo contains information about a store.
func BuildStoreInfo ¶
func BuildStoreInfo(opt *sc.ScheduleConfig, store *core.StoreInfo) *StoreInfo
BuildStoreInfo builds a storeInfo response.
type StoreStatus ¶
type StoreStatus struct {
Capacity typeutil.ByteSize `json:"capacity"`
Available typeutil.ByteSize `json:"available"`
UsedSize typeutil.ByteSize `json:"used_size"`
LeaderCount int `json:"leader_count"`
LeaderWeight float64 `json:"leader_weight"`
LeaderScore float64 `json:"leader_score"`
LeaderSize int64 `json:"leader_size"`
RegionCount int `json:"region_count"`
RegionWeight float64 `json:"region_weight"`
RegionScore float64 `json:"region_score"`
RegionSize int64 `json:"region_size"`
LearnerCount int `json:"learner_count,omitempty"`
WitnessCount int `json:"witness_count,omitempty"`
PendingPeerCount int `json:"pending_peer_count,omitempty"`
SlowScore uint64 `json:"slow_score,omitempty"`
SlowTrend *SlowTrend `json:"slow_trend,omitempty"`
SendingSnapCount uint32 `json:"sending_snap_count,omitempty"`
ReceivingSnapCount uint32 `json:"receiving_snap_count,omitempty"`
IsBusy bool `json:"is_busy,omitempty"`
StartTS *time.Time `json:"start_ts,omitempty"`
LastHeartbeatTS *time.Time `json:"last_heartbeat_ts,omitempty"`
Uptime *typeutil.Duration `json:"uptime,omitempty"`
}
StoreStatus contains status about a store.
type StoresInfo ¶
StoresInfo records stores' info.