Documentation ¶
Index ¶
- Constants
- func RegisterPreloadFlags(c *cli.App)
- func RegisterS3StorageFlags(c *cli.App)
- func RegisterWebFlags(c *cli.App)
- type CompletedPieces
- type CompletedPiecesLoader
- type CompletedPiecesPool
- type HTTPPieceLoader
- type HTTPPiecePool
- type HTTPProxyMap
- type LeakyBuffer
- type MetaInfoLoader
- type MetaInfoPool
- type PieceLoader
- type PiecePool
- type PiecePreloader
- type PreloadPiecePool
- type PreloadQueue
- type PreloadQueuePool
- type PreloadReader
- type RWConnector
- type Reader
- type ReaderPool
- type S3PieceLoader
- type S3PiecePool
- type S3Storage
- func (s *S3Storage) GetCompletedPieces(ctx context.Context, h string) (io.ReadCloser, error)
- func (s *S3Storage) GetPiece(ctx context.Context, h string, p string, start int64, end int64, full bool) (io.ReadCloser, error)
- func (s *S3Storage) GetTorrent(ctx context.Context, h string) (io.ReadCloser, error)
- func (s *S3Storage) TouchTorrent(ctx context.Context, h string) (err error)
- type TimerWrapper
- type TorrentTouchPool
- type TorrentToucher
- type Web
Constants ¶
View Source
const ( PRELOAD_TTL = 10 PRELOAD_TIMEOUT = 60 PRELOAD_CACHE_PATH = "cache" PRELOAD_CLEAR_CACHE_ON_EXIT_FLAG = "preload-clear-cache-on-exit" PRELOAD_CACHE_SIZE_FLAG = "preload-cache-size" )
View Source
const ( AWS_BUCKET = "aws-bucket" AWS_BUCKET_SPREAD = "aws-bucket-spread" )
View Source
const ( WEB_HOST_FLAG = "host" WEB_PORT_FLAG = "port" WEB_SOURCE_URL = "source-url" )
View Source
const (
COMPLETED_PIECES_TTL = 300
)
View Source
const (
MAX_PRELOAD_BYTES = 30_000_000
)
View Source
const (
META_INFO_TTL = 60
)
View Source
const (
PRELOAD_QUEUE_CONCURRENCY = 3
)
View Source
const (
PRELOAD_QUEUE_TTL = 60
)
View Source
const (
TORRENT_TOUCH_TTL = 600
)
Variables ¶
This section is empty.
Functions ¶
func RegisterPreloadFlags ¶
func RegisterS3StorageFlags ¶
func RegisterWebFlags ¶
Types ¶
type CompletedPieces ¶
func (CompletedPieces) Add ¶
func (cp CompletedPieces) Add(h [20]byte)
func (CompletedPieces) FromBytes ¶
func (cp CompletedPieces) FromBytes(data []byte)
func (CompletedPieces) Has ¶
func (cp CompletedPieces) Has(h [20]byte) bool
func (CompletedPieces) ToBytes ¶
func (cp CompletedPieces) ToBytes() []byte
type CompletedPiecesLoader ¶
type CompletedPiecesLoader struct {
// contains filtered or unexported fields
}
func NewCompletedPiecesLoader ¶
func NewCompletedPiecesLoader(ctx context.Context, infoHash string, st *S3Storage) *CompletedPiecesLoader
func (*CompletedPiecesLoader) Get ¶
func (s *CompletedPiecesLoader) Get() (*CompletedPieces, error)
type CompletedPiecesPool ¶
type CompletedPiecesPool struct {
// contains filtered or unexported fields
}
func NewCompletedPiecesPool ¶
func NewCompletedPiecesPool(st *S3Storage) *CompletedPiecesPool
func (*CompletedPiecesPool) Get ¶
func (s *CompletedPiecesPool) Get(h string) (*CompletedPieces, error)
type HTTPPieceLoader ¶
type HTTPPieceLoader struct {
// contains filtered or unexported fields
}
func NewHTTPPieceLoader ¶
func (*HTTPPieceLoader) Get ¶
func (s *HTTPPieceLoader) Get() (io.ReadCloser, error)
type HTTPPiecePool ¶
type HTTPPiecePool struct {
// contains filtered or unexported fields
}
func NewHTTPPiecePool ¶
func NewHTTPPiecePool(cl *http.Client) *HTTPPiecePool
type HTTPProxyMap ¶
func NewHTTPProxyMap ¶
func NewHTTPProxyMap() *HTTPProxyMap
func (*HTTPProxyMap) Get ¶
func (s *HTTPProxyMap) Get(u *url.URL) *httputil.ReverseProxy
type LeakyBuffer ¶
type LeakyBuffer struct {
// contains filtered or unexported fields
}
func NewLeakyBuffer ¶
func NewLeakyBuffer(size int, bufSize int64) *LeakyBuffer
func (*LeakyBuffer) Get ¶
func (s *LeakyBuffer) Get() []byte
func (*LeakyBuffer) Put ¶
func (s *LeakyBuffer) Put(b []byte)
type MetaInfoLoader ¶
type MetaInfoLoader struct {
// contains filtered or unexported fields
}
func NewMetaInfoLoader ¶
func NewMetaInfoLoader(ctx context.Context, infoHash string, st *S3Storage) *MetaInfoLoader
type MetaInfoPool ¶
type MetaInfoPool struct {
// contains filtered or unexported fields
}
func NewMetaInfoPool ¶
func NewMetaInfoPool(st *S3Storage) *MetaInfoPool
type PieceLoader ¶
type PieceLoader struct {
// contains filtered or unexported fields
}
func NewPieceLoader ¶
func NewPieceLoader(ctx context.Context, cpp *CompletedPiecesPool, s3pp *S3PiecePool, httppp *HTTPPiecePool, src string, h string, p string, q string, start int64, end int64, full bool) *PieceLoader
func (*PieceLoader) Get ¶
func (s *PieceLoader) Get() (io.ReadCloser, error)
type PiecePool ¶
type PiecePool struct {
// contains filtered or unexported fields
}
func NewPiecePool ¶
func NewPiecePool(cpp *CompletedPiecesPool, s3pp *S3PiecePool, httppp *HTTPPiecePool) *PiecePool
type PiecePreloader ¶
type PiecePreloader struct {
// contains filtered or unexported fields
}
func NewPiecePreloader ¶
func NewPiecePreloader(ctx context.Context, pp *PiecePool, lb *LeakyBuffer, src string, h string, p string, q string) *PiecePreloader
func (*PiecePreloader) Clean ¶
func (s *PiecePreloader) Clean() error
func (*PiecePreloader) Get ¶
func (s *PiecePreloader) Get(start int64, end int64, full bool) (io.ReadCloser, error)
func (*PiecePreloader) Preload ¶
func (s *PiecePreloader) Preload() error
type PreloadPiecePool ¶
type PreloadPiecePool struct {
// contains filtered or unexported fields
}
func NewPreloadPiecePool ¶
func NewPreloadPiecePool(c *cli.Context, pp *PiecePool, lb *LeakyBuffer) (*PreloadPiecePool, error)
func (*PreloadPiecePool) Close ¶
func (s *PreloadPiecePool) Close()
type PreloadQueue ¶
type PreloadQueue struct {
// contains filtered or unexported fields
}
func NewPreloadQueue ¶
func NewPreloadQueue(pp *PreloadPiecePool) *PreloadQueue
func (*PreloadQueue) Close ¶
func (s *PreloadQueue) Close()
type PreloadQueuePool ¶
type PreloadQueuePool struct {
// contains filtered or unexported fields
}
func NewPreloadQueuePool ¶
func NewPreloadQueuePool(pp *PreloadPiecePool) *PreloadQueuePool
type PreloadReader ¶
type PreloadReader struct {
// contains filtered or unexported fields
}
func NewPreloadReader ¶
func NewPreloadReader(f *os.File, r io.Reader, lb *LeakyBuffer, h string, p string) *PreloadReader
func (*PreloadReader) Close ¶
func (s *PreloadReader) Close() error
type RWConnector ¶
type RWConnector struct {
// contains filtered or unexported fields
}
func NewRWConnector ¶
func NewRWConnector(w http.ResponseWriter, lb *LeakyBuffer) *RWConnector
func (*RWConnector) CloseNotify ¶
func (s *RWConnector) CloseNotify() <-chan bool
func (*RWConnector) Flush ¶
func (s *RWConnector) Flush()
func (*RWConnector) Header ¶
func (s *RWConnector) Header() http.Header
func (*RWConnector) WriteHeader ¶
func (s *RWConnector) WriteHeader(statusCode int)
type Reader ¶
type Reader struct { N int64 // contains filtered or unexported fields }
func NewReader ¶
func NewReader(ctx context.Context, mip *MetaInfoPool, pp *PreloadPiecePool, ttp *TorrentTouchPool, lb *LeakyBuffer, pqp *PreloadQueuePool, src string, hash string, query string, offset int64, length int64, pid string) *Reader
type ReaderPool ¶
type ReaderPool struct {
// contains filtered or unexported fields
}
func NewReaderPool ¶
func NewReaderPool(pp *PiecePool, mip *MetaInfoPool, ttp *TorrentTouchPool, lb *LeakyBuffer, ppp *PreloadPiecePool, pqp *PreloadQueuePool) *ReaderPool
type S3PieceLoader ¶
type S3PieceLoader struct {
// contains filtered or unexported fields
}
func NewS3PieceLoader ¶
func (*S3PieceLoader) Get ¶
func (s *S3PieceLoader) Get() (io.ReadCloser, error)
type S3PiecePool ¶
type S3PiecePool struct {
// contains filtered or unexported fields
}
func NewS3PiecePool ¶
func NewS3PiecePool(st *S3Storage) *S3PiecePool
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func (*S3Storage) GetCompletedPieces ¶
func (*S3Storage) GetTorrent ¶
type TimerWrapper ¶
type TimerWrapper struct {
// contains filtered or unexported fields
}
func NewTimerWrapper ¶
func NewTimerWrapper(d time.Duration) *TimerWrapper
func (*TimerWrapper) Get ¶
func (s *TimerWrapper) Get() *time.Timer
type TorrentTouchPool ¶
type TorrentTouchPool struct {
// contains filtered or unexported fields
}
func NewTorrentTouchPool ¶
func NewTorrentTouchPool(st *S3Storage) *TorrentTouchPool
func (*TorrentTouchPool) Touch ¶
func (s *TorrentTouchPool) Touch(h string) error
type TorrentToucher ¶
type TorrentToucher struct {
// contains filtered or unexported fields
}
func NewTorrentToucher ¶
func NewTorrentToucher(ctx context.Context, infoHash string, st *S3Storage) *TorrentToucher
func (*TorrentToucher) Touch ¶
func (s *TorrentToucher) Touch() error
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
func NewWeb ¶
func NewWeb(c *cli.Context, rp *ReaderPool, cp *CompletedPiecesPool, lb *LeakyBuffer, pm *HTTPProxyMap) *Web
Source Files ¶
- completed_pieces.go
- completed_pieces_loader.go
- completed_pieces_pool.go
- http_piece_loader.go
- http_piece_pool.go
- http_proxy.go
- leaky_buffer.go
- metainfo_loader.go
- metainfo_pool.go
- piece_loader.go
- piece_pool.go
- preload_piece_pool.go
- preload_queue.go
- preload_queue_pool.go
- reader.go
- reader_pool.go
- rw_connector.go
- s3_piece_loader.go
- s3_piece_pool.go
- s3_storage.go
- timer_wrapper.go
- torrent_touch_pool.go
- torrent_toucher.go
- web.go
Click to show internal directories.
Click to hide internal directories.