Documentation ¶
Overview ¶
Package postgres provides the backing store for postgresql TODO create domains for the uint types, eg: create domain uint64 as numeric(20,0);
Index ¶
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) Conn() interface{}
- func (d *Driver) Migrate() error
- func (d *Driver) Name() string
- func (d *Driver) Reap() []store.PeerHash
- func (d *Driver) RoleAdd(role *store.Role) error
- func (d *Driver) RoleByID(roleID uint32) (*store.Role, error)
- func (d *Driver) RoleDelete(roleID uint32) error
- func (d *Driver) RoleSave(role *store.Role) error
- func (d *Driver) Roles() (store.Roles, error)
- func (d *Driver) TorrentAdd(t *store.Torrent) error
- func (d *Driver) TorrentDelete(ih store.InfoHash, dropRow bool) error
- func (d *Driver) TorrentGet(ih store.InfoHash, deletedOk bool) (*store.Torrent, error)
- func (d *Driver) TorrentSave(torrent *store.Torrent) error
- func (d *Driver) TorrentSync(batch []*store.Torrent) error
- func (d *Driver) TorrentUpdate(torrent *store.Torrent) error
- func (d *Driver) Torrents() (store.Torrents, error)
- func (d *Driver) UserAdd(user *store.User) error
- func (d *Driver) UserDelete(user *store.User) error
- func (d *Driver) UserGetByID(userID uint32) (*store.User, error)
- func (d *Driver) UserGetByPasskey(passkey string) (*store.User, error)
- func (d *Driver) UserSave(user *store.User) error
- func (d *Driver) UserSync(batch []*store.User) error
- func (d *Driver) Users() (store.Users, error)
- func (d *Driver) WhiteListAdd(client *store.WhiteListClient) error
- func (d *Driver) WhiteListDelete(client *store.WhiteListClient) error
- func (d *Driver) WhiteListGetAll() ([]*store.WhiteListClient, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
UserStore is the postgres backed store.Store implementation
func (*Driver) Conn ¶
func (d *Driver) Conn() interface{}
Conn returns the underlying database driverInit
func (*Driver) Reap ¶
Reap will loop through the peers removing any stale entries from active swarms TODO fetch peer hashes for expired peers to flush local caches
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 ¶
TorrentGet returns a torrent for the hash provided
func (*Driver) TorrentSync ¶
Sync batch updates the backing store with the new TorrentStats provided TODO test cases
func (*Driver) TorrentUpdate ¶
TorrentUpdate
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 (d *Driver) WhiteListAdd(client *store.WhiteListClient) error
WhiteListAdd will insert a new client prefix into the allowed clients list
func (*Driver) WhiteListDelete ¶
func (d *Driver) WhiteListDelete(client *store.WhiteListClient) error
WhiteListDelete removes a client from the global whitelist
func (*Driver) WhiteListGetAll ¶
func (d *Driver) WhiteListGetAll() ([]*store.WhiteListClient, error)
WhiteListGetAll fetches all known whitelisted clients