boltdbresumer

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package boltdbresumer provides a Resumer implementation that uses a Bolt database file as storage.

Index

Constants

This section is empty.

Variables

View Source
var Keys = struct {
	InfoHash        []byte
	Port            []byte
	Name            []byte
	Trackers        []byte
	URLList         []byte
	FixedPeers      []byte
	Dest            []byte
	Info            []byte
	Bitfield        []byte
	AddedAt         []byte
	BytesDownloaded []byte
	BytesUploaded   []byte
	BytesWasted     []byte
	SeededFor       []byte
}{
	InfoHash:        []byte("info_hash"),
	Port:            []byte("port"),
	Name:            []byte("name"),
	Trackers:        []byte("trackers"),
	URLList:         []byte("url_list"),
	FixedPeers:      []byte("fixed_peers"),
	Dest:            []byte("dest"),
	Info:            []byte("info"),
	Bitfield:        []byte("bitfield"),
	AddedAt:         []byte("added_at"),
	BytesDownloaded: []byte("bytes_downloaded"),
	BytesUploaded:   []byte("bytes_uploaded"),
	BytesWasted:     []byte("bytes_wasted"),
	SeededFor:       []byte("seeded_for"),
}

Functions

This section is empty.

Types

type Resumer

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

func New

func New(db *bolt.DB, bucket []byte) (*Resumer, error)

func (*Resumer) Read

func (r *Resumer) Read(torrentID string) (*Spec, error)

func (*Resumer) Write

func (r *Resumer) Write(torrentID string, spec *Spec) error

func (*Resumer) WriteBitfield

func (r *Resumer) WriteBitfield(torrentID string, value []byte) error

func (*Resumer) WriteInfo

func (r *Resumer) WriteInfo(torrentID string, value []byte) error

type Spec

type Spec struct {
	InfoHash        []byte
	Dest            string
	Port            int
	Name            string
	Trackers        [][]string
	URLList         []string
	FixedPeers      []string
	Info            []byte
	Bitfield        []byte
	AddedAt         time.Time
	BytesDownloaded int64
	BytesUploaded   int64
	BytesWasted     int64
	SeededFor       time.Duration
}

Jump to

Keyboard shortcuts

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