mysql

package
v0.0.0-...-640c710 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTorrent

func GetTorrent(dbConn *gorm.DB, infoHash string) (t *schemas.Torrent, err error)

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

func GetWhitelistedTorrent(dbConn *gorm.DB, infoHash string) (t *schemas.WhiteTorrent, err error)

GetWhitelistedTorrent Retrieves a single whitelisted torrent by its infoHash

func GetWhitelistedTorrents

func GetWhitelistedTorrents(dbConn *gorm.DB) (x *sql.Rows, err error)

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 InitDB

func InitDB(dbConn *gorm.DB)

InitDB initializes database tables.

func OpenConnection

func OpenConnection() (db *gorm.DB, err error)

OpenConnection does as its name dictates and opens a connection to the MysqlHost listed in the config

func OpenConnectionWithConfig

func OpenConnectionWithConfig(cfg *config.ConfigStruct) (db *gorm.DB, err error)

OpenConnectionWithConfig does as its name dictates and opens a connection to the MysqlHost listed in the config

func ScrapeTorrent

func ScrapeTorrent(dbConn *gorm.DB, infoHash string) (torrent *schemas.Torrent)

ScrapeTorrent supports the Scrape convention

func UpdatePeerStats

func UpdatePeerStats(dbConn *gorm.DB, uploaded uint64, downloaded uint64, ip string)

UpdatePeerStats handles updating peer info like hits per ip, downloaded amount, uploaded amounts.

func UpdateStats

func UpdateStats(dbConn *gorm.DB, uploaded uint64, downloaded uint64)

UpdateStats Handles updating statistics relevant to our tracker.

func UpdateTorrentStats

func UpdateTorrentStats(dbConn *gorm.DB, seederDelta int64, leecherDelta int64)

UpdateTorrentStats Handles updating statistics relevant to our tracker.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL