Skip to content

Commit a0325d8

Browse files
committed
box: add replication information
1 parent 7eae014 commit a0325d8

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
1010

1111
### Added
1212

13+
- Extend box with replication information.
14+
1315
### Changed
1416

1517
### Fixed

box/info.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,49 @@ type Info struct {
2626
Status string `msgpack:"status"`
2727
// LSN - Log sequence number of the instance.
2828
LSN uint64 `msgpack:"lsn"`
29+
// Replication - replication status
30+
Replication map[int]Replication `msgpack:"replication,omitempty"`
31+
}
32+
33+
// Replication section of box.info() is a table with statistics for all instances
34+
// in the replica set that the current instance belongs to.
35+
type Replication struct {
36+
// The node ID (nullable).
37+
ID *int `msgpack:"id"`
38+
// UUID - Unique identifier of the instance.
39+
UUID string `msgpack:"uuid"`
40+
// LSN - Log sequence number of the instance.
41+
LSN uint64 `msgpack:"lsn"`
42+
// Upstream - information about upstream.
43+
Upstream Upstream `msgpack:"upstream,omitempty"`
44+
// Downstream - information about downstream.
45+
Downstream Downstream `msgpack:"downstream,omitempty"`
46+
}
47+
48+
// Upstream information.
49+
type Upstream struct {
50+
// Status is replication status of the connection with the instance.
51+
Status string `msgpack:"status"`
52+
// Idle is the time (in seconds) since the last event was received.
53+
Idle float64 `msgpack:"idle"`
54+
// Contains instance n’s URI.
55+
Peer string `msgpack:"peer"`
56+
// Lag is the time difference between the local time of instance n, recorded when the event was received,
57+
// and the local time at another master recorded when the event was written to the write-ahead log on that master.
58+
Lag float64 `msgpack:"lag"`
59+
}
60+
61+
// Downstream information.
62+
type Downstream struct {
63+
// Status is replication status of the connection with the instance.
64+
Status string `msgpack:"status"`
65+
// Idle is the time (in seconds) since the last event was received.
66+
Idle float64 `msgpack:"idle"`
67+
// Contains the vector clock, which is a table of ‘id, lsn’ pairs.
68+
VClock map[int]uint64 `msgpack:"vclock"`
69+
// Lag is the time difference between the local time of instance n, recorded when the event was received,
70+
// and the local time at another master recorded when the event was written to the write-ahead log on that master.
71+
Lag float64 `msgpack:"lag"`
2972
}
3073

3174
// InfoResponse represents the response structure

0 commit comments

Comments
 (0)