memorystorage

package
v0.0.0-...-aeec266 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMocked = errors.New("memstorage: mocked erro")

ErrMocked represents in memory mocked error value.

Functions

func DisableMockedError

func DisableMockedError()

DisableMockedError disables in memory mocked error.

func EnableMockedError

func EnableMockedError()

EnableMockedError enables in memory mocked error.

func EnableMockedErrorWithInvokeLimit

func EnableMockedErrorWithInvokeLimit(limit int32)

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

func New

func New() (repository.Container, error)

New initializes in-memory storage and returns associated container.

Types

type BlockList

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

BlockList represents an in-memory block-list storage.

func NewBlockList

func NewBlockList() *BlockList

NewBlockList returns an instance of BlockList in-memory storage.

func (*BlockList) DeleteBlockListItem

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

DeleteBlockListItem deletes a block list item entity from storage.

func (*BlockList) FetchBlockListItems

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

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

func (*BlockList) InsertBlockListItem

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

InsertBlockListItem inserts a block list item entity into storage if not previously inserted.

type Offline

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

Offline represents an in-memory offline storage.

func NewOffline

func NewOffline() *Offline

NewOffline returns an instance of Offline in-memory storage.

func (*Offline) CountOfflineMessages

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

CountOfflineMessages returns current length of user's offline queue.

func (*Offline) DeleteOfflineMessages

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

DeleteOfflineMessages clears a user offline queue.

func (*Offline) FetchOfflineMessages

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

FetchOfflineMessages retrieves from storage current user offline queue.

func (*Offline) InsertOfflineMessage

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

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

type Presences

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

Presences represents an in-memory presences storage.

func NewPresences

func NewPresences() *Presences

NewPresences returns an instance of Presences in-memory storage.

func (*Presences) ClearPresences

func (m *Presences) ClearPresences(_ context.Context) error

ClearPresences wipes out all storage presences.

func (*Presences) DeleteAllocationPresences

func (m *Presences) DeleteAllocationPresences(ctx context.Context, _ string) error

DeleteAllocationPresences removes from storage all presences associated to a given allocation.

func (*Presences) DeletePresence

func (m *Presences) DeletePresence(_ context.Context, jid *jid.JID) error

DeletePresence removes from storage a concrete registered presence.

func (*Presences) FetchCapabilities

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

FetchCapabilities fetches capabilities associated to a give node and ver.

func (*Presences) FetchPresence

func (m *Presences) FetchPresence(_ context.Context, jid *jid.JID) (*capsmodel.PresenceCaps, error)

FetchPresence retrieves from storage a previously registered presence.

func (*Presences) FetchPresencesMatchingJID

func (m *Presences) FetchPresencesMatchingJID(ctx context.Context, j *jid.JID) ([]capsmodel.PresenceCaps, error)

FetchPresencesMatchingJID retrives all storage presences matching a certain JID

func (*Presences) UpsertCapabilities

func (m *Presences) UpsertCapabilities(_ context.Context, caps *capsmodel.Capabilities) error

UpsertCapabilities inserts capabilities associated to a node+ver pair, or updates them if previously inserted..

func (*Presences) UpsertPresence

func (m *Presences) UpsertPresence(_ context.Context, presence *xmpp.Presence, jid *jid.JID, allocationID string) (inserted bool, err error)

UpsertPresence inserts or updates a presence and links it to certain allocation. On insertion 'inserted' return parameter will be true.

type Private

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

Private represents an in-memory private storage.

func NewPrivate

func NewPrivate() *Private

NewPrivate returns an instance of Private in-memory storage.

func (*Private) FetchPrivateXML

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

FetchPrivateXML retrieves from storage a private element.

func (*Private) UpsertPrivateXML

func (m *Private) 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.

type PubSub

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

PubSub represents an in-memory pubsub storage.

func NewPubSub

func NewPubSub() *PubSub

NewPubSub returns an instance of PubSub in-memory storage.

func (*PubSub) DeleteNode

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

DeleteNode deletes a pubsub node from storage.

func (*PubSub) DeleteNodeAffiliation

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

DeleteNodeAffiliation deletes a pubsub node affiliation from storage.

func (*PubSub) DeleteNodeSubscription

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

DeleteNodeSubscription deletes a pubsub node subscription from storage.

func (*PubSub) FetchHosts

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

FetchHosts returns all host identifiers.

func (*PubSub) FetchNode

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

FetchNode retrieves from storage a pubsub node entity.

func (*PubSub) FetchNodeAffiliation

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

FetchNodeAffiliation retrieves a concrete node affiliation from storage.

func (*PubSub) FetchNodeAffiliations

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

FetchNodeAffiliations retrieves all affiliations associated to a node.

func (*PubSub) FetchNodeItems

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

FetchNodeItems retrieves all items associated to a node.

func (*PubSub) FetchNodeItemsWithIDs

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

FetchNodeItemsWithIDs retrieves all items matching any of the passed identifiers.

func (*PubSub) FetchNodeLastItem

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

FetchNodeLastItem retrieves last published node item.

func (*PubSub) FetchNodeSubscriptions

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

FetchNodeSubscriptions retrieves all subscriptions associated to a node.

func (*PubSub) FetchNodes

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

FetchNodes retrieves from storage all node entities associated with a host.

func (*PubSub) FetchSubscribedNodes

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

FetchSubscribedNodes retrieves from storage all nodes to which a given jid is subscribed.

func (*PubSub) UpsertNode

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

UpsertNode inserts a new pubsub node entity into storage, or updates it if previously inserted.

func (*PubSub) UpsertNodeAffiliation

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

UpsertNodeAffiliation inserts a new pubsub node affiliation into storage, or updates it if previously inserted.

func (*PubSub) UpsertNodeItem

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

UpsertNodeItem inserts a new pubsub node item entity into storage, or updates it if previously inserted.

func (*PubSub) UpsertNodeSubscription

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

UpsertNodeSubscription inserts a new pubsub node subscription into storage, or updates it if previously inserted.

type Room

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

Room represents an in-memory room storage.

func NewRoom

func NewRoom() *Room

NewRoom returns an instance of Room in-memory storage.

func (*Room) CountRooms

func (r *Room) CountRooms(ctx context.Context) (int, error)

CountRooms returns current size of rooms.

func (*Room) FetchQCStream

func (r *Room) FetchQCStream(ctx context.Context, username string) (*roomsmodel.VideoStream, error)

FetchQCStream retrieves qc room stream entites from storage.

func (*Room) FetchRoom

func (r *Room) FetchRoom(ctx context.Context, username string) (*roomsmodel.Room, error)

FetchRoom retrieves a room entity from storage.

func (*Room) FetchRooms

func (r *Room) FetchRooms(ctx context.Context, page int, pageSize int) ([]roomsmodel.Room, error)

FetchRooms retrieves room entites from storage.

type Roster

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

Roster represents an in-memory roster storage.

func NewRoster

func NewRoster() *Roster

NewRoster returns an instance of Roster in-memory storage.

func (*Roster) DeleteRosterItem

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

DeleteRosterItem deletes a roster item entity from storage.

func (*Roster) DeleteRosterNotification

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

DeleteRosterNotification deletes a roster notification entity from storage.

func (*Roster) FetchRosterGroups

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

FetchRosterGroups retrieves all groups associated to a user roster.

func (*Roster) FetchRosterItem

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

FetchRosterItem retrieves from storage a roster item entity.

func (*Roster) FetchRosterItems

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

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

func (*Roster) FetchRosterItemsInGroups

func (m *Roster) 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 (*Roster) FetchRosterNotification

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

FetchRosterNotification retrieves from storage a roster notification entity.

func (*Roster) FetchRosterNotifications

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

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

func (*Roster) UpsertRosterItem

func (m *Roster) UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) (rostermodel.Version, error)

UpsertRosterItem inserts a new roster item entity into storage, or updates it if previously inserted.

func (*Roster) UpsertRosterNotification

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

UpsertRosterNotification inserts a new roster notification entity into storage, or updates it if previously inserted.

type User

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

User represents an in-memory user storage.

func NewUser

func NewUser() *User

NewUser returns an instance of User in-memory storage.

func (*User) DeleteUser

func (m *User) DeleteUser(ctx context.Context, username string) error

DeleteUser deletes a user entity from storage.

func (*User) FetchUser

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

FetchUser retrieves a user entity from storage.

func (*User) UpsertUser

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

UpsertUser inserts a new user entity into storage, or updates it if previously inserted.

func (*User) UserExists

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

UserExists tells whether or not a user exists within storage.

type VCard

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

VCard represents an in-memory vCard storage.

func NewVCard

func NewVCard() *VCard

NewVCard returns an instance of VCardin-memory storage.

func (*VCard) FetchVCard

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

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

func (*VCard) UpsertVCard

func (m *VCard) 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.

Jump to

Keyboard shortcuts

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