mirror of
https://github.com/status-im/status-go.git
synced 2025-01-28 07:27:00 +00:00
eeca435064
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package wire
|
|
|
|
// ProtobufCarrier is a DelegatingCarrier that uses protocol buffers as the
|
|
// the underlying datastructure. The reason for implementing DelagatingCarrier
|
|
// is to allow for end users to serialize the underlying protocol buffers using
|
|
// jsonpb or any other serialization forms they want.
|
|
type ProtobufCarrier TracerState
|
|
|
|
// SetState set's the tracer state.
|
|
func (p *ProtobufCarrier) SetState(traceID, spanID uint64, sampled bool) {
|
|
p.TraceId = traceID
|
|
p.SpanId = spanID
|
|
p.Sampled = sampled
|
|
}
|
|
|
|
// State returns the tracer state.
|
|
func (p *ProtobufCarrier) State() (traceID, spanID uint64, sampled bool) {
|
|
traceID = p.TraceId
|
|
spanID = p.SpanId
|
|
sampled = p.Sampled
|
|
return traceID, spanID, sampled
|
|
}
|
|
|
|
// SetBaggageItem sets a baggage item.
|
|
func (p *ProtobufCarrier) SetBaggageItem(key, value string) {
|
|
if p.BaggageItems == nil {
|
|
p.BaggageItems = map[string]string{key: value}
|
|
return
|
|
}
|
|
|
|
p.BaggageItems[key] = value
|
|
}
|
|
|
|
// GetBaggage iterates over each baggage item and executes the callback with
|
|
// the key:value pair.
|
|
func (p *ProtobufCarrier) GetBaggage(f func(k, v string)) {
|
|
for k, v := range p.BaggageItems {
|
|
f(k, v)
|
|
}
|
|
}
|