Documentation ¶
Overview ¶
Package boltdbresumer provides a Resumer implementation that uses a Bolt database file as storage.
Index ¶
- Variables
- type Resumer
- func (r *Resumer) Read(torrentID string) (spec *Spec, err error)
- func (r *Resumer) Write(torrentID string, spec *Spec) error
- func (r *Resumer) WriteBitfield(torrentID string, value []byte) error
- func (r *Resumer) WriteCompleteCmdRun(torrentID string) error
- func (r *Resumer) WriteInfo(torrentID string, value []byte) error
- func (r *Resumer) WriteStarted(torrentID string, value bool) error
- type Spec
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 Started []byte CompleteCmdRun []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"), Started: []byte("started"), CompleteCmdRun: []byte("complete_cmd_run"), }
Keys for the persisten storage.
Functions ¶
This section is empty.
Types ¶
type Resumer ¶
type Resumer struct {
// contains filtered or unexported fields
}
Resumer contains methods for saving/loading resume information of a torrent to a BoltDB database.
func (*Resumer) WriteBitfield ¶
WriteBitfield writes only bitfield of a torrent.
func (*Resumer) WriteCompleteCmdRun ¶
WriteCompleteCmdRun writes the start status of a torrent.
type Spec ¶
type Spec struct { InfoHash []byte 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 Started bool StopAfterDownload bool CompleteCmdRun bool }
Spec contains fields for resuming an existing torrent.
func (Spec) MarshalJSON ¶
MarshalJSON converts the Spec to a JSON string.
func (*Spec) UnmarshalJSON ¶
UnmarshalJSON fills the Spec from a JSON string.
Click to show internal directories.
Click to hide internal directories.