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
- type Driver
- func (s *Driver) Close() error
- func (s *Driver) Conn() interface{}
- func (s *Driver) Migrate() error
- func (s *Driver) Name() string
- func (s *Driver) RoleAdd(role *store.Role) error
- func (s *Driver) RoleByID(roleID uint32) (*store.Role, error)
- func (s *Driver) RoleDelete(roleID uint32) error
- func (s *Driver) RoleSave(role *store.Role) error
- func (s *Driver) Roles() (store.Roles, error)
- func (s *Driver) TorrentAdd(t *store.Torrent) error
- func (s *Driver) TorrentDelete(ih store.InfoHash, dropRow bool) error
- func (s *Driver) TorrentGet(hash store.InfoHash, deletedOk bool) (*store.Torrent, error)
- func (s *Driver) TorrentSave(torrent *store.Torrent) error
- func (s *Driver) TorrentSync(b []*store.Torrent) error
- func (s *Driver) Torrents() (store.Torrents, error)
- func (s *Driver) UserAdd(user *store.User) error
- func (s *Driver) UserDelete(user *store.User) error
- func (s *Driver) UserGetByID(userID uint32) (*store.User, error)
- func (s *Driver) UserGetByPasskey(passkey string) (*store.User, error)
- func (s *Driver) UserSave(user *store.User) error
- func (s *Driver) UserSync(b []*store.User) error
- func (s *Driver) Users() (store.Users, error)
- func (s *Driver) WhiteListAdd(client *store.WhiteListClient) error
- func (s *Driver) WhiteListDelete(client *store.WhiteListClient) error
- func (s *Driver) WhiteListGetAll() ([]*store.WhiteListClient, error)
Constants ¶
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 ¶
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) RoleDelete ¶
func (*Driver) TorrentAdd ¶
Add inserts a new torrent into the backing store
func (*Driver) TorrentDelete ¶
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 ¶
Get returns a torrent for the hash provided
func (*Driver) TorrentSync ¶
Sync batch updates the backing store with the new TorrentStats provided
func (*Driver) UserDelete ¶
Delete removes a user from the backing store
func (*Driver) UserGetByID ¶
GetByID returns a user matching the userId
func (*Driver) UserGetByPasskey ¶
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) 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