Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback struct { // FilterInterested returns only item which may be requested. OnlyInterested func(ids []interface{}) []interface{} Suspend func() bool }
type Config ¶
type Config struct { ForgetTimeout time.Duration // Time before an announced event is forgotten ArriveTimeout time.Duration // Time allowance before an announced event is explicitly requested GatherSlack time.Duration // Interval used to collate almost-expired announces with fetches HashLimit int // Maximum number of unique events a peer may have announced MaxBatch int // Maximum number of hashes in an announce batch (batch is divided if exceeded) MaxParallelRequests int // Maximum number of parallel requests // MaxQueuedHashesBatches is the maximum number of announce batches to queue up before // dropping incoming hashes. MaxQueuedBatches int }
func DefaultConfig ¶
func DefaultConfig(scale cachescale.Func) Config
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher is responsible for accumulating item announcements from various peers and scheduling them for retrieval.
func (*Fetcher) NotifyAnnounces ¶
func (f *Fetcher) NotifyAnnounces(peer string, ids []interface{}, time time.Time, fetchItems ItemsRequesterFn) error
NotifyAnnounces announces the fetcher of the potential availability of a new item in the network.
func (*Fetcher) NotifyReceived ¶
func (*Fetcher) Overloaded ¶
Overloaded returns true if too much items are being requested
type ItemsRequesterFn ¶
type ItemsRequesterFn func([]interface{}) error
ItemsRequesterFn is a callback type for sending a item retrieval request.
Click to show internal directories.
Click to hide internal directories.