dispatcher

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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)

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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