dispatcher

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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)

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL