Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBoltDB(conf *config.Configuration, fileName string, backupFileName string) (*bolt.DB, error)
- func CreateSqliteDB(conf *config.Configuration, fileName string, backupFileName string) (*sql.DB, error)
- func ParseCacheItem(item []byte) (int, []byte)
- func RestoreBackup(databasePath string, backupPath string)
- type BTItem
- type BoltDatabase
- func (d *BoltDatabase) AsWriter(bucket []byte, key string) *DBWriter
- func (d *BoltDatabase) BatchDelete(bucket []byte, keys []string) error
- func (d *BoltDatabase) BatchSet(bucket []byte, objects map[string]string) error
- func (d *BoltDatabase) BatchSetBytes(bucket []byte, objects map[string][]byte) error
- func (d *BoltDatabase) BatchSetObject(bucket []byte, objects map[string]interface{}) error
- func (d *BoltDatabase) CacheCleanup()
- func (d *BoltDatabase) CheckBucket(bucket []byte) error
- func (d *BoltDatabase) Close()
- func (d *BoltDatabase) CreateBackup(backupPath string)
- func (d *BoltDatabase) Delete(bucket []byte, key string) error
- func (d *BoltDatabase) DeleteWithPrefix(bucket []byte, prefix []byte)
- func (d *BoltDatabase) ForEach(bucket []byte, callback callBackWithError) error
- func (d *BoltDatabase) Get(bucket []byte, key string) (string, error)
- func (d *BoltDatabase) GetBytes(bucket []byte, key string) (value []byte, err error)
- func (d *BoltDatabase) GetCached(bucket []byte, key string) (string, error)
- func (d *BoltDatabase) GetCachedBytes(bucket []byte, key string) (cacheValue []byte, err error)
- func (d *BoltDatabase) GetCachedObject(bucket []byte, key string, item interface{}) (err error)
- func (d *BoltDatabase) GetFilename() string
- func (d *BoltDatabase) GetObject(bucket []byte, key string, item interface{}) (err error)
- func (d *BoltDatabase) Has(bucket []byte, key string) (ret bool)
- func (d *BoltDatabase) MaintenanceRefreshHandler()
- func (d *BoltDatabase) RecreateBucket(bucket []byte) error
- func (d *BoltDatabase) Seek(bucket []byte, prefix string, callback callBack) error
- func (d *BoltDatabase) Set(bucket []byte, key string, value string) error
- func (d *BoltDatabase) SetBytes(bucket []byte, key string, value []byte) error
- func (d *BoltDatabase) SetCached(bucket []byte, seconds int, key string, value string) error
- func (d *BoltDatabase) SetCachedBytes(bucket []byte, seconds int, key string, value []byte) error
- func (d *BoltDatabase) SetCachedObject(bucket []byte, seconds int, key string, item interface{}) error
- func (d *BoltDatabase) SetObject(bucket []byte, key string, item interface{}) error
- type DBWriter
- type SqliteDatabase
- func (d *SqliteDatabase) AddSearchHistory(historyType, query string)
- func (d *SqliteDatabase) AddTorrentHistory(infoHash, name string, b []byte)
- func (d *SqliteDatabase) AddTorrentLink(tmdbID, infoHash string, b []byte)
- func (d *SqliteDatabase) Close()
- func (d *SqliteDatabase) CreateBackup(backupPath string)
- func (d *SqliteDatabase) DeleteBTItem(infoHash string) error
- func (d *SqliteDatabase) GetBTItem(infoHash string) *BTItem
- func (d *SqliteDatabase) GetCount(sql string) (count int)
- func (d *SqliteDatabase) GetFilename() string
- func (d *SqliteDatabase) GetSetting(name string) (value string)
- func (d *SqliteDatabase) MaintenanceRefreshHandler()
- func (d *SqliteDatabase) SetSetting(name, value string)
- func (d *SqliteDatabase) UpdateBTItem(infoHash string, mediaID int, mediaType string, files []string, query string, ...) error
- func (d *SqliteDatabase) UpdateBTItemFiles(infoHash string, files []string) error
- func (d *SqliteDatabase) UpdateBTItemStatus(infoHash string, status int) error
Constants ¶
const ( // StatusRemove ... StatusRemove = iota // StatusActive ... StatusActive )
Variables ¶
var ( // LibraryBucket ... LibraryBucket = []byte("Library") // BitTorrentBucket ... BitTorrentBucket = []byte("BitTorrent") // HistoryBucket ... HistoryBucket = []byte("History") // TorrentHistoryBucket ... TorrentHistoryBucket = []byte("TorrentHistory") // SearchCacheBucket ... SearchCacheBucket = []byte("SearchCache") // CommonBucket ... CommonBucket = []byte("Common") )
var Buckets = [][]byte{ LibraryBucket, BitTorrentBucket, HistoryBucket, TorrentHistoryBucket, SearchCacheBucket, }
Buckets ...
var CacheBuckets = [][]byte{ CommonBucket, }
CacheBuckets represents buckets in Cache database
Functions ¶
func CreateBoltDB ¶
func CreateBoltDB(conf *config.Configuration, fileName string, backupFileName string) (*bolt.DB, error)
CreateBoltDB ...
func CreateSqliteDB ¶
func CreateSqliteDB(conf *config.Configuration, fileName string, backupFileName string) (*sql.DB, error)
CreateSqliteDB ...
Types ¶
type BTItem ¶
type BTItem struct { ID int `json:"id"` State int `json:"state"` Type string `json:"type"` Files []string `json:"files"` ShowID int `json:"showid"` Season int `json:"season"` Episode int `json:"episode"` Query string `json:"query"` }
BTItem ...
type BoltDatabase ¶
type BoltDatabase struct {
// contains filtered or unexported fields
}
BoltDatabase ...
func InitCacheDB ¶
func InitCacheDB(conf *config.Configuration) (*BoltDatabase, error)
InitCacheDB ...
func (*BoltDatabase) AsWriter ¶
func (d *BoltDatabase) AsWriter(bucket []byte, key string) *DBWriter
AsWriter ...
func (*BoltDatabase) BatchDelete ¶
func (d *BoltDatabase) BatchDelete(bucket []byte, keys []string) error
BatchDelete ...
func (*BoltDatabase) BatchSet ¶
func (d *BoltDatabase) BatchSet(bucket []byte, objects map[string]string) error
BatchSet ...
func (*BoltDatabase) BatchSetBytes ¶
func (d *BoltDatabase) BatchSetBytes(bucket []byte, objects map[string][]byte) error
BatchSetBytes ...
func (*BoltDatabase) BatchSetObject ¶
func (d *BoltDatabase) BatchSetObject(bucket []byte, objects map[string]interface{}) error
BatchSetObject ...
func (*BoltDatabase) CheckBucket ¶
func (d *BoltDatabase) CheckBucket(bucket []byte) error
CheckBucket ...
func (*BoltDatabase) CreateBackup ¶
func (d *BoltDatabase) CreateBackup(backupPath string)
CreateBackup ...
func (*BoltDatabase) Delete ¶
func (d *BoltDatabase) Delete(bucket []byte, key string) error
Delete ...
func (*BoltDatabase) DeleteWithPrefix ¶
func (d *BoltDatabase) DeleteWithPrefix(bucket []byte, prefix []byte)
DeleteWithPrefix ...
func (*BoltDatabase) ForEach ¶
func (d *BoltDatabase) ForEach(bucket []byte, callback callBackWithError) error
ForEach ...
func (*BoltDatabase) Get ¶
func (d *BoltDatabase) Get(bucket []byte, key string) (string, error)
Get ...
func (*BoltDatabase) GetBytes ¶
func (d *BoltDatabase) GetBytes(bucket []byte, key string) (value []byte, err error)
GetBytes ...
func (*BoltDatabase) GetCached ¶
func (d *BoltDatabase) GetCached(bucket []byte, key string) (string, error)
GetCached ...
func (*BoltDatabase) GetCachedBytes ¶
func (d *BoltDatabase) GetCachedBytes(bucket []byte, key string) (cacheValue []byte, err error)
GetCachedBytes ...
func (*BoltDatabase) GetCachedObject ¶
func (d *BoltDatabase) GetCachedObject(bucket []byte, key string, item interface{}) (err error)
GetCachedObject ...
func (*BoltDatabase) GetFilename ¶
func (d *BoltDatabase) GetFilename() string
GetFilename returns bolt filename
func (*BoltDatabase) GetObject ¶
func (d *BoltDatabase) GetObject(bucket []byte, key string, item interface{}) (err error)
GetObject ...
func (*BoltDatabase) Has ¶
func (d *BoltDatabase) Has(bucket []byte, key string) (ret bool)
Has checks for existence of a key
func (*BoltDatabase) MaintenanceRefreshHandler ¶
func (d *BoltDatabase) MaintenanceRefreshHandler()
MaintenanceRefreshHandler ...
func (*BoltDatabase) RecreateBucket ¶
func (d *BoltDatabase) RecreateBucket(bucket []byte) error
RecreateBucket ...
func (*BoltDatabase) Seek ¶
func (d *BoltDatabase) Seek(bucket []byte, prefix string, callback callBack) error
Seek ...
func (*BoltDatabase) Set ¶
func (d *BoltDatabase) Set(bucket []byte, key string, value string) error
Set ...
func (*BoltDatabase) SetBytes ¶
func (d *BoltDatabase) SetBytes(bucket []byte, key string, value []byte) error
SetBytes ...
func (*BoltDatabase) SetCachedBytes ¶
SetCachedBytes ...
func (*BoltDatabase) SetCachedObject ¶
func (d *BoltDatabase) SetCachedObject(bucket []byte, seconds int, key string, item interface{}) error
SetCachedObject ...
type SqliteDatabase ¶
SqliteDatabase ...
func InitSqliteDB ¶
func InitSqliteDB(conf *config.Configuration) (*SqliteDatabase, error)
InitSqliteDB ...
func (*SqliteDatabase) AddSearchHistory ¶
func (d *SqliteDatabase) AddSearchHistory(historyType, query string)
AddSearchHistory adds query to search history, according to media type
func (*SqliteDatabase) AddTorrentHistory ¶
func (d *SqliteDatabase) AddTorrentHistory(infoHash, name string, b []byte)
AddTorrentHistory saves last used torrent
func (*SqliteDatabase) AddTorrentLink ¶
func (d *SqliteDatabase) AddTorrentLink(tmdbID, infoHash string, b []byte)
AddTorrentLink saves link between torrent file and tmdbID entry
func (*SqliteDatabase) CreateBackup ¶
func (d *SqliteDatabase) CreateBackup(backupPath string)
CreateBackup ...
func (*SqliteDatabase) DeleteBTItem ¶
func (d *SqliteDatabase) DeleteBTItem(infoHash string) error
DeleteBTItem ...
func (*SqliteDatabase) GetBTItem ¶
func (d *SqliteDatabase) GetBTItem(infoHash string) *BTItem
GetBTItem ...
func (*SqliteDatabase) GetCount ¶
func (d *SqliteDatabase) GetCount(sql string) (count int)
GetCount is a helper for returning single column int result
func (*SqliteDatabase) GetFilename ¶
func (d *SqliteDatabase) GetFilename() string
GetFilename returns sqlite filename
func (*SqliteDatabase) GetSetting ¶
func (d *SqliteDatabase) GetSetting(name string) (value string)
GetSetting ...
func (*SqliteDatabase) MaintenanceRefreshHandler ¶
func (d *SqliteDatabase) MaintenanceRefreshHandler()
MaintenanceRefreshHandler ...
func (*SqliteDatabase) SetSetting ¶
func (d *SqliteDatabase) SetSetting(name, value string)
SetSetting ...
func (*SqliteDatabase) UpdateBTItem ¶
func (d *SqliteDatabase) UpdateBTItem(infoHash string, mediaID int, mediaType string, files []string, query string, infos ...int) error
UpdateBTItem ...
func (*SqliteDatabase) UpdateBTItemFiles ¶
func (d *SqliteDatabase) UpdateBTItemFiles(infoHash string, files []string) error
UpdateBTItemFiles ...
func (*SqliteDatabase) UpdateBTItemStatus ¶
func (d *SqliteDatabase) UpdateBTItemStatus(infoHash string, status int) error
UpdateBTItemStatus ...