Documentation
¶
Index ¶
- Variables
- func AddTorrentLocalStorage(torrentStorage *storm.DB, local TorrentLocal)
- func DelTorrentLocalStorage(torrentStorage *storm.DB, selectedHash string)
- func DelTorrentLocalStorageAndFiles(torrentStorage *storm.DB, selectedHash string, fileDownloadPath string)
- func DeleteRSSFeed(db *storm.DB, RSSFeedURL string)
- func FetchConfig(torrentStorage *storm.DB) (Settings.FullClientSettings, error)
- func SaveConfig(torrentStorage *storm.DB, config Settings.FullClientSettings)
- func StoreHashHistory(db *storm.DB, torrentHash string)
- func UpdateJWTTokens(db *storm.DB, tokens IssuedTokensList)
- func UpdateRSSFeeds(db *storm.DB, RSSFeed RSSFeedStore)
- func UpdateStorageTick(torrentStorage *storm.DB, torrentLocal TorrentLocal)
- type IssuedTokensList
- type RSSFeedStore
- type SingleRSSFeed
- type SingleRSSTorrent
- type SingleToken
- type TorrentFilePriority
- type TorrentHistoryList
- type TorrentLocal
Constants ¶
This section is empty.
Variables ¶
var Conn *websocket.Conn
Conn is the global websocket connection used to push server notification messages
var Logger *logrus.Logger
Logger is the global Logger that is used in all packages
Functions ¶
func AddTorrentLocalStorage ¶
func AddTorrentLocalStorage(torrentStorage *storm.DB, local TorrentLocal)
AddTorrentLocalStorage is called when adding a new torrent via any method, requires the boltdb pointer and the torrentlocal struct
func DelTorrentLocalStorage ¶
DelTorrentLocalStorage is called to delete a torrent when we fail (for whatever reason to load the information for it). Deleted by HASH matching.
func DelTorrentLocalStorageAndFiles ¶
func DelTorrentLocalStorageAndFiles(torrentStorage *storm.DB, selectedHash string, fileDownloadPath string)
DelTorrentLocalStorageAndFiles deletes the torrent from the database and also attempts to delete the torrent files from the disk as well.
func DeleteRSSFeed ¶
DeleteRSSFeed grabs old database then recreates it without the deleted RSS Feed
func FetchConfig ¶ added in v0.3.0
func FetchConfig(torrentStorage *storm.DB) (Settings.FullClientSettings, error)
FetchConfig fetches the client config from the database
func SaveConfig ¶ added in v0.3.0
func SaveConfig(torrentStorage *storm.DB, config Settings.FullClientSettings)
SaveConfig saves the config to the database to compare for changes to settings.toml on restart
func StoreHashHistory ¶
StoreHashHistory adds the infohash of all torrents added into the client. The cron job checks this so as not to add torrents from RSS that were already added before
func UpdateJWTTokens ¶ added in v0.3.0
func UpdateJWTTokens(db *storm.DB, tokens IssuedTokensList)
UpdateJWTTokens updates the database with new tokens as they are added
func UpdateRSSFeeds ¶
func UpdateRSSFeeds(db *storm.DB, RSSFeed RSSFeedStore)
UpdateRSSFeeds updates the RSS feeds everytime they are changed
func UpdateStorageTick ¶
func UpdateStorageTick(torrentStorage *storm.DB, torrentLocal TorrentLocal)
UpdateStorageTick updates the values in boltdb that should update on every tick (like uploadratio or uploadedbytes, not downloaded since we should have the actual file)
Types ¶
type IssuedTokensList ¶ added in v0.3.0
type IssuedTokensList struct {
ID int `storm:"id,unique"` //storm requires unique ID (will be 3) to save although there will only be one of these
SigningKey []byte
TokenNames []SingleToken
FirstToken string `storm:omitempty`
}
IssuedTokensList contains a slice of all the tokens issues to applications
func FetchJWTTokens ¶ added in v0.3.0
func FetchJWTTokens(db *storm.DB) IssuedTokensList
FetchJWTTokens fetches the stored client authentication tokens
type RSSFeedStore ¶
type RSSFeedStore struct {
ID int `storm:"id,unique"` //storm requires unique ID (will be 1) to save although there will only be one of these
RSSFeeds []SingleRSSFeed //slice of string containing URL's in string form for gofeed to parse
}
RSSFeedStore stores all of our RSS feeds in a slice of gofeed.Feed
func FetchRSSFeeds ¶
func FetchRSSFeeds(db *storm.DB) RSSFeedStore
FetchRSSFeeds fetches the RSS feed from db, which was setup when initializing database on first startup
type SingleRSSFeed ¶
type SingleRSSFeed struct {
URL string `storm:"id,unique"` //the URL of the individual RSS feed
Name string
Torrents []SingleRSSTorrent //name of the torrents
}
SingleRSSFeed stores an RSS feed with a list of all the torrents in the feed
func FetchSpecificRSSFeed ¶
func FetchSpecificRSSFeed(db *storm.DB, RSSFeedURL string) SingleRSSFeed
FetchSpecificRSSFeed pulls one feed from the database to send to the client
type SingleRSSTorrent ¶
SingleRSSTorrent stores a single RSS torrent with all the relevant information
type SingleToken ¶ added in v0.3.0
type SingleToken struct {
ClientName string
}
SingleToken stores a single token and all of the associated information
type TorrentFilePriority ¶
type TorrentFilePriority struct {
TorrentFilePath string
TorrentFilePriority string
TorrentFileSize int64
}
TorrentFilePriority stores the priority for each file in a torrent
type TorrentHistoryList ¶
type TorrentHistoryList struct {
ID int `storm:"id,unique"` //storm requires unique ID (will be 2) to save although there will only be one of these
HashList []string
}
TorrentHistoryList holds the entire history of downloaded torrents by hash TODO implement a way to read this and maybe grab the name for every torrent as well
func FetchHashHistory ¶
func FetchHashHistory(db *storm.DB) TorrentHistoryList
FetchHashHistory fetches the infohash of all torrents added into the client. The cron job checks this so as not to add torrents from RSS that were already added before
type TorrentLocal ¶
type TorrentLocal struct {
Hash string `storm:"id,unique"` //Hash should be unique for every torrent... if not we are re-adding an already added torrent
InfoBytes []byte
DateAdded string
StoragePath string //The absolute value of the path where the torrent will be moved when completed
TempStoragePath string //The absolute path of where the torrent is temporarily stored as it is downloaded
TorrentMoved bool
TorrentName string
TorrentStatus string
TorrentUploadLimit bool //if true this torrent will bypass the upload storage limit (effectively unlimited)
MaxConnections int
TorrentType string //magnet or .torrent file
TorrentFileName string //Should be just the name of the torrent
TorrentFile []byte
Label string
UploadedBytes int64
DownloadedBytes int64
TorrentSize int64 //If we cancel a file change the download size since we won't be downloading that file
UploadRatio string
TorrentFilePriority []TorrentFilePriority
}
TorrentLocal is local storage of the torrents for readd on server restart, marshalled into the database using Storm
func FetchAllStoredTorrents ¶
func FetchAllStoredTorrents(torrentStorage *storm.DB) (torrentLocalArray []*TorrentLocal)
FetchAllStoredTorrents is called to read in ALL local stored torrents in the boltdb database (called on server restart)
func FetchTorrentFromStorage ¶
func FetchTorrentFromStorage(torrentStorage *storm.DB, selectedHash string) TorrentLocal
FetchTorrentFromStorage grabs the localtorrent info from the bolt database for usage found by torrenthash
func FetchTorrentsByLabel ¶ added in v0.2.0
func FetchTorrentsByLabel(torrentStorage *storm.DB, label string) []TorrentLocal
FetchTorrentsByLabel fetches a list of torrents that have a specific label