MCPcopy
hub / github.com/grafana/dskit / generateRingInstanceWithInfo

Function generateRingInstanceWithInfo

ring/ring_test.go:3905–3921  ·  view source on GitHub ↗
(id, zone string, tokens []uint32, registeredAt time.Time)

Source from the content-addressed store, hash-verified

3903}
3904
3905func generateRingInstanceWithInfo(id, zone string, tokens []uint32, registeredAt time.Time) InstanceDesc {
3906 var regts int64
3907 if !registeredAt.IsZero() {
3908 regts = registeredAt.Unix()
3909 }
3910 // Heartbeat timestamp should be recent (relative to test time), not the old registration time.
3911 // Use time.Now() to simulate an instance that has recently sent a heartbeat.
3912 return InstanceDesc{
3913 Id: id,
3914 Addr: id,
3915 Timestamp: time.Now().Unix(),
3916 RegisteredTimestamp: regts,
3917 State: ACTIVE,
3918 Tokens: tokens,
3919 Zone: zone,
3920 }
3921}
3922
3923// compareReplicationSets returns the list of instance addresses which differ between the two sets.
3924func compareReplicationSets(first, second ReplicationSet) (added, removed []string) {

Calls

no outgoing calls

Tested by

no test coverage detected