memory

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: 7 Imported by: 0

Documentation

Index

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
}

Driver is the memory backed store.Store implementation

func NewDriver

func NewDriver() *Driver

NewPeerStore instantiates a new in-memory peer store

func (*Driver) Close

func (d *Driver) Close() error

Close will delete/free the underlying memory store

func (*Driver) Conn

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

Conn always returns nil for in-memory store

func (*Driver) Migrate

func (d *Driver) Migrate() error

func (*Driver) Name

func (d *Driver) Name() string

func (*Driver) RoleAdd

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

func (*Driver) RoleByID

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

func (*Driver) RoleDelete

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

func (*Driver) RoleSave

func (d *Driver) RoleSave(r *store.Role) error

func (*Driver) Roles

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

func (*Driver) TorrentAdd

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

Add adds a new torrent to the memory store

func (*Driver) TorrentDelete

func (d *Driver) TorrentDelete(ih store.InfoHash, _ bool) error

Delete will mark a torrent as deleted in the backing store. NOTE the memory store always permanently deletes the torrent

func (*Driver) TorrentGet

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

Get returns the Torrent matching the infohash

func (*Driver) TorrentSave

func (d *Driver) TorrentSave(_ *store.Torrent) error

func (*Driver) TorrentSync

func (d *Driver) TorrentSync(_ []*store.Torrent) error

Sync batch updates the backing store with the new TorrentStats provided

func (*Driver) Torrents

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

func (*Driver) UserAdd

func (d *Driver) UserAdd(usr *store.User) error

Add will add a new user to the backing store

func (*Driver) UserDelete

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

Delete removes a user from the backing store

func (*Driver) UserGetByID

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

GetByID returns a user matching the userId

func (*Driver) UserGetByPasskey

func (d *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 (d *Driver) UserSave(u *store.User) error

Update is used to change a known user

func (*Driver) UserSync

func (d *Driver) UserSync(_ []*store.User) error

Sync batch updates the backing store with the new UserStats provided

func (*Driver) Users

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

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

Jump to

Keyboard shortcuts

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