Documentation
¶
Index ¶
- Variables
- type BlockContent
- type BoostDataFetcher
- type CVMStorage
- type Config
- type FileStorage
- func (fs *FileStorage) AddBlock(b *types.Block) error
- func (fs *FileStorage) Blocks() []*types.Block
- func (fs *FileStorage) Close() error
- func (fs *FileStorage) Files() []*types.FileInfo
- func (fs *FileStorage) Flush() error
- func (fs *FileStorage) GetBlockByNumber(blockNum uint64) *types.Block
- func (fs *FileStorage) GetFileByAddr(addr common.Address) *types.FileInfo
- func (fs *FileStorage) GetRootByNumber(number uint64) (root []byte)
- func (fs *FileStorage) ID() uint64
- func (fs *FileStorage) NewFileInfo(Meta *types.FileMeta) *types.FileInfo
- func (fs *FileStorage) Reset() error
- func (fs *FileStorage) Root() common.Hash
- func (fs *FileStorage) Txs() uint64
- func (fs *FileStorage) UpdateFile(x *types.FileInfo) (uint64, bool, error)
- func (fs *FileStorage) Version() string
- type GeneralMessage
- type Monitor
- type Torrent
- func (t *Torrent) BoostOff()
- func (t *Torrent) BytesLeft() int64
- func (t *Torrent) Finished() bool
- func (t *Torrent) InfoHash() string
- func (t *Torrent) IsAvailable() bool
- func (t *Torrent) Pause()
- func (t *Torrent) Paused() bool
- func (t *Torrent) Pending() bool
- func (t *Torrent) ReloadFile(files []string, datas [][]byte, tm *TorrentManager)
- func (t *Torrent) ReloadTorrent(data []byte, tm *TorrentManager) error
- func (t *Torrent) Run(slot int)
- func (t *Torrent) Running() bool
- func (t *Torrent) Seed()
- func (t *Torrent) SeedInQueue()
- func (t *Torrent) Seeding() bool
- func (t *Torrent) WriteTorrent() error
- type TorrentFS
- func (tfs *TorrentFS) APIs() []rpc.API
- func (fs *TorrentFS) Available(infohash string, rawSize int64) (bool, error)
- func (t *TorrentFS) Config() *Config
- func (fs *TorrentFS) GetFile(infohash string, subpath string) ([]byte, error)
- func (t *TorrentFS) Monitor() *Monitor
- func (tfs *TorrentFS) Protocols() []p2p.Protocol
- func (tfs *TorrentFS) Start(server *p2p.Server) error
- func (tfs *TorrentFS) Stop() error
- type TorrentManager
- func (tm *TorrentManager) AddInfoHash(ih metainfo.Hash, BytesRequested int64) *Torrent
- func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Torrent
- func (tm *TorrentManager) Close() error
- func (tm *TorrentManager) CreateTorrent(t *torrent.Torrent, requested int64, status int, ih metainfo.Hash) *Torrent
- func (tm *TorrentManager) GetLimitation(value int64) int64
- func (tm *TorrentManager) GetTorrent(ih metainfo.Hash) *Torrent
- func (tm *TorrentManager) SetTorrent(ih metainfo.Hash, torrent *Torrent)
- func (tm *TorrentManager) SetTrackers(trackers []string, disableTCP, boost bool)
- func (tm *TorrentManager) Start() error
- func (tm *TorrentManager) UpdateDynamicTrackers(trackers []string)
- func (tm *TorrentManager) UpdateInfoHash(ih metainfo.Hash, BytesRequested int64)
- func (tm *TorrentManager) UpdateTorrent(input interface{}) error
- type TorrentManagerAPI
Constants ¶
This section is empty.
Variables ¶
var BadFiles = map[string]bool{ "3edcb8a793887d92db12d53124955681d5c20a43": true, }
var DefaultConfig = Config{ Port: 40401, DefaultTrackers: params.MainnetTrackers, BoostNodes: params.TorrentBoostNodes, SyncMode: "full", DisableUTP: true, DisableDHT: false, DisableTCP: false, MaxSeedingNum: 1024, MaxActiveNum: 1024, FullSeed: false, Boost: false, Quiet: true, }
DefaultConfig contains default settings for the storage.
var (
ErrReadDataFromBoltDB = errors.New("bolt DB Read Error")
)
var Str404NotFound []byte = []byte{} /* 178 elements not displayed */
Functions ¶
This section is empty.
Types ¶
type BlockContent ¶ added in v1.9.51
type BlockContent struct {
// contains filtered or unexported fields
}
func (BlockContent) CalculateHash ¶ added in v1.9.51
func (t BlockContent) CalculateHash() ([]byte, error)
type BoostDataFetcher ¶ added in v1.0.0
type BoostDataFetcher struct {
// contains filtered or unexported fields
}
func NewBoostDataFetcher ¶ added in v1.0.0
func NewBoostDataFetcher(nodes []string) *BoostDataFetcher
func (*BoostDataFetcher) GetFile ¶ added in v1.0.0
func (f *BoostDataFetcher) GetFile(ih, subpath string) ([]byte, error)
func (*BoostDataFetcher) GetTorrent ¶ added in v1.0.0
func (f *BoostDataFetcher) GetTorrent(ih string) ([]byte, error)
type CVMStorage ¶ added in v1.0.0
type CVMStorage interface {
Available(infohash string, rawSize int64) (bool, error)
GetFile(infohash string, path string) ([]byte, error)
Stop() error
}
func GetStorage ¶ added in v1.0.0
func GetStorage() CVMStorage
type Config ¶
type Config struct {
// Host is the host interface on which to start the storage server. If this
// field is empty, no storage will be started.
Port int `toml:",omitempty"`
DataDir string `toml:",omitempty"`
RpcURI string `toml:",omitempty"`
IpcPath string `toml:",omitempty"`
DisableUTP bool `toml:",omitempty"`
DisableTCP bool `toml:",omitempty"`
DisableDHT bool `toml:",omitempty"`
DefaultTrackers []string `toml:",omitempty"`
BoostNodes []string `toml:",omitempty"`
SyncMode string `toml:",omitempty"`
MaxSeedingNum int `toml:",omitempty"`
MaxActiveNum int `toml:",omitempty"`
FullSeed bool
Boost bool
Quiet bool
}
Config ...
type FileStorage ¶
type FileStorage struct {
CheckPoint uint64
LastListenBlockNumber uint64
// contains filtered or unexported fields
}
func NewFileStorage ¶
func NewFileStorage(config *Config) (*FileStorage, error)
func (*FileStorage) AddBlock ¶
func (fs *FileStorage) AddBlock(b *types.Block) error
func (fs *FileStorage) addBlock(b *Block, record bool) error {
func (*FileStorage) Blocks ¶ added in v1.9.51
func (fs *FileStorage) Blocks() []*types.Block
func (*FileStorage) Close ¶ added in v1.0.0
func (fs *FileStorage) Close() error
func (*FileStorage) Files ¶ added in v1.9.51
func (fs *FileStorage) Files() []*types.FileInfo
func (*FileStorage) Flush ¶ added in v1.9.51
func (fs *FileStorage) Flush() error
func (*FileStorage) GetBlockByNumber ¶ added in v1.0.0
func (fs *FileStorage) GetBlockByNumber(blockNum uint64) *types.Block
func (*FileStorage) GetFileByAddr ¶
func (fs *FileStorage) GetFileByAddr(addr common.Address) *types.FileInfo
func (*FileStorage) GetRootByNumber ¶ added in v1.9.51
func (fs *FileStorage) GetRootByNumber(number uint64) (root []byte)
func (*FileStorage) ID ¶ added in v1.9.51
func (fs *FileStorage) ID() uint64
func (*FileStorage) NewFileInfo ¶ added in v1.0.0
func (fs *FileStorage) NewFileInfo(Meta *types.FileMeta) *types.FileInfo
func (*FileStorage) Reset ¶ added in v1.9.51
func (fs *FileStorage) Reset() error
func (*FileStorage) Root ¶ added in v1.9.51
func (fs *FileStorage) Root() common.Hash
func (*FileStorage) Txs ¶ added in v1.9.51
func (fs *FileStorage) Txs() uint64
func (*FileStorage) UpdateFile ¶ added in v1.9.51
func (fs *FileStorage) UpdateFile(x *FileInfo, b *Block, prog bool) (uint64, bool, error) {
func (*FileStorage) Version ¶ added in v1.9.51
func (fs *FileStorage) Version() string
type GeneralMessage ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor observes the data changes on the blockchain and synchronizes. cl for ipc/rpc communication, dl for download manager, and fs for data storage.
func NewMonitor ¶
NewMonitor creates a new instance of monitor. Once Ipcpath is settle, this method prefers to build socket connection in order to get higher communicating performance. IpcPath is unavailable on windows.
type Torrent ¶
func (*Torrent) IsAvailable ¶ added in v1.0.0
func (*Torrent) ReloadFile ¶ added in v1.0.0
func (t *Torrent) ReloadFile(files []string, datas [][]byte, tm *TorrentManager)
func (*Torrent) ReloadTorrent ¶ added in v1.0.0
func (t *Torrent) ReloadTorrent(data []byte, tm *TorrentManager) error
func (*Torrent) SeedInQueue ¶ added in v1.0.0
func (t *Torrent) SeedInQueue()
func (*Torrent) WriteTorrent ¶ added in v1.0.0
type TorrentFS ¶
type TorrentFS struct {
// contains filtered or unexported fields
}
TorrentFS contains the torrent file system internals.
type TorrentManager ¶
type TorrentManager struct {
DataDir string
TmpDataDir string
// contains filtered or unexported fields
}
func NewTorrentManager ¶
func NewTorrentManager(config *Config, fsid uint64) (error, *TorrentManager)
NewTorrentManager ...
func (*TorrentManager) AddInfoHash ¶ added in v1.0.0
func (tm *TorrentManager) AddInfoHash(ih metainfo.Hash, BytesRequested int64) *Torrent
func (*TorrentManager) AddTorrent ¶
func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Torrent
func (*TorrentManager) Close ¶ added in v1.0.0
func (tm *TorrentManager) Close() error
func (*TorrentManager) CreateTorrent ¶ added in v1.0.0
func (*TorrentManager) GetLimitation ¶ added in v1.9.51
func (tm *TorrentManager) GetLimitation(value int64) int64
func (*TorrentManager) GetTorrent ¶ added in v1.0.0
func (tm *TorrentManager) GetTorrent(ih metainfo.Hash) *Torrent
func (*TorrentManager) SetTorrent ¶ added in v1.0.0
func (tm *TorrentManager) SetTorrent(ih metainfo.Hash, torrent *Torrent)
func (*TorrentManager) SetTrackers ¶
func (tm *TorrentManager) SetTrackers(trackers []string, disableTCP, boost bool)
func (*TorrentManager) Start ¶ added in v1.0.0
func (tm *TorrentManager) Start() error
func (*TorrentManager) UpdateDynamicTrackers ¶ added in v1.9.51
func (tm *TorrentManager) UpdateDynamicTrackers(trackers []string)
func (*TorrentManager) UpdateInfoHash ¶ added in v1.0.0
func (tm *TorrentManager) UpdateInfoHash(ih metainfo.Hash, BytesRequested int64)
UpdateInfoHash ...
func (*TorrentManager) UpdateTorrent ¶
func (tm *TorrentManager) UpdateTorrent(input interface{}) error