Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultLatencyResolution = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue interface { // Next returns the next request to send, pops it from the queue and marks it as pending. Next() *Request // Peek returns the next request to send without popping it from the queue. Peek() *Request // Enqueue enqueues the given request if it isn't already queued or pending. Enqueue(*Request) (enqueued bool) // IsQueued tells whether a given request for the given transaction hash is queued. IsQueued(hash trinary.Hash) bool // IsPending tells whether a given request was popped from the queue and is now pending. IsPending(hash trinary.Hash) bool // Received marks a request as fulfilled and thereby removes it from the pending set. // Returns the origin request which was pending or nil if the hash was not requested. Received(hash trinary.Hash) *Request // EnqueuePending enqueues all pending requests back into the queue. // It also discards requests in the pending set of which their enqueue time is over the given delta threshold. // If discardOlderThan is zero, no requests are discarded. EnqueuePending(discardOlderThan time.Duration) (enqueued int) // Size returns the size of currently queued and requested/pending requests. Size() (queued int, pending int) // Empty tells whether the queue has no queued and pending requests. Empty() bool // Requests returns a snapshot of all queued and pending requests in the queue. Requests() (queued []*Request, pending []*Request) // AvgLatency returns the average latency of enqueueing and then receiving a request. AvgLatency() int64 }
Queue implements a queue which contains requests for needed data.
type Request ¶
type Request struct { // The hash of the transaction to request. Hash trinary.Hash // The byte encoded hash of the transaction to request. HashBytesEncoded []byte // The milestone index under which this request is linked. MilestoneIndex milestone.Index // Tells the request queue to not remove this request if the enqueue time is // over the given threshold. PreventDiscard bool // the time at which this request was first enqueued. // do not modify this time EnqueueTime time.Time // contains filtered or unexported fields }
Request is a request for a particular transaction.
Click to show internal directories.
Click to hide internal directories.