Documentation ¶
Index ¶
- func GetTorrent(dbConn *gorm.DB, infoHash string) (t *schemas.Torrent, err error)
- func GetWhitelistedTorrent(dbConn *gorm.DB, infoHash string) (t *schemas.WhiteTorrent, err error)
- func GetWhitelistedTorrents(dbConn *gorm.DB) (x *sql.Rows, err error)
- func InitDB(dbConn *gorm.DB)
- func OpenConnection() (db *gorm.DB, err error)
- func OpenConnectionWithConfig(cfg *config.ConfigStruct) (db *gorm.DB, err error)
- func ScrapeTorrent(dbConn *gorm.DB, infoHash string) (torrent *schemas.Torrent)
- func UpdatePeerStats(dbConn *gorm.DB, uploaded uint64, downloaded uint64, ip string)
- func UpdateStats(dbConn *gorm.DB, uploaded uint64, downloaded uint64)
- func UpdateTorrentStats(dbConn *gorm.DB, seederDelta int64, leecherDelta int64)
- type PGListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTorrent ¶
GetTorrent retrieves a torrent by its infoHash from the generic torrent table in the database. Note: there's also a whitelisted torrent table (`WhiteTorrent`).
func GetWhitelistedTorrent ¶
GetWhitelistedTorrent Retrieves a single whitelisted torrent by its infoHash
func GetWhitelistedTorrents ¶
GetWhitelistedTorrents allows us to retrieve all of the white listed torrents. Mostly used for populating the Redis KV storage with all of our whitelisted torrents.
func OpenConnection ¶
OpenConnection does as its name dictates and opens a connection to the PostgresHost listed in the config
func OpenConnectionWithConfig ¶
func OpenConnectionWithConfig(cfg *config.ConfigStruct) (db *gorm.DB, err error)
OpenConnectionWithConfig handles `OpenConnection` but allows injecting a config file.
func ScrapeTorrent ¶
ScrapeTorrent supports the Scrape convention
func UpdatePeerStats ¶
UpdatePeerStats handles updating peer info like hits per ip, downloaded amount, uploaded amounts.
func UpdateStats ¶
UpdateStats Handles updating statistics relevant to our tracker.
Types ¶
type PGListener ¶
type PGListener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(c config.ConfigStruct) (*PGListener, error)
func (*PGListener) BeginListen ¶
func (pg *PGListener) BeginListen(callback callbackFunction)
DO we want a callback or something else?