Documentation
¶
Index ¶
- Variables
- func InitMemoryStore()
- type Conf
- type PeerStore
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) DeleteInfohash(key bittorrent.InfoHash) error
- func (s *Storage) DeletePeer(key bittorrent.InfoHash, peer bittorrent.Peer)
- func (s *Storage) GetAllInfoHash() []bittorrent.InfoHash
- func (s *Storage) GetAllPeers(key bittorrent.InfoHash, ignore *bittorrent.Peer) []bittorrent.Peer
- func (s *Storage) GetPeers(key bittorrent.InfoHash, p *bittorrent.Peer) (bittorrent.Peer, bittorrent.AnnounceRequest)
- func (s *Storage) Reset() error
- func (s *Storage) ResetPeer(key bittorrent.InfoHash) error
- func (s *Storage) SetPeer(key bittorrent.InfoHash, peer bittorrent.Peer, a bittorrent.AnnounceRequest) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Conf{ GCInterval: 10 * time.Second, }
ConfigDefault is the default config
Functions ¶
func InitMemoryStore ¶
func InitMemoryStore()
Types ¶
type Conf ¶
type Conf struct { // Time before deleting expired keys // // Default is 10 * time.Second GCInterval time.Duration }
Config defines the config for storage.
type PeerStore ¶
type PeerStore struct {
// contains filtered or unexported fields
}
func NewPeerStore ¶
func NewPeerStore() *PeerStore
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage interface that is implemented by storage providers
var STORE *Storage
func (*Storage) DeleteInfohash ¶
func (s *Storage) DeleteInfohash(key bittorrent.InfoHash) error
Delete key by key
func (*Storage) DeletePeer ¶
func (s *Storage) DeletePeer(key bittorrent.InfoHash, peer bittorrent.Peer)
func (*Storage) GetAllInfoHash ¶
func (s *Storage) GetAllInfoHash() []bittorrent.InfoHash
func (*Storage) GetAllPeers ¶
func (s *Storage) GetAllPeers(key bittorrent.InfoHash, ignore *bittorrent.Peer) []bittorrent.Peer
func (*Storage) GetPeers ¶
func (s *Storage) GetPeers(key bittorrent.InfoHash, p *bittorrent.Peer) (bittorrent.Peer, bittorrent.AnnounceRequest)
func (*Storage) ResetPeer ¶
func (s *Storage) ResetPeer(key bittorrent.InfoHash) error
Reset all peer
func (*Storage) SetPeer ¶
func (s *Storage) SetPeer(key bittorrent.InfoHash, peer bittorrent.Peer, a bittorrent.AnnounceRequest) error
SetPeer key with value SetPeer key with value
Click to show internal directories.
Click to hide internal directories.