Documentation
¶
Overview ¶
Package requests implements a queue of pending requests. It is optimised for frequent membership checks.
Index ¶
- type Request
- type Requests
- func (rs *Requests) Cancel(index uint32) (bool, bool)
- func (rs *Requests) Clear(both bool, f func(uint32))
- func (rs *Requests) Del(index uint32) (bool, bool, time.Time)
- func (rs *Requests) DelRequested(index uint32) bool
- func (rs *Requests) Dequeue() (request Request, index uint32)
- func (rs *Requests) Enqueue(index uint32) bool
- func (rs *Requests) EnqueueRequest(r Request)
- func (rs *Requests) Expire(t0, t1 time.Time, drop func(index uint32), cancel func(index uint32)) bool
- func (rs *Requests) Queue() int
- func (rs *Requests) Requested() int
- func (rs *Requests) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents an outgoing request.
type Requests ¶
type Requests struct {
// contains filtered or unexported fields
}
Requests represents a request queue.
func (*Requests) Cancel ¶
Cancel cancels a request that has been sent out. It returns two booleans: the first one indicates if the request was found, the second one indicates whether a Cancel should be sent out.
func (*Requests) Clear ¶
Clear cancels all queued request. It calls the given function for all requests that have already been sent out.
func (*Requests) DelRequested ¶
DelRequested deletes a request only if it has been sent out.
func (*Requests) Enqueue ¶
Enqueue enqueues a new request. It returns false if the request is a duplicate.
func (*Requests) EnqueueRequest ¶
Enqueue enqueues a request that has been sent out.
func (*Requests) Expire ¶
func (rs *Requests) Expire(t0, t1 time.Time, drop func(index uint32), cancel func(index uint32)) bool
Expire clears all requests that have been cancelled before time t1 or sent out before time t0.