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.
Index ¶
- Variables
- 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 ¶
Torrent errors.
Functions ¶
This section is empty.
Types ¶
type Torrent ¶
type Torrent struct {
// contains filtered or unexported fields
}
Torrent is a read-only storage.Torrent. It allows concurrent reads on all pieces.
func NewTorrent ¶
NewTorrent creates a new Torrent.
func (*Torrent) Bitfield ¶
Bitfield always returns a completed bitfield.
func (*Torrent) BytesDownloaded ¶
BytesDownloaded always returns the total number of bytes.
func (*Torrent) Digest ¶
Digest returns the digest of the target blob.
func (*Torrent) GetPieceReader ¶
func (t *Torrent) GetPieceReader(pi int) (storage.PieceReader, error)
GetPieceReader returns a reader for piece pi.
func (*Torrent) HasPiece ¶
HasPiece returns if piece pi is complete. For Torrent it's always true.
func (*Torrent) InfoHash ¶
InfoHash returns the torrent metainfo hash.
func (*Torrent) Length ¶
Length returns the length of the target file.
func (*Torrent) MaxPieceLength ¶
MaxPieceLength returns the longest piece length of the torrent.
func (*Torrent) MissingPieces ¶
MissingPieces always returns empty list.
func (*Torrent) NumPieces ¶
NumPieces returns the number of pieces in the torrent.
func (*Torrent) PieceLength ¶
PieceLength returns the length of piece pi.
func (*Torrent) Stat ¶
func (t *Torrent) Stat() *storage.TorrentInfo
Stat returns the TorrentInfo for t.
type TorrentArchive ¶
type TorrentArchive struct {
// contains filtered or unexported fields
}
TorrentArchive is a TorrentArchive for origin peers. It assumes that all files (including metainfo) are already downloaded and in the cache directory.
func NewTorrentArchive ¶
func NewTorrentArchive( cas *store.CAStore, blobRefresher *blobrefresh.Refresher) *TorrentArchive
NewTorrentArchive creates a new TorrentArchive.
func (*TorrentArchive) CreateTorrent ¶
CreateTorrent is not supported.
func (*TorrentArchive) DeleteTorrent ¶
func (a *TorrentArchive) DeleteTorrent(d core.Digest) error
DeleteTorrent moves a torrent to the trash.
func (*TorrentArchive) GetTorrent ¶
GetTorrent returns a Torrent for an existing file on disk. If the file does not exist, attempts to re-fetch the file from the storae backend configured for namespace in a background goroutine, and returns os.ErrNotExist.
func (*TorrentArchive) Stat ¶
func (a *TorrentArchive) Stat(namespace string, d core.Digest) (*storage.TorrentInfo, error)
Stat returns TorrentInfo for given digest. If the file does not exist, attempts to re-fetch the file from the storae backend configured for namespace in a background goroutine.