services

package
v0.0.0-...-6d823c3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWSBucketFlag                          = "aws-bucket"
	AWSBucketSpreadFlag                    = "aws-bucket-spread"
	AWSConcurrency                         = "aws-concurrency"
	AWSStatWriteDelayFlag                  = "aws-stat-write-delay"
	UseSnapshotFlag                        = "use-snapshot"
	SnapshotStartThresholdFlag             = "snapshot-start-threshold"
	SnapshotDownloadRatioFlag              = "snapshot-download-ratio"
	SnapshotWriteTimeoutFlag               = "snapshot-write-timeout"
	SnapshotStartFullDownloadThresholdFlag = "snapshot-start-full-download-threshold"
	SnapshotTorrentSizeLimitFlag           = "snapshot-torrent-size-limit"
)
View Source
const (
	DownloadedSizePath  = "downloaded_size"
	TouchPath           = "touch"
	CompletedPiecesPath = "completed_pieces"
)
View Source
const (
	StatHostFlag = "stat-host"
	StatPortFlag = "stat-port"
)
View Source
const (
	TorrentClientDownloadRateFlag = "download-rate"
	TorrentClientUserAgentFlag    = "user-agent"
	HttpProxyFlag                 = "http-proxy"
	DisableUtpFlag                = "disable-utp"
	DisableWebTorrentFlag         = "disable-webtorrent"
)
View Source
const (
	TorrentStoreHostFlag = "torrent-store-host"
	TorrentStorePortFlag = "torrent-store-port"
)
View Source
const (
	WebHostFlag = "host"
	WebPortFlag = "port"
)
View Source
const (
	PiecePath         = "piece/"
	SourceTorrentPath = "source.torrent"
	MaxReadahead      = 250 * 1024 * 1024
	MinReadahead      = 1024 * 1024
)
View Source
const (
	BucketTTL = 30 * 60
)
View Source
const (
	DataDirFlag = "data-dir"
)
View Source
const (
	InputFlag string = "input"
)

Variables

This section is empty.

Functions

func DistributeByHash

func DistributeByHash(dirs []string, hash string) (string, error)

func GetDir

func GetDir(location string, hash string) (string, error)

func NewMMap

func NewMMap(baseDir string) *mmapClientImpl

func NewThrottledReader

func NewThrottledReader(r io.ReadSeeker, b *ratelimit.Bucket) io.ReadSeeker

func RegisterFileStoreFlags

func RegisterFileStoreFlags(f []cli.Flag) []cli.Flag

func RegisterSnapshotFlags

func RegisterSnapshotFlags(f []cli.Flag) []cli.Flag

func RegisterStatFlags

func RegisterStatFlags(f []cli.Flag) []cli.Flag

func RegisterTorrentClientFlags

func RegisterTorrentClientFlags(f []cli.Flag) []cli.Flag

func RegisterTorrentStoreFlags

func RegisterTorrentStoreFlags(f []cli.Flag) []cli.Flag

func RegisterWebFlags

func RegisterWebFlags(f []cli.Flag) []cli.Flag

Types

type BlockListener

type BlockListener struct {
	// contains filtered or unexported fields
}

func NewBlockListener

func NewBlockListener(l net.Listener, blockedIP []net.IP) *BlockListener

func (*BlockListener) Accept

func (ln *BlockListener) Accept() (net.Conn, error)

func (*BlockListener) Addr

func (ln *BlockListener) Addr() net.Addr

func (*BlockListener) Close

func (ln *BlockListener) Close() error

type BucketPool

type BucketPool struct {
	// contains filtered or unexported fields
}

func NewBucketPool

func NewBucketPool() *BucketPool

func (*BucketPool) Get

func (s *BucketPool) Get(sessionID string, rate string) (*ratelimit.Bucket, error)

type CompletedPieces

type CompletedPieces map[[20]byte]bool

func (CompletedPieces) Add

func (cp CompletedPieces) Add(p *torrent.Piece)

func (CompletedPieces) FromBytes

func (cp CompletedPieces) FromBytes(data []byte)

func (CompletedPieces) Has

func (cp CompletedPieces) Has(p *torrent.Piece) bool

func (CompletedPieces) Len

func (cp CompletedPieces) Len() int

func (CompletedPieces) ToBytes

func (cp CompletedPieces) ToBytes() []byte

type FileMapping

type FileMapping = mmap_span.Mmap

func WrapFileMapping

func WrapFileMapping(region mmap.MMap, file *os.File) FileMapping

Combines a mmapped region and file into a storage Mmap abstraction, which handles closing the mmap file handle.

type FileStoreMap

type FileStoreMap struct {
	// contains filtered or unexported fields
}

func NewFileStoreMap

func NewFileStoreMap(c *cli.Context) *FileStoreMap

func (*FileStoreMap) Get

func (s *FileStoreMap) Get(h string) (*metainfo.MetaInfo, error)

func (*FileStoreMap) List

func (s *FileStoreMap) List() ([]string, error)

type PieceReader

type PieceReader struct {
	// contains filtered or unexported fields
}

func NewPieceReader

func NewPieceReader(r torrent.Reader, p *torrent.Piece) *PieceReader

func (*PieceReader) Close

func (s *PieceReader) Close() error

func (*PieceReader) Read

func (s *PieceReader) Read(p []byte) (n int, err error)

func (*PieceReader) Seek

func (s *PieceReader) Seek(offset int64, whence int) (int64, error)

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

func NewSnapshot

func NewSnapshot(c *cli.Context, t *torrent.Torrent, s3 *cs.S3Client, l *log.Entry) (*Snapshot, error)

func (*Snapshot) Add

func (s *Snapshot) Add(i int64)

type SnapshotMap

type SnapshotMap struct {
	lazymap.LazyMap
	// contains filtered or unexported fields
}

func NewSnapshotMap

func NewSnapshotMap(c *cli.Context, tm *TorrentMap, s3 *cs.S3Client) *SnapshotMap

func (*SnapshotMap) Get

func (s *SnapshotMap) Get(h string) (*Snapshot, error)

func (*SnapshotMap) WrapWriter

type SnapshotResponseWriter

type SnapshotResponseWriter struct {
	// contains filtered or unexported fields
}

func NewSnapshotResponseWriter

func NewSnapshotResponseWriter(w http.ResponseWriter, sn *Snapshot, sm *SnapshotMap, h string) *SnapshotResponseWriter

func (*SnapshotResponseWriter) Header

func (s *SnapshotResponseWriter) Header() http.Header

func (*SnapshotResponseWriter) Write

func (s *SnapshotResponseWriter) Write(buf []byte) (int, error)

func (*SnapshotResponseWriter) WriteHeader

func (s *SnapshotResponseWriter) WriteHeader(code int)

type Stat

type Stat struct {
	// contains filtered or unexported fields
}

func NewStat

func NewStat(tm *TorrentMap) *Stat

func (*Stat) Files

func (s *Stat) Files(ctx context.Context, _ *pb.FilesRequest) (*pb.FilesReply, error)

func (*Stat) Stat

func (s *Stat) Stat(ctx context.Context, in *pb.StatRequest) (*pb.StatReply, error)

func (*Stat) StatStream

func (s *Stat) StatStream(in *pb.StatRequest, stream pb.TorrentWebSeeder_StatStreamServer) error

type StatGRPC

type StatGRPC struct {
	// contains filtered or unexported fields
}

func NewStatGRPC

func NewStatGRPC(c *cli.Context, st *Stat) *StatGRPC

func (*StatGRPC) Close

func (ss *StatGRPC) Close()

func (*StatGRPC) Get

func (s *StatGRPC) Get() (*grpc.Server, error)

func (*StatGRPC) Serve

func (ss *StatGRPC) Serve() error

type StatStreamServer

type StatStreamServer struct {
	// contains filtered or unexported fields
}

func (*StatStreamServer) Context

func (s *StatStreamServer) Context() context.Context

func (*StatStreamServer) Ping

func (s *StatStreamServer) Ping()

func (*StatStreamServer) RecvMsg

func (s *StatStreamServer) RecvMsg(m interface{}) error

func (*StatStreamServer) Send

func (s *StatStreamServer) Send(m *pb.StatReply) error

func (*StatStreamServer) SendHeader

func (s *StatStreamServer) SendHeader(m metadata.MD) error

func (*StatStreamServer) SendMsg

func (s *StatStreamServer) SendMsg(m interface{}) error

func (*StatStreamServer) SetHeader

func (s *StatStreamServer) SetHeader(m metadata.MD) error

func (*StatStreamServer) SetTrailer

func (s *StatStreamServer) SetTrailer(m metadata.MD)

type StatWeb

type StatWeb struct {
	// contains filtered or unexported fields
}

func NewStatWeb

func NewStatWeb(st *Stat) *StatWeb

func (*StatWeb) Serve

func (s *StatWeb) Serve(w http.ResponseWriter, r *http.Request, h string, p string) error

type ThrottledReader

type ThrottledReader struct {
	io.ReadSeeker
	// contains filtered or unexported fields
}

func (ThrottledReader) Read

func (r ThrottledReader) Read(p []byte) (int, error)

type TorrentClient

type TorrentClient struct {
	// contains filtered or unexported fields
}

func NewTorrentClient

func NewTorrentClient(c *cli.Context) (*TorrentClient, error)

func (*TorrentClient) Close

func (s *TorrentClient) Close()

func (*TorrentClient) Get

func (s *TorrentClient) Get() (*torrent.Client, error)

type TorrentMap

type TorrentMap struct {
	// contains filtered or unexported fields
}

func NewTorrentMap

func NewTorrentMap(tc *TorrentClient, tsm *TorrentStoreMap, fsm *FileStoreMap, tm *TouchMap) *TorrentMap

func (*TorrentMap) Get

func (s *TorrentMap) Get(h string) (*torrent.Torrent, error)

func (*TorrentMap) List

func (s *TorrentMap) List() ([]string, error)

type TorrentStore

type TorrentStore struct {
	// contains filtered or unexported fields
}

func NewTorrentStore

func NewTorrentStore(c *cli.Context) *TorrentStore

func (*TorrentStore) Close

func (s *TorrentStore) Close()

func (*TorrentStore) Get

type TorrentStoreMap

type TorrentStoreMap struct {
	lazymap.LazyMap
	// contains filtered or unexported fields
}

func NewTorrentStoreMap

func NewTorrentStoreMap(ts *TorrentStore) *TorrentStoreMap

func (*TorrentStoreMap) Get

type TouchMap

type TouchMap struct {
	lazymap.LazyMap
	// contains filtered or unexported fields
}

func NewTouchMap

func NewTouchMap(c *cli.Context) *TouchMap

func (*TouchMap) Touch

func (s *TouchMap) Touch(h string) error

type Web

type Web struct {
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb(c *cli.Context, ws *WebSeeder) *Web

func (*Web) Close

func (s *Web) Close()

func (*Web) Serve

func (s *Web) Serve() error

type WebSeeder

type WebSeeder struct {
	// contains filtered or unexported fields
}

func NewWebSeeder

func NewWebSeeder(tm *TorrentMap, st *StatWeb, bp *BucketPool, sm *SnapshotMap) *WebSeeder

func (*WebSeeder) ServeHTTP

func (s *WebSeeder) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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