Documentation ¶
Index ¶
- 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, firstTime bool, ...)
- 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 Dispatcher ¶
type Dispatcher struct { framework.DefaultFramework // contains filtered or unexported fields }
func NewDispatcher ¶
func NewDispatcher(plugins []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, firstTime 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.