Skip to content

Commit 39f15b7

Browse files
shtripatharshavardhana
authored andcommitted
Added structs for replication diag (#346)
Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
1 parent 69568b6 commit 39f15b7

File tree

3 files changed

+171
-21
lines changed

3 files changed

+171
-21
lines changed

health.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,10 @@ type HealthInfo struct {
10991099
Version string `json:"version"`
11001100
Error string `json:"error,omitempty"`
11011101

1102-
TimeStamp time.Time `json:"timestamp,omitempty"`
1103-
Sys SysInfo `json:"sys,omitempty"`
1104-
Minio MinioHealthInfo `json:"minio,omitempty"`
1102+
TimeStamp time.Time `json:"timestamp,omitempty"`
1103+
Sys SysInfo `json:"sys,omitempty"`
1104+
Minio MinioHealthInfo `json:"minio,omitempty"`
1105+
Replication ReplDiagInfo `json:"replication,omitempty"`
11051106
}
11061107

11071108
func (info HealthInfo) String() string {
@@ -1155,6 +1156,7 @@ const (
11551156
HealthDataTypeSysErrors HealthDataType = "syserrors"
11561157
HealthDataTypeSysServices HealthDataType = "sysservices"
11571158
HealthDataTypeSysConfig HealthDataType = "sysconfig"
1159+
HealthDataTypeReplication HealthDataType = "replication"
11581160
)
11591161

11601162
// HealthDataTypesMap - Map of Health datatypes
@@ -1170,6 +1172,7 @@ var HealthDataTypesMap = map[string]HealthDataType{
11701172
"syserrors": HealthDataTypeSysErrors,
11711173
"sysservices": HealthDataTypeSysServices,
11721174
"sysconfig": HealthDataTypeSysConfig,
1175+
"replication": HealthDataTypeReplication,
11731176
}
11741177

11751178
// HealthDataTypesList - List of health datatypes
@@ -1185,6 +1188,7 @@ var HealthDataTypesList = []HealthDataType{
11851188
HealthDataTypeSysErrors,
11861189
HealthDataTypeSysServices,
11871190
HealthDataTypeSysConfig,
1191+
HealthDataTypeReplication,
11881192
}
11891193

11901194
// HealthInfoVersionStruct - struct for health info version

info-commands.go

+20-18
Original file line numberDiff line numberDiff line change
@@ -400,24 +400,26 @@ type ErasureBackend struct {
400400

401401
// ServerProperties holds server information
402402
type ServerProperties struct {
403-
State string `json:"state,omitempty"`
404-
Endpoint string `json:"endpoint,omitempty"`
405-
Scheme string `json:"scheme,omitempty"`
406-
Uptime int64 `json:"uptime,omitempty"`
407-
Version string `json:"version,omitempty"`
408-
CommitID string `json:"commitID,omitempty"`
409-
Network map[string]string `json:"network,omitempty"`
410-
Disks []Disk `json:"drives,omitempty"`
411-
PoolNumber int `json:"poolNumber,omitempty"` // Only set if len(PoolNumbers) == 1
412-
PoolNumbers []int `json:"poolNumbers,omitempty"`
413-
MemStats MemStats `json:"mem_stats"`
414-
GoMaxProcs int `json:"go_max_procs,omitempty"`
415-
NumCPU int `json:"num_cpu,omitempty"`
416-
RuntimeVersion string `json:"runtime_version,omitempty"`
417-
GCStats *GCStats `json:"gc_stats,omitempty"`
418-
MinioEnvVars map[string]string `json:"minio_env_vars,omitempty"`
419-
Edition string `json:"edition"`
420-
License *LicenseInfo `json:"license,omitempty"`
403+
State string `json:"state,omitempty"`
404+
Endpoint string `json:"endpoint,omitempty"`
405+
Scheme string `json:"scheme,omitempty"`
406+
Uptime int64 `json:"uptime,omitempty"`
407+
Version string `json:"version,omitempty"`
408+
CommitID string `json:"commitID,omitempty"`
409+
Network map[string]string `json:"network,omitempty"`
410+
Disks []Disk `json:"drives,omitempty"`
411+
PoolNumber int `json:"poolNumber,omitempty"` // Only set if len(PoolNumbers) == 1
412+
PoolNumbers []int `json:"poolNumbers,omitempty"`
413+
MemStats MemStats `json:"mem_stats"`
414+
GoMaxProcs int `json:"go_max_procs,omitempty"`
415+
NumCPU int `json:"num_cpu,omitempty"`
416+
RuntimeVersion string `json:"runtime_version,omitempty"`
417+
GCStats *GCStats `json:"gc_stats,omitempty"`
418+
MinioEnvVars map[string]string `json:"minio_env_vars,omitempty"`
419+
Edition string `json:"edition"`
420+
License *LicenseInfo `json:"license,omitempty"`
421+
IsLeader bool `json:"is_leader"`
422+
ILMExpiryInProgress bool `json:"ilm_expiry_in_progress"`
421423
}
422424

423425
// MemStats is strip down version of runtime.MemStats containing memory stats of MinIO server.

replication.go

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
//
2+
// Copyright (c) 2015-2025 MinIO, Inc.
3+
//
4+
// This file is part of MinIO Object Storage stack
5+
//
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU Affero General Public License as
8+
// published by the Free Software Foundation, either version 3 of the
9+
// License, or (at your option) any later version.
10+
//
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU Affero General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU Affero General Public License
17+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
//
19+
20+
package madmin
21+
22+
import (
23+
"time"
24+
25+
"github.com/minio/minio-go/v7/pkg/replication"
26+
)
27+
28+
type ReplDiagInfo struct {
29+
Error string `json:"error,omitempty"`
30+
SREnabled bool `json:"site_replication_enabled"`
31+
ActiveWorkers WorkerStat `json:"active_workers,omitempty"`
32+
Queued InQueueMetric `json:"queued,omitempty"`
33+
ReplicaCount int64 `json:"replica_count,omitempty"`
34+
ReplicaSize int64 `json:"replica_size,omitempty"`
35+
Proxying bool `json:"proxying,omitempty"`
36+
Proxied ReplProxyMetric `json:"proxied,omitempty"`
37+
Sites []ReplDiagSite `json:"sites,omitempty"`
38+
RDReplicatedBuckets []ReplDiagReplBucket `json:"replicated_buckets,omitempty"`
39+
}
40+
41+
type ReplDiagSite struct {
42+
Addr string `json:"addr,omitempty"`
43+
DeploymentID string `json:"deployment_id"`
44+
Info ReplDiagSiteInfo `json:"info,omitempty"`
45+
}
46+
47+
type ReplDiagSiteInfo struct {
48+
Nodes []ReplDiagNode `json:"nodes,omitempty"`
49+
LDAPEnabled bool `json:"ldap_enabled,omitempty"`
50+
OpenIDEnabled bool `json:"openid_enabled,omitempty"`
51+
BucketsCount int `json:"buckets_count,omitempty"`
52+
Edge bool `json:"edge,omitempty"`
53+
ILMEnabled bool `json:"ilm_enabled,omitempty"`
54+
EncryptionEnabled bool `json:"encryption_enabled,omitempty"`
55+
ILMExpiryReplication bool `json:"ilm_expiry_replication,omitempty"`
56+
ObjectLockingEnabled bool `json:"object_locking_enabled,omitempty"`
57+
Throttle ReplDiagThrottle `json:"throttle,omitempty"`
58+
ReplicatedCount int64 `json:"replicated_count,omitempty"`
59+
ReplicatedSize int64 `json:"replicated_size,omitempty"`
60+
ResyncStatus string `json:"resync_status"`
61+
}
62+
63+
type ReplDiagNode struct {
64+
Addr string `json:"addr,omitempty"`
65+
MinIOVersion string `json:"minio_version,omitempty"`
66+
Uptime int64 `json:"uptime,omitempty"`
67+
PoolID int `json:"poolid,omitempty"`
68+
// SetID int `json:"setid,omitempty"`
69+
IsLeader bool `json:"is_leader,omitempty"`
70+
ILMExpiryInProgress bool `json:"ilm_expiry_in_progress,omitempty"`
71+
}
72+
73+
type ReplDiagReplBucket struct {
74+
Name string `json:"name,omitempty"`
75+
ReplicationInfo ReplDiagBucketReplInfo `json:"replication_info,omitempty"`
76+
ReplicationTargets []ReplDiagBucketReplTarget `json:"replication_targets,omitempty"`
77+
}
78+
79+
type ReplDiagBucketReplTarget struct {
80+
SourceBucket string `json:"source_bucket,omitempty"`
81+
TargetBucket string `json:"target_bucket,omitempty"`
82+
Addr string `json:"addr,omitempty"`
83+
Online bool `json:"online,omitempty"`
84+
TotalDowntime time.Duration `json:"total_downtime,omitempty"`
85+
CurrentDowntime time.Duration `json:"current_downtime,omitempty"`
86+
AdminPermissions bool `json:"admin_permissions,omitempty"`
87+
SyncReplication bool `json:"sync_replication,omitempty"`
88+
HeartbeatErrCount int64 `json:"heartbeat_err_count,omitempty"`
89+
BandwidthLimit uint64 `json:"bandwidth_limit,omitempty"`
90+
Latency LatencyStat `json:"xfer_rate,omitempty"`
91+
Edge bool `json:"edge,omitempty"`
92+
HealthCheckDuration time.Duration `json:"heath_check,omitempty"`
93+
DisableProxying bool `json:"disable_proxying"`
94+
DeleteReplication bool `json:"delete_replication,omitempty"`
95+
DeleteMarkerReplication bool `json:"delete_marker_replication,omitempty"`
96+
ReplicationPriority int `json:"replication_priority,omitempty"`
97+
ExistingObjectReplication bool `json:"existing_object_replication,omitempty"`
98+
MetadataSync bool `json:"metadata_sync,omitempty"`
99+
}
100+
101+
type ReplDiagBucketReplInfo struct {
102+
VersionEnabled bool `json:"version_enabled,omitempty"`
103+
ObjectLocking bool `json:"object_locking,omitempty"`
104+
ExcludedPrefixes []string `json:"excluded_prefixes,omitempty"`
105+
ILM ReplDiagILMInfo `json:"ilm,omitempty"`
106+
Encryption ReplDiagEncInfo `json:"encryption,omitempty"`
107+
Config replication.Config `json:"config,omitempty"`
108+
Resync ReplDiagBucketResyncInfo `json:"resync,omitempty"`
109+
}
110+
111+
type ReplDiagILMInfo struct {
112+
Enabled bool `json:"enabled,omitempty"`
113+
Rules []ReplDiagILMRule `json:"rules,omitempty"`
114+
}
115+
116+
type ReplDiagILMRule struct {
117+
ID string `json:"id,omitempty"`
118+
Expiration bool `json:"expiration,omitempty"`
119+
Transition bool `json:"transition,omitempty"`
120+
}
121+
122+
type ReplDiagEncInfo struct {
123+
Enabled bool `json:"enabled,omitempty"`
124+
EncRules []BucketEncInfo `json:"enc_rules,omitempty"`
125+
}
126+
127+
type BucketEncInfo struct {
128+
Algorithm string `json:"algorithm,omitempty"`
129+
EncKey string `json:"enc_key,omitempty"`
130+
}
131+
132+
type ReplDiagBucketResyncInfo struct {
133+
InProgress bool `json:"in_progress,omitempty"`
134+
StartTime time.Time `json:"start_time,omitempty"`
135+
FailedCount int64 `json:"failed_count,omitempty"`
136+
FailedSize int64 `json:"failed_size,omitempty"`
137+
ReplicatedCount int64 `json:"replicated_count,omitempty"`
138+
ReplicatedSize int64 `json:"replicated_size,omitempty"`
139+
}
140+
141+
type ReplDiagThrottle struct {
142+
IsSet bool `json:"is_set,omitempty"`
143+
Limit uint64 `json:"limit,omitempty"`
144+
}

0 commit comments

Comments
 (0)