repository

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockList

type BlockList interface {
	// InsertBlockListItem inserts a block list item entity into storage if not previously inserted.
	InsertBlockListItem(ctx context.Context, item *model.BlockListItem) error

	// DeleteBlockListItem deletes a block list item entity from storage.
	DeleteBlockListItem(ctx context.Context, item *model.BlockListItem) error

	// FetchBlockListItems retrieves from storage all block list item entities associated to a given user.
	FetchBlockListItems(ctx context.Context, username string) ([]model.BlockListItem, error)
}

BlockList defines storage operations for user's block list

type Container

type Container interface {
	// User method returns repository.User concrete implementation.
	User() User

	// Roster method returns repository.Roster concrete implementation.
	Roster() Roster

	// Presences method returns repository.Presences concrete implementation.
	Presences() Presences

	// VCard method returns repository.VCard concrete implementation.
	VCard() VCard

	// Private method returns repository.Private concrete implementation.
	Private() Private

	// BlockList method returns repository.BlockList concrete implementation.
	BlockList() BlockList

	// PubSub method returns repository.PubSub concrete implementation.
	PubSub() PubSub

	// Offline method returns repository.Offline concrete implementation.
	Offline() Offline

	// Room method returns repository.Room concrete implementation.
	Room() Room

	// Close closes underlying storage resources, commonly shared across repositories.
	Close(ctx context.Context) error

	// IsClusterCompatible tells whether or not container instance can be safely used across multiple cluster nodes.
	IsClusterCompatible() bool
}

Container interface brings together all repository instance.

type Offline

type Offline interface {
	// InsertOfflineMessage inserts a new message element into user's offline queue.
	InsertOfflineMessage(ctx context.Context, message *xmpp.Message, username string) error

	// CountOfflineMessages returns current length of user's offline queue.
	CountOfflineMessages(ctx context.Context, username string) (int, error)

	// FetchOfflineMessages retrieves from storage current user offline queue.
	FetchOfflineMessages(ctx context.Context, username string) ([]xmpp.Message, error)

	// DeleteOfflineMessages clears a user offline queue.
	DeleteOfflineMessages(ctx context.Context, username string) error
}

Offline defines storage operations for offline messages

type Presences

type Presences interface {
	// UpsertPresence inserts or updates a presence and links it to certain allocation.
	// On insertion 'inserted' return parameter will be true.
	UpsertPresence(ctx context.Context, presence *xmpp.Presence, jid *jid.JID, allocationID string) (inserted bool, err error)

	// FetchPresence retrieves from storage a previously registered presence.
	FetchPresence(ctx context.Context, jid *jid.JID) (*capsmodel.PresenceCaps, error)

	// FetchPresencesMatchingJID retrives all storage presences matching a certain JID
	FetchPresencesMatchingJID(ctx context.Context, jid *jid.JID) ([]capsmodel.PresenceCaps, error)

	// DeletePresence removes from storage a concrete registered presence.
	DeletePresence(ctx context.Context, jid *jid.JID) error

	// DeleteAllocationPresences removes from storage all presences associated to a given allocation.
	DeleteAllocationPresences(ctx context.Context, allocationID string) error

	// ClearPresences wipes out all storage presences.
	ClearPresences(ctx context.Context) error

	// UpsertCapabilities inserts capabilities associated to a node+ver pair, or updates them if previously inserted..
	UpsertCapabilities(ctx context.Context, caps *capsmodel.Capabilities) error

	// FetchCapabilities fetches capabilities associated to a give node and ver.
	FetchCapabilities(ctx context.Context, node, ver string) (*capsmodel.Capabilities, error)
}

Presences defines presence repository operations

type Private

type Private interface {
	// FetchPrivateXML retrieves from storage a private element.
	FetchPrivateXML(ctx context.Context, namespace string, username string) ([]xmpp.XElement, error)

	// UpsertPrivateXML inserts a new private element into storage, or updates it if previously inserted.
	UpsertPrivateXML(ctx context.Context, privateXML []xmpp.XElement, namespace string, username string) error
}

Private defines operations for private storage.

type PubSub

type PubSub interface {
	// FetchHosts returns all host identifiers.
	FetchHosts(ctx context.Context) (hosts []string, err error)

	// UpsertNode inserts a new pubsub node entity into storage, or updates it if previously inserted.
	UpsertNode(ctx context.Context, node *pubsubmodel.Node) error

	// FetchNode retrieves from storage a pubsub node entity.
	FetchNode(ctx context.Context, host, name string) (*pubsubmodel.Node, error)

	// FetchNodes retrieves from storage all node entities associated with a host.
	FetchNodes(ctx context.Context, host string) ([]pubsubmodel.Node, error)

	// FetchSubscribedNodes retrieves from storage all nodes to which a given jid is subscribed.
	FetchSubscribedNodes(ctx context.Context, jid string) ([]pubsubmodel.Node, error)

	// DeleteNode deletes a pubsub node from storage.
	DeleteNode(ctx context.Context, host, name string) error

	// UpsertNodeItem inserts a new pubsub node item entity into storage, or updates it if previously inserted.
	UpsertNodeItem(ctx context.Context, item *pubsubmodel.Item, host, name string, maxNodeItems int) error

	// FetchNodeItems retrieves all items associated to a node.
	FetchNodeItems(ctx context.Context, host, name string) ([]pubsubmodel.Item, error)

	// FetchNodeItemsWithIDs retrieves all items matching any of the passed identifiers.
	FetchNodeItemsWithIDs(ctx context.Context, host, name string, identifiers []string) ([]pubsubmodel.Item, error)

	// FetchNodeLastItem retrieves last published node item.
	FetchNodeLastItem(ctx context.Context, host, name string) (*pubsubmodel.Item, error)

	// UpsertNodeAffiliation inserts a new pubsub node affiliation into storage, or updates it if previously inserted.
	UpsertNodeAffiliation(ctx context.Context, affiliation *pubsubmodel.Affiliation, host, name string) error

	// FetchNodeAffiliation retrieves a concrete node affiliation from storage.
	FetchNodeAffiliation(ctx context.Context, host, name, jid string) (*pubsubmodel.Affiliation, error)

	// FetchNodeAffiliations retrieves all affiliations associated to a node.
	FetchNodeAffiliations(ctx context.Context, host, name string) ([]pubsubmodel.Affiliation, error)

	// DeleteNodeAffiliation deletes a pubsub node affiliation from storage.
	DeleteNodeAffiliation(ctx context.Context, jid, host, name string) error

	// UpsertNodeSubscription inserts a new pubsub node subscription into storage, or updates it if previously inserted.
	UpsertNodeSubscription(ctx context.Context, subscription *pubsubmodel.Subscription, host, name string) error

	// FetchNodeSubscriptions retrieves all subscriptions associated to a node.
	FetchNodeSubscriptions(ctx context.Context, host, name string) ([]pubsubmodel.Subscription, error)

	// DeleteNodeSubscription deletes a pubsub node subscription from storage.
	DeleteNodeSubscription(ctx context.Context, jid, host, name string) error
}

PubSub defines storage operations for pubsub management.

type Room

type Room interface {

	// FetchRoom retrieves a room entity from storage.
	FetchRoom(ctx context.Context, username string) (*roomsmodel.Room, error)

	// FetchRooms retrieves room entites from storage.
	FetchRooms(ctx context.Context, page int, pageSize int) ([]roomsmodel.Room, error)

	// CountRooms  returns current size of rooms.
	CountRooms(ctx context.Context) (int, error)

	// FetchQCStream retrieves qc room stream entites from storage.
	FetchQCStream(ctx context.Context, username string) (*roomsmodel.VideoStream, error)
}

Room defines room repository operations

type Roster

type Roster interface {
	// UpsertRosterItem inserts a new roster item entity into storage, or updates it if previously inserted.
	UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) (rostermodel.Version, error)

	// DeleteRosterItem deletes a roster item entity from storage.
	DeleteRosterItem(ctx context.Context, username, jid string) (rostermodel.Version, error)

	// FetchRosterItems retrieves from storage all roster item entities associated to a given user.
	FetchRosterItems(ctx context.Context, username string) ([]rostermodel.Item, rostermodel.Version, error)

	// FetchRosterItemsInGroups retrieves from storage all roster item entities associated to a given user and a set of groups.
	FetchRosterItemsInGroups(ctx context.Context, username string, groups []string) ([]rostermodel.Item, rostermodel.Version, error)

	// FetchRosterItem retrieves from storage a roster item entity.
	FetchRosterItem(ctx context.Context, username, jid string) (*rostermodel.Item, error)

	// UpsertRosterNotification inserts a new roster notification entity into storage, or updates it if previously inserted.
	UpsertRosterNotification(ctx context.Context, rn *rostermodel.Notification) error

	// DeleteRosterNotification deletes a roster notification entity from storage.
	DeleteRosterNotification(ctx context.Context, contact, jid string) error

	// FetchRosterNotification retrieves from storage a roster notification entity.
	FetchRosterNotification(ctx context.Context, contact string, jid string) (*rostermodel.Notification, error)

	// FetchRosterNotifications retrieves from storage all roster notifications associated to a given user.
	FetchRosterNotifications(ctx context.Context, contact string) ([]rostermodel.Notification, error)

	// FetchRosterGroups retrieves all groups associated to a user roster.
	FetchRosterGroups(ctx context.Context, username string) ([]string, error)
}

Roster defines storage operations for user's roster.

type User

type User interface {
	// UpsertUser inserts a new user entity into storage, or updates it if previously inserted.
	UpsertUser(ctx context.Context, user *model.User) error

	// DeleteUser deletes a user entity from storage.
	DeleteUser(ctx context.Context, username string) error

	// FetchUser retrieves a user entity from storage.
	FetchUser(ctx context.Context, username string) (*model.User, error)

	// UserExists tells whether or not a user exists within storage.
	UserExists(ctx context.Context, username string) (bool, error)
}

User defines user repository operations

type VCard

type VCard interface {

	// UpsertVCard inserts a new vCard element into storage, or updates it in case it's been previously inserted.
	UpsertVCard(ctx context.Context, vCard xmpp.XElement, username string) error

	// FetchVCard retrieves from storage a vCard element associated to a given user.
	FetchVCard(ctx context.Context, username string) (xmpp.XElement, error)
}

VCard defines storage operations for vCards

Jump to

Keyboard shortcuts

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