staging

package
v0.0.5-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorAlreadyStarted = errors.New("staging already started")
	ErrorStagingStopped = errors.New("staging stopped")
)

Functions

This section is empty.

Types

type InfoHashWithPeer

type InfoHashWithPeer struct {
	InfoHash model.Hash20
	Peer     krpc.NodeAddr
}

type Params

type Params struct {
	fx.In
	Lifecycle           fx.Lifecycle
	Search              search.Search
	Dao                 *dao.Query
	ClassifierPublisher publisher.Publisher[message.ClassifyTorrentPayload]
	Logger              *zap.SugaredLogger
	Config              dht.Config
}

type Request

type Request struct {
	InfoHashWithPeer
	NeedMetaInfo bool
	NeedScrape   bool
	// contains filtered or unexported fields
}

type Response

type Response struct {
	InfoHash model.Hash20
	MetaInfo metainfo.Info
	Scrape   ResponseScrape
}

type ResponseScrape

type ResponseScrape struct {
	Bfsd    bloom.Filter
	Bfpe    bloom.Filter
	Scraped bool
}

type Result

type Result struct {
	fx.Out
	Staging Staging
}

func New

func New(p Params) (r Result, err error)

type Staging

type Staging interface {
	Start() error
	Shutdown() error
	Stage(hashes ...InfoHashWithPeer)
	Requested() <-chan Request
	Reject(hash model.Hash20)
	Respond(ctx context.Context, response Response)
	Count() uint
}

Jump to

Keyboard shortcuts

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