mysql

package
v0.0.0-...-da267cc Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mysql provides mysql/mariadb backed persistent storage

NOTE this requires MySQL 8.0+ / MariaDB 10.5+ (maybe 10.4?) due to the POINT column type

Index

Constants

View Source
const ErrNoResults = "sql: no rows in result set"

ErrNoResults is the string returned from the driver when no rows are returned

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver is the MariaDB backed store.Store implementation

func (*Driver) Close

func (s *Driver) Close() error

Close will close the underlying database connection and clear the local caches

func (*Driver) Conn

func (s *Driver) Conn() interface{}

Conn returns the underlying database driver

func (*Driver) Migrate

func (s *Driver) Migrate() error

func (*Driver) Name

func (s *Driver) Name() string

func (*Driver) RoleAdd

func (s *Driver) RoleAdd(role *store.Role) error

func (*Driver) RoleByID

func (s *Driver) RoleByID(roleID uint32) (*store.Role, error)

func (*Driver) RoleDelete

func (s *Driver) RoleDelete(roleID uint32) error

func (*Driver) RoleSave

func (s *Driver) RoleSave(role *store.Role) error

func (*Driver) Roles

func (s *Driver) Roles() (store.Roles, error)

func (*Driver) TorrentAdd

func (s *Driver) TorrentAdd(t *store.Torrent) error

Add inserts a new torrent into the backing store

func (*Driver) TorrentDelete

func (s *Driver) TorrentDelete(ih store.InfoHash, dropRow bool) error

Delete will mark a torrent as deleted in the backing store. If dropRow is true, it will permanently remove the torrent from the store

func (*Driver) TorrentGet

func (s *Driver) TorrentGet(hash store.InfoHash, deletedOk bool) (*store.Torrent, error)

Get returns a torrent for the hash provided

func (*Driver) TorrentSave

func (s *Driver) TorrentSave(torrent *store.Torrent) error

func (*Driver) TorrentSync

func (s *Driver) TorrentSync(b []*store.Torrent) error

Sync batch updates the backing store with the new TorrentStats provided

func (*Driver) Torrents

func (s *Driver) Torrents() (store.Torrents, error)

func (*Driver) UserAdd

func (s *Driver) UserAdd(user *store.User) error

Add will add a new user to the backing store

func (*Driver) UserDelete

func (s *Driver) UserDelete(user *store.User) error

Delete removes a user from the backing store

func (*Driver) UserGetByID

func (s *Driver) UserGetByID(userID uint32) (*store.User, error)

GetByID returns a user matching the userId

func (*Driver) UserGetByPasskey

func (s *Driver) UserGetByPasskey(passkey string) (*store.User, error)

GetByPasskey will lookup and return the user via their passkey used as an identifier The errors returned for this method should be very generic and not reveal any info that could possibly help attackers gain any insight. All error cases MUST return ErrUnauthorized.

func (*Driver) UserSave

func (s *Driver) UserSave(user *store.User) error

func (*Driver) UserSync

func (s *Driver) UserSync(b []*store.User) error

Sync batch updates the backing store with the new UserStats provided

func (*Driver) Users

func (s *Driver) Users() (store.Users, error)

func (*Driver) WhiteListAdd

func (s *Driver) WhiteListAdd(client *store.WhiteListClient) error

WhiteListAdd will insert a new client prefix into the allowed clients list

func (*Driver) WhiteListDelete

func (s *Driver) WhiteListDelete(client *store.WhiteListClient) error

WhiteListDelete removes a client from the global whitelist

func (*Driver) WhiteListGetAll

func (s *Driver) WhiteListGetAll() ([]*store.WhiteListClient, error)

WhiteListGetAll fetches all known whitelisted clients

Jump to

Keyboard shortcuts

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