boltdbresumer

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 6 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
	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"),
	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 DB

type DB struct {
	resumer.Resumer
	// contains filtered or unexported fields
}

func Open

func Open(path string, infoHash []byte) (*DB, error)

func (*DB) Close

func (r *DB) Close() error

type Resumer

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

func New

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

func (*Resumer) Read

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

func (*Resumer) Write

func (r *Resumer) Write(spec *Spec) error

func (*Resumer) WriteBitfield

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

func (*Resumer) WriteInfo

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

type Spec

type Spec struct {
	InfoHash        []byte
	Dest            string
	Port            int
	Name            string
	Trackers        []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