dbl

package
v0.0.0-...-c40c633 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinDao

type BinDao struct {
	// contains filtered or unexported fields
}

func (*BinDao) Delete

func (d *BinDao) Delete(bin *ds.Bin) (err error)

func (*BinDao) GenerateId

func (d *BinDao) GenerateId() string

func (*BinDao) GetAll

func (d *BinDao) GetAll() (bins []ds.Bin, err error)

func (*BinDao) GetByBytes

func (d *BinDao) GetByBytes(limit int) (bins []ds.Bin, err error)

func (*BinDao) GetByCreated

func (d *BinDao) GetByCreated(limit int) (bins []ds.Bin, err error)

func (*BinDao) GetByDownloads

func (d *BinDao) GetByDownloads(limit int) (bins []ds.Bin, err error)

func (*BinDao) GetByFiles

func (d *BinDao) GetByFiles(limit int) (bins []ds.Bin, err error)

func (*BinDao) GetByID

func (d *BinDao) GetByID(id string) (bin ds.Bin, found bool, err error)

func (*BinDao) GetLastUpdated

func (d *BinDao) GetLastUpdated(limit int) (bins []ds.Bin, err error)

func (*BinDao) GetPendingDelete

func (d *BinDao) GetPendingDelete() (bins []ds.Bin, err error)

func (*BinDao) Insert

func (d *BinDao) Insert(bin *ds.Bin) (err error)

func (*BinDao) RegisterDownload

func (d *BinDao) RegisterDownload(bin *ds.Bin) (err error)

func (*BinDao) RegisterUpdate

func (d *BinDao) RegisterUpdate(bin *ds.Bin) (err error)

func (*BinDao) Update

func (d *BinDao) Update(bin *ds.Bin) (err error)

func (*BinDao) Upsert

func (d *BinDao) Upsert(bin *ds.Bin) (err error)

func (*BinDao) ValidateInput

func (d *BinDao) ValidateInput(bin *ds.Bin) error

type ClientDao

type ClientDao struct {
	// contains filtered or unexported fields
}

func (*ClientDao) Ban

func (c *ClientDao) Ban(IPsToBan []string, banByRemoteAddr string) (err error)

func (*ClientDao) GetAll

func (c *ClientDao) GetAll() (clients []ds.Client, err error)

func (*ClientDao) GetByBannedAt

func (c *ClientDao) GetByBannedAt(limit int) (clients []ds.Client, err error)

func (*ClientDao) GetByIP

func (c *ClientDao) GetByIP(ip net.IP) (client ds.Client, found bool, err error)

func (*ClientDao) GetByLastActiveAt

func (c *ClientDao) GetByLastActiveAt(limit int) (clients []ds.Client, err error)

func (*ClientDao) GetByRemoteAddr

func (c *ClientDao) GetByRemoteAddr(remoteAddr string) (client ds.Client, found bool, err error)

func (*ClientDao) GetByRequests

func (c *ClientDao) GetByRequests(limit int) (clients []ds.Client, err error)

func (*ClientDao) Update

func (c *ClientDao) Update(client *ds.Client) (err error)

type DAO

type DAO struct {
	ConnStr string
	// contains filtered or unexported fields
}

func Init

func Init(dbHost string, dbPort int, dbName, dbUser, dbPassword string) (DAO, error)

Init a database connection given a database name and user.

func (DAO) Bin

func (dao DAO) Bin() *BinDao

func (DAO) Client

func (dao DAO) Client() *ClientDao

func (DAO) Close

func (dao DAO) Close() error

func (DAO) CreateSchema

func (dao DAO) CreateSchema() error

func (DAO) File

func (dao DAO) File() *FileDao

func (DAO) Metrics

func (dao DAO) Metrics() *MetricsDao

func (DAO) ResetDB

func (dao DAO) ResetDB() error

func (DAO) Stats

func (dao DAO) Stats() sql.DBStats

func (DAO) Status

func (dao DAO) Status() bool

func (DAO) Transaction

func (dao DAO) Transaction() *TransactionDao

type FileDao

type FileDao struct {
	// contains filtered or unexported fields
}

func (*FileDao) Delete

func (d *FileDao) Delete(file *ds.File) (err error)

func (*FileDao) FileByChecksum

func (d *FileDao) FileByChecksum(sha256 string) (files []ds.File, err error)

func (*FileDao) FilesByChecksum

func (d *FileDao) FilesByChecksum(limit int) (files []ds.FileByChecksum, err error)

func (*FileDao) GetAll

func (d *FileDao) GetAll(available bool) (files []ds.File, err error)

func (*FileDao) GetByBin

func (d *FileDao) GetByBin(id string, inStorage bool) (files []ds.File, err error)

func (*FileDao) GetByID

func (d *FileDao) GetByID(id int) (file ds.File, found bool, err error)

func (*FileDao) GetByName

func (d *FileDao) GetByName(bin string, filename string) (file ds.File, found bool, err error)

func (*FileDao) GetPendingDelete

func (d *FileDao) GetPendingDelete() (files []ds.File, err error)

func (*FileDao) GetTopDownloads

func (d *FileDao) GetTopDownloads(limit int) (files []ds.File, err error)

func (*FileDao) Insert

func (d *FileDao) Insert(file *ds.File) (err error)

func (*FileDao) RegisterDownload

func (d *FileDao) RegisterDownload(file *ds.File) (err error)

func (*FileDao) Update

func (d *FileDao) Update(file *ds.File) (err error)

func (*FileDao) ValidateInput

func (d *FileDao) ValidateInput(file *ds.File) error

type MetricsDao

type MetricsDao struct {
	// contains filtered or unexported fields
}

func (*MetricsDao) StorageBytesAllocated

func (d *MetricsDao) StorageBytesAllocated() (totalBytes uint64)

func (*MetricsDao) UpdateMetrics

func (d *MetricsDao) UpdateMetrics(metrics *ds.Metrics) (err error)

type TransactionDao

type TransactionDao struct {
	// contains filtered or unexported fields
}

func (*TransactionDao) Cleanup

func (d *TransactionDao) Cleanup(retention uint64) (count int64, err error)

func (*TransactionDao) GetByBin

func (d *TransactionDao) GetByBin(bin string) (transactions []ds.Transaction, err error)

func (*TransactionDao) GetByClientId

func (d *TransactionDao) GetByClientId(id string) (transactions []ds.Transaction, err error)

func (*TransactionDao) GetByIP

func (d *TransactionDao) GetByIP(ip string) (transactions []ds.Transaction, err error)

func (*TransactionDao) Insert

func (d *TransactionDao) Insert(t *ds.Transaction) (err error)

func (*TransactionDao) Register

func (d *TransactionDao) Register(r *http.Request, bin string, filename string, timestamp time.Time, completed time.Time, status int, size int64) (transaction *ds.Transaction, err error)

func (*TransactionDao) Update

func (d *TransactionDao) Update(t *ds.Transaction) (err error)

Jump to

Keyboard shortcuts

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