Documentation ¶
Index ¶
- Constants
- type Peer
- func (p *Peer) Close(timeout time.Duration)
- func (p *Peer) Info() map[string]interface{}
- func (p *Peer) Join(initialState PeerState) error
- func (p *Peer) Name() string
- func (p *Peer) PeerState(id string) (PeerState, bool)
- func (p *Peer) PeerStates(types ...PeerType) map[string]PeerState
- func (p *Peer) SetLabels(labels []storepb.Label)
- func (p *Peer) SetTimestamps(mint int64, maxt int64)
- type PeerMetadata
- type PeerState
- type PeerType
Constants ¶
const ( DefaultPushPullInterval = 5 * time.Second DefaultGossipInterval = 5 * time.Second )
const ( // PeerTypeStore is for peers that implements StoreAPI and are used for browsing historical data. PeerTypeStore = "store" // PeerTypeSource is for peers that implements StoreAPI and are used for scraping data. They tend to // have data accessible only for short period. PeerTypeSource = "source" // PeerTypeQuery is for peers that implements QueryAPI and are used for querying the metrics. PeerTypeQuery = "query" )
Constants holding valid PeerType values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is a single peer in a gossip cluster.
func New ¶
func New( l log.Logger, reg *prometheus.Registry, bindAddr string, advertiseAddr string, knownPeers []string, waitIfEmpty bool, pushPullInterval time.Duration, gossipInterval time.Duration, ) (*Peer, error)
New returns "alone" peer that is ready to join.
func (*Peer) Close ¶
Close leaves the cluster waiting up to timeout and shutdowns peer if cluster left. TODO(bplotka): Add this method into run.Group closing logic for each command. This will improve graceful shutdown.
func (*Peer) PeerStates ¶
PeerStates returns the custom state information for each peer by memberlist peer id (name).
func (*Peer) SetLabels ¶
SetLabels updates internal metadata's labels stored in PeerState for this peer. Note that this data will be propagated based on gossipInterval we set.
func (*Peer) SetTimestamps ¶
SetTimestamps updates internal metadata's timestamps stored in PeerState for this peer. Note that this data will be propagated based on gossipInterval we set.
type PeerMetadata ¶
type PeerMetadata struct { Labels []storepb.Label // MinTime indicates the minTime of the oldest block available from this peer. MinTime int64 // MaxTime indicates the maxTime of the youngest block available from this peer. MaxTime int64 }
PeerMetadata are the information that can change in runtime of the peer.
type PeerState ¶
type PeerState struct { Type PeerType APIAddr string Metadata PeerMetadata }
PeerState contains state for the peer.