Documentation ¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type Torrent
- func (t *Torrent) Bitfield() *bitset.BitSet
- func (t *Torrent) BytesDownloaded() int64
- func (t *Torrent) Complete() bool
- func (t *Torrent) Digest() core.Digest
- func (t *Torrent) GetPieceReader(pi int) (storage.PieceReader, error)
- func (t *Torrent) HasPiece(pi int) bool
- func (t *Torrent) InfoHash() core.InfoHash
- func (t *Torrent) Length() int64
- func (t *Torrent) MaxPieceLength() int64
- func (t *Torrent) MissingPieces() []int
- func (t *Torrent) NumPieces() int
- func (t *Torrent) PieceLength(pi int) int64
- func (t *Torrent) Stat() *storage.TorrentInfo
- func (t *Torrent) String() string
- func (t *Torrent) WritePiece(src storage.PieceReader, pi int) error
- type TorrentArchive
- func (a *TorrentArchive) CreateTorrent(namespace string, d core.Digest) (storage.Torrent, error)
- func (a *TorrentArchive) DeleteTorrent(d core.Digest) error
- func (a *TorrentArchive) GetTorrent(namespace string, d core.Digest) (storage.Torrent, error)
- func (a *TorrentArchive) Stat(namespace string, d core.Digest) (*storage.TorrentInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Torrent ¶
type Torrent struct {
// contains filtered or unexported fields
}
Torrent implements a Torrent on top of an AgentFileStore. It Allows concurrent writes on distinct pieces, and concurrent reads on all pieces. Behavior is undefined if multiple Torrent instances are backed by the same file store and metainfo.
func NewTorrent ¶
NewTorrent creates a new Torrent.
func TorrentFixture ¶
TorrentFixture returns a Torrent for the given metainfo for testing purposes.
func (*Torrent) Bitfield ¶
Bitfield returns the bitfield of pieces where true denotes a complete piece and false denotes an incomplete piece.
func (*Torrent) BytesDownloaded ¶
BytesDownloaded returns an estimate of the number of bytes downloaded in the torrent.
func (*Torrent) Complete ¶
Complete indicates whether the torrent is complete or not. Completeness is defined by whether the torrent file has been committed to the cache directory.
func (*Torrent) GetPieceReader ¶
func (t *Torrent) GetPieceReader(pi int) (storage.PieceReader, error)
GetPieceReader returns a reader for piece pi.
func (*Torrent) MaxPieceLength ¶
MaxPieceLength returns the longest piece length of the torrent.
func (*Torrent) MissingPieces ¶
MissingPieces returns the indeces of all missing pieces.
func (*Torrent) PieceLength ¶
PieceLength returns the length of piece pi.
func (*Torrent) Stat ¶
func (t *Torrent) Stat() *storage.TorrentInfo
Stat returns the storage.TorrentInfo for t.
func (*Torrent) WritePiece ¶
func (t *Torrent) WritePiece(src storage.PieceReader, pi int) error
WritePiece writes data to piece pi.
type TorrentArchive ¶
type TorrentArchive struct {
// contains filtered or unexported fields
}
TorrentArchive is capable of initializing torrents in the download directory and serving torrents from either the download or cache directory.
func NewTorrentArchive ¶
func NewTorrentArchive( stats tally.Scope, cads *store.CADownloadStore, mic metainfoclient.Client) *TorrentArchive
NewTorrentArchive creates a new TorrentArchive.
func TorrentArchiveFixture ¶
func TorrentArchiveFixture() (*TorrentArchive, func())
TorrentArchiveFixture returns a TorrrentArchive for testing purposes.
func (*TorrentArchive) CreateTorrent ¶
CreateTorrent returns a Torrent for either an existing metainfo / file on disk, or downloads metainfo and initializes the file. Returns ErrNotFound if no metainfo was found.
func (*TorrentArchive) DeleteTorrent ¶
func (a *TorrentArchive) DeleteTorrent(d core.Digest) error
DeleteTorrent deletes a torrent from disk.
func (*TorrentArchive) GetTorrent ¶
GetTorrent returns a Torrent for an existing metainfo / file on disk. Ignores namespace.
func (*TorrentArchive) Stat ¶
func (a *TorrentArchive) Stat(namespace string, d core.Digest) (*storage.TorrentInfo, error)
Stat returns TorrentInfo for the given digest. Returns os.ErrNotExist if the file does not exist. Ignores namespace.