Documentation
¶
Index ¶
- Constants
- Variables
- func BatchDelete(db *bolt.DB, bucket []byte, keys []string) error
- func BucketExists(db *bolt.DB, bucket []byte) (res bool)
- func CacheCleanup(db *bolt.DB)
- func CheckBucket(db *bolt.DB, bucket []byte) error
- func CompressBoltDB(conf *config.Configuration, databasePath, compressPath string) error
- func CreateBackup(db *bolt.DB, backupPath string)
- func CreateBoltDB(conf *config.Configuration, databasePath, backupPath string) (*bolt.DB, error)
- func CreateStormDB(conf *config.Configuration, databasePath, backupPath string) (*storm.DB, error)
- func ForEach(db *bolt.DB, bucket []byte, callback callBackWithError) error
- func GetStormDB() *storm.DB
- func ParseCacheItem(item []byte) (int64, []byte)
- func RestoreBackup(databasePath string, backupPath string)
- func Seek(db *bolt.DB, bucket []byte, prefix string, callback callBack) error
- type BTItem
- type BoltDatabase
- func (d *BoltDatabase) AsWriter(bucket []byte, key string) *DBWriter
- 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) Close()
- func (d *BoltDatabase) Compress() (err error)
- func (d *BoltDatabase) Delete(bucket []byte, key string) error
- func (d *BoltDatabase) DeleteWithPrefix(bucket []byte, prefix []byte)
- 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) GetCachedBool(bucket []byte, key string) (bool, 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) 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) SetCachedBool(bucket []byte, seconds int, key string, value bool) 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 Database
- type LibraryItem
- type QueryHistory
- type SqliteDatabase
- type StormDatabase
- func (d *StormDatabase) AddSearchHistory(historyType, query string)
- func (d *StormDatabase) AddTorrentHistory(infoHash, name string, b []byte)
- func (d *StormDatabase) AddTorrentLink(tmdbID, infoHash string, b []byte, force bool)
- func (d *StormDatabase) CleanSearchHistory(historyType string)
- func (d *StormDatabase) CleanupTorrentLink(infoHash string)
- func (d *StormDatabase) Close()
- func (d *StormDatabase) Compress() (err error)
- func (d *StormDatabase) DeleteBTItem(infoHash string) error
- func (d *StormDatabase) GetBTItem(infoHash string) *BTItem
- func (d *StormDatabase) MaintenanceRefreshHandler()
- func (d *StormDatabase) RemoveSearchHistory(historyType, query string)
- func (d *StormDatabase) UpdateBTItem(infoHash string, mediaID int, mediaType string, files []string, query string, ...) error
- func (d *StormDatabase) UpdateBTItemFiles(infoHash string, files []string) error
- func (d *StormDatabase) UpdateBTItemStatus(infoHash string, status int) error
- func (d *StormDatabase) UpdateTorrentMetadata(infoHash string, b []byte)
- type TorrentAssignItem
- type TorrentAssignMetadata
- type TorrentHistory
Constants ¶
const ( // StateDeleted ... StateDeleted = iota // StateActive ... StateActive )
const ( // BTItemBucket ... BTItemBucket = "BTItem" // TorrentHistoryBucket ... TorrentHistoryBucket = "TorrentHistory" // TorrentAssignMetadataBucket ... TorrentAssignMetadataBucket = "TorrentAssignMetadata" // TorrentAssignItemBucket ... TorrentAssignItemBucket = "TorrentAssignItem" // QueryHistoryBucket ... QueryHistoryBucket = "QueryHistory" )
Variables ¶
var CacheBuckets = [][]byte{ CommonBucket, }
CacheBuckets represents buckets in Cache database
var ( // CommonBucket ... CommonBucket = []byte("Common") )
Functions ¶
func BatchDelete ¶
BatchDelete ...
func BucketExists ¶
BucketExists checks if bucket already exists in the database
func CompressBoltDB ¶
func CompressBoltDB(conf *config.Configuration, databasePath, compressPath string) error
CompressBoltDB ...
func CreateBoltDB ¶
CreateBoltDB ...
func CreateStormDB ¶
CreateStormDB ...
Types ¶
type BTItem ¶
type BTItem struct { InfoHash string `json:"infoHash" storm:"id"` 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 { Database // 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) 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) 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) 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) GetCachedBool ¶
func (d *BoltDatabase) GetCachedBool(bucket []byte, key string) (bool, error)
GetCachedBool ...
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) 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) SetCachedBool ¶
SetCachedBool ...
func (*BoltDatabase) SetCachedBytes ¶
SetCachedBytes ...
func (*BoltDatabase) SetCachedObject ¶
func (d *BoltDatabase) SetCachedObject(bucket []byte, seconds int, key string, item interface{}) error
SetCachedObject ...
type Database ¶
type Database struct { IsClosed bool // contains filtered or unexported fields }
Database ...
func (*Database) GetFilename ¶
GetFilename returns bolt filename
type LibraryItem ¶
type LibraryItem struct { ID int `storm:"id"` MediaType int `storm:"index"` State int `storm:"index"` ShowID int `storm:"index"` }
LibraryItem ...
type QueryHistory ¶
type QueryHistory struct { ID string `storm:"id"` Type string `storm:"index"` Query string `storm:"index"` Dt time.Time `storm:"index"` }
QueryHistory ...
type StormDatabase ¶
type StormDatabase struct { Database // contains filtered or unexported fields }
StormDatabase ...
func InitStormDB ¶
func InitStormDB(conf *config.Configuration) (*StormDatabase, error)
InitStormDB ...
func (*StormDatabase) AddSearchHistory ¶
func (d *StormDatabase) AddSearchHistory(historyType, query string)
AddSearchHistory adds query to search history, according to media type
func (*StormDatabase) AddTorrentHistory ¶
func (d *StormDatabase) AddTorrentHistory(infoHash, name string, b []byte)
AddTorrentHistory saves last used torrent
func (*StormDatabase) AddTorrentLink ¶
func (d *StormDatabase) AddTorrentLink(tmdbID, infoHash string, b []byte, force bool)
AddTorrentLink saves link between torrent file and tmdbID entry
func (*StormDatabase) CleanSearchHistory ¶
func (d *StormDatabase) CleanSearchHistory(historyType string)
CleanSearchHistory cleans search history for selected media type
func (*StormDatabase) CleanupTorrentLink ¶
func (d *StormDatabase) CleanupTorrentLink(infoHash string)
CleanupTorrentLink ...
func (*StormDatabase) DeleteBTItem ¶
func (d *StormDatabase) DeleteBTItem(infoHash string) error
DeleteBTItem ...
func (*StormDatabase) GetBTItem ¶
func (d *StormDatabase) GetBTItem(infoHash string) *BTItem
GetBTItem ...
func (*StormDatabase) MaintenanceRefreshHandler ¶
func (d *StormDatabase) MaintenanceRefreshHandler()
MaintenanceRefreshHandler ...
func (*StormDatabase) RemoveSearchHistory ¶
func (d *StormDatabase) RemoveSearchHistory(historyType, query string)
RemoveSearchHistory removes query from the history
func (*StormDatabase) UpdateBTItem ¶
func (d *StormDatabase) UpdateBTItem(infoHash string, mediaID int, mediaType string, files []string, query string, infos ...int) error
UpdateBTItem ...
func (*StormDatabase) UpdateBTItemFiles ¶
func (d *StormDatabase) UpdateBTItemFiles(infoHash string, files []string) error
UpdateBTItemFiles ...
func (*StormDatabase) UpdateBTItemStatus ¶
func (d *StormDatabase) UpdateBTItemStatus(infoHash string, status int) error
UpdateBTItemStatus ...
func (*StormDatabase) UpdateTorrentMetadata ¶
func (d *StormDatabase) UpdateTorrentMetadata(infoHash string, b []byte)
UpdateTorrentMetadata updates bytes for specific InfoHash
type TorrentAssignItem ¶
type TorrentAssignItem struct { Pk int `storm:"id,increment"` InfoHash string `storm:"index"` TmdbID int `storm:"unique"` }
TorrentAssignItem ...
type TorrentAssignMetadata ¶
TorrentAssignMetadata ...