Skip to content

Commit 0b8374e

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

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

CHANGELOG.md

+2
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

+32
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,38 @@ 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 Stream `msgpack:"upstream,omitempty"`
44+
// Downstream - information about downstream.
45+
Downstream Stream `msgpack:"downstream,omitempty"`
46+
}
47+
48+
// Stream represents detailed information about stream.
49+
type Stream 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+
// Lag is the time difference between the local time of instance n, recorded when the event was received,
55+
// and the local time at another master recorded when the event was written to the write-ahead log on that master.
56+
Lag float64 `msgpack:"lag"`
57+
// Contains instance n’s URI.
58+
Peer string `msgpack:"peer,omitempty"`
59+
// Contains the vector clock, which is a table of ‘id, lsn’ pairs.
60+
VClock map[int]uint64 `msgpack:"vclock,omitempty"`
2961
}
3062

3163
// InfoResponse represents the response structure

0 commit comments

Comments
 (0)