Documentation ¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DisabledQueue ¶
type DisabledQueue struct{}
DisabledQueue is a Queue which ignores all input and constantly returns that there are no torrents in the queue. Suitable for origin peers which want to disable announcing.
func (DisabledQueue) Next ¶
func (q DisabledQueue) Next() (core.InfoHash, bool)
Next never returns a torrent.
type Queue ¶
type Queue interface { Next() (core.InfoHash, bool) Add(core.InfoHash) Ready(core.InfoHash) Eject(core.InfoHash) }
Queue manages a queue of torrents waiting to announce.
type QueueImpl ¶
type QueueImpl struct {
// contains filtered or unexported fields
}
QueueImpl is the primary implementation of Queue. QueueImpl is not thread safe -- synchronization must be provided by clients.
func (*QueueImpl) Add ¶
Add adds a torrent to the back of the queue. Behavior is undefined if called twice on the same torrent.
func (*QueueImpl) Eject ¶
Eject immediately ejects h from the announce queue, preventing it from announcing further.
func (*QueueImpl) Next ¶
Next returns the next torrent ready to announce. After Next is called, the returned torrent will be marked as pending and will not be appear again in Next until Ready is called with said torrent. Second return value is false if no torrents are ready.