memstorage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMockedError = errors.New("memstorage: mocked error")

ErrMockedError will be returned by any Storage method when mocked error is activated.

Functions

This section is empty.

Types

type Storage

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

Storage represents an in memory storage sub system.

func New

func New() *Storage

New returns a new in memory storage instance.

func (*Storage) Close added in v0.3.4

func (m *Storage) Close() error

Close shuts down in memory storage sub system.

func (*Storage) CountOfflineMessages

func (m *Storage) CountOfflineMessages(_ context.Context, username string) (int, error)

CountOfflineMessages returns current length of user's offline queue.

func (*Storage) DeleteBlockListItem added in v0.7.0

func (m *Storage) DeleteBlockListItem(_ context.Context, item *model.BlockListItem) error

DeleteBlockListItem deletes a of block list item entity from storage.

func (*Storage) DeleteNode added in v0.7.0

func (m *Storage) DeleteNode(_ context.Context, host, name string) error

func (*Storage) DeleteNodeAffiliation added in v0.7.0

func (m *Storage) DeleteNodeAffiliation(_ context.Context, jid, host, name string) error

func (*Storage) DeleteNodeSubscription added in v0.7.0

func (m *Storage) DeleteNodeSubscription(_ context.Context, jid, host, name string) error

func (*Storage) DeleteOfflineMessages

func (m *Storage) DeleteOfflineMessages(_ context.Context, username string) error

DeleteOfflineMessages clears a user offline queue.

func (*Storage) DeleteRosterItem

func (m *Storage) DeleteRosterItem(_ context.Context, user, contact string) (rostermodel.Version, error)

DeleteRosterItem deletes a roster item entity from storage.

func (*Storage) DeleteRosterNotification

func (m *Storage) DeleteRosterNotification(_ context.Context, contact, jid string) error

DeleteRosterNotification deletes a roster notification entity from storage.

func (*Storage) DeleteUser

func (m *Storage) DeleteUser(_ context.Context, username string) error

DeleteUser deletes a user entity from storage.

func (*Storage) DisableMockedError added in v0.3.4

func (m *Storage) DisableMockedError()

DisableMockedError disables in memory mocked error.

func (*Storage) EnableMockedError added in v0.3.4

func (m *Storage) EnableMockedError()

EnableMockedError enables in memory mocked error.

func (*Storage) EnableMockedErrorWithInvokeLimit added in v0.3.4

func (m *Storage) EnableMockedErrorWithInvokeLimit(invokeLimit int32)

EnableMockedErrorWithInvokeLimit enables in memory mocked error after a given invocation limit is reached.

func (*Storage) FetchBlockListItems

func (m *Storage) FetchBlockListItems(_ context.Context, username string) ([]model.BlockListItem, error)

FetchBlockListItems retrieves from storage all block list item entities associated to a given user.

func (*Storage) FetchCapabilities added in v0.7.0

func (m *Storage) FetchCapabilities(_ context.Context, node, ver string) (*model.Capabilities, error)

func (*Storage) FetchHosts added in v0.7.0

func (m *Storage) FetchHosts(_ context.Context) ([]string, error)

func (*Storage) FetchNode added in v0.7.0

func (m *Storage) FetchNode(_ context.Context, host, name string) (*pubsubmodel.Node, error)

func (*Storage) FetchNodeAffiliation added in v0.7.0

func (m *Storage) FetchNodeAffiliation(ctx context.Context, host, name, jid string) (*pubsubmodel.Affiliation, error)

func (*Storage) FetchNodeAffiliations added in v0.7.0

func (m *Storage) FetchNodeAffiliations(_ context.Context, host, name string) ([]pubsubmodel.Affiliation, error)

func (*Storage) FetchNodeItems added in v0.7.0

func (m *Storage) FetchNodeItems(_ context.Context, host, name string) ([]pubsubmodel.Item, error)

func (*Storage) FetchNodeItemsWithIDs added in v0.7.0

func (m *Storage) FetchNodeItemsWithIDs(_ context.Context, host, name string, identifiers []string) ([]pubsubmodel.Item, error)

func (*Storage) FetchNodeLastItem added in v0.7.0

func (m *Storage) FetchNodeLastItem(_ context.Context, host, name string) (*pubsubmodel.Item, error)

func (*Storage) FetchNodeSubscriptions added in v0.7.0

func (m *Storage) FetchNodeSubscriptions(_ context.Context, host, name string) ([]pubsubmodel.Subscription, error)

func (*Storage) FetchNodes added in v0.7.0

func (m *Storage) FetchNodes(_ context.Context, host string) ([]pubsubmodel.Node, error)

func (*Storage) FetchOfflineMessages

func (m *Storage) FetchOfflineMessages(_ context.Context, username string) ([]xmpp.Message, error)

FetchOfflineMessages retrieves from storage current user offline queue.

func (*Storage) FetchPrivateXML

func (m *Storage) FetchPrivateXML(_ context.Context, namespace string, username string) ([]xmpp.XElement, error)

FetchPrivateXML retrieves from storage a private element.

func (*Storage) FetchRosterGroups added in v0.7.0

func (m *Storage) FetchRosterGroups(_ context.Context, username string) ([]string, error)

FetchRosterGroups retrieves all groups associated to a user roster

func (*Storage) FetchRosterItem

func (m *Storage) FetchRosterItem(_ context.Context, user, contact string) (*rostermodel.Item, error)

FetchRosterItem retrieves from storage a roster item entity.

func (*Storage) FetchRosterItems

func (m *Storage) FetchRosterItems(_ context.Context, user string) ([]rostermodel.Item, rostermodel.Version, error)

FetchRosterItems retrieves from storage all roster item entities associated to a given user.

func (*Storage) FetchRosterItemsInGroups added in v0.4.10

func (m *Storage) FetchRosterItemsInGroups(_ context.Context, username string, groups []string) ([]rostermodel.Item, rostermodel.Version, error)

FetchRosterItemsInGroups retrieves from storage all roster item entities associated to a given user and a set of groups.

func (*Storage) FetchRosterNotification added in v0.3.0

func (m *Storage) FetchRosterNotification(_ context.Context, contact string, jid string) (*rostermodel.Notification, error)

FetchRosterNotification retrieves from storage a roster notification entity.

func (*Storage) FetchRosterNotifications

func (m *Storage) FetchRosterNotifications(_ context.Context, contact string) ([]rostermodel.Notification, error)

FetchRosterNotifications retrieves from storage all roster notifications associated to a given user.

func (*Storage) FetchSubscribedNodes added in v0.7.0

func (m *Storage) FetchSubscribedNodes(_ context.Context, jid string) ([]pubsubmodel.Node, error)

func (*Storage) FetchUser

func (m *Storage) FetchUser(_ context.Context, username string) (*model.User, error)

FetchUser retrieves from storage a user entity.

func (*Storage) FetchVCard

func (m *Storage) FetchVCard(_ context.Context, username string) (xmpp.XElement, error)

FetchVCard retrieves from storage a vCard element associated to a given user.

func (*Storage) InsertBlockListItem added in v0.7.0

func (m *Storage) InsertBlockListItem(_ context.Context, item *model.BlockListItem) error

InsertBlockListItem a block list item entity into storage, only in case they haven't been previously inserted.

func (*Storage) InsertCapabilities added in v0.7.0

func (m *Storage) InsertCapabilities(_ context.Context, caps *model.Capabilities) error

func (*Storage) InsertOfflineMessage

func (m *Storage) InsertOfflineMessage(_ context.Context, message *xmpp.Message, username string) error

InsertOfflineMessage inserts a new message element into user's offline queue.

func (*Storage) IsClusterCompatible added in v0.4.0

func (m *Storage) IsClusterCompatible() bool

IsClusterCompatible returns whether or not the underlying storage subsystem can be used in cluster mode.

func (*Storage) UpsertNode added in v0.7.0

func (m *Storage) UpsertNode(_ context.Context, node *pubsubmodel.Node) error

func (*Storage) UpsertNodeAffiliation added in v0.7.0

func (m *Storage) UpsertNodeAffiliation(_ context.Context, affiliation *pubsubmodel.Affiliation, host, name string) error

func (*Storage) UpsertNodeItem added in v0.7.0

func (m *Storage) UpsertNodeItem(_ context.Context, item *pubsubmodel.Item, host, name string, maxNodeItems int) error

func (*Storage) UpsertNodeSubscription added in v0.7.0

func (m *Storage) UpsertNodeSubscription(_ context.Context, subscription *pubsubmodel.Subscription, host, name string) error

func (*Storage) UpsertPrivateXML added in v0.7.0

func (m *Storage) UpsertPrivateXML(_ context.Context, privateXML []xmpp.XElement, namespace string, username string) error

UpsertPrivateXML inserts a new private element into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertRosterItem added in v0.7.0

func (m *Storage) UpsertRosterItem(_ context.Context, ri *rostermodel.Item) (rostermodel.Version, error)

UpsertRosterItem inserts a new roster item entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertRosterNotification added in v0.7.0

func (m *Storage) UpsertRosterNotification(_ context.Context, rn *rostermodel.Notification) error

UpsertRosterNotification inserts a new roster notification entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertUser added in v0.7.0

func (m *Storage) UpsertUser(_ context.Context, user *model.User) error

UpsertUser inserts a new user entity into storage, or updates it in case it's been previously inserted.

func (*Storage) UpsertVCard added in v0.7.0

func (m *Storage) UpsertVCard(_ context.Context, vCard xmpp.XElement, username string) error

UpsertVCard inserts a new vCard element into storage, or updates it in case it's been previously inserted.

func (*Storage) UserExists

func (m *Storage) UserExists(_ context.Context, username string) (bool, error)

UserExists returns whether or not a user exists within storage.

Jump to

Keyboard shortcuts

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