Documentation
¶
Index ¶
- type DefaultDownloader
- type DefaultSyncer
- type Dispatcher
- func (d *Dispatcher) AddNodeTracker(obj *api.NodeTracker)
- func (d *Dispatcher) DeleteNodeTracker(obj *api.NodeTracker)
- func (d *Dispatcher) PrepareReplications(ctx context.Context, torrent *api.Torrent, nodeTrackers []api.NodeTracker) (replications []*api.Replication, torrentStatusChanged bool, err error)
- func (d *Dispatcher) ReclaimReplications(ctx context.Context, torrent *api.Torrent) (replications []*api.Replication, torrentStatusChanged bool, err error)
- func (d *Dispatcher) UpdateNodeTracker(old *api.NodeTracker, new *api.NodeTracker)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultDownloader ¶
type DefaultDownloader struct {
framework.DefaultFramework
}
DefaultDownloader helps to download the chunks.
type DefaultSyncer ¶
type DefaultSyncer struct {
framework.DefaultFramework
}
DefaultSyncer helps to sync the chunks in the p2p network.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(downloadPlugins []framework.RegisterFunc, syncPlugins []framework.RegisterFunc) (*Dispatcher, error)
func (*Dispatcher) AddNodeTracker ¶
func (d *Dispatcher) AddNodeTracker(obj *api.NodeTracker)
func (*Dispatcher) DeleteNodeTracker ¶
func (d *Dispatcher) DeleteNodeTracker(obj *api.NodeTracker)
func (*Dispatcher) PrepareReplications ¶
func (d *Dispatcher) PrepareReplications(ctx context.Context, torrent *api.Torrent, nodeTrackers []api.NodeTracker) (replications []*api.Replication, torrentStatusChanged bool, err error)
PrepareReplications will construct the replications needed to created and update the torrent status the same time. This function must be idempotent or we'll create duplicated replications. Note: make sure the same download/sync task will not be sent to the same node, or we have to introduce file lock when downloading chunks.
func (*Dispatcher) ReclaimReplications ¶
func (d *Dispatcher) ReclaimReplications(ctx context.Context, torrent *api.Torrent) (replications []*api.Replication, torrentStatusChanged bool, err error)
ReclaimReplications will create replications to delete the chunks. This function must be idempotent or we'll create duplicated replications.
func (*Dispatcher) UpdateNodeTracker ¶
func (d *Dispatcher) UpdateNodeTracker(old *api.NodeTracker, new *api.NodeTracker)
Click to show internal directories.
Click to hide internal directories.