repository

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive added in v0.62.0

type Archive interface {
	// InsertArchiveMessage inserts a new message element into an archive queue.
	InsertArchiveMessage(ctx context.Context, message *archivemodel.Message) error

	// FetchArchiveMetadata returns the metadata value associated to an archive.
	FetchArchiveMetadata(ctx context.Context, archiveID string) (*archivemodel.Metadata, error)

	// FetchArchiveMessages fetches archive asscociated messages applying the passed f filters.
	FetchArchiveMessages(ctx context.Context, f *archivemodel.Filters, archiveID string) ([]*archivemodel.Message, error)

	// DeleteArchiveOldestMessages trims archive oldest messages up to a maxElements total count.
	DeleteArchiveOldestMessages(ctx context.Context, archiveID string, maxElements int) error

	// DeleteArchive clears an archive queue.
	DeleteArchive(ctx context.Context, archiveID string) error
}

Archive defines storage operations for message archive

type BlockList

type BlockList interface {
	// UpsertBlockListItem upserts a block list item entity into storage.
	UpsertBlockListItem(ctx context.Context, item *blocklistmodel.Item) error

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

	// FetchBlockListItems retrieves from storage all block list items associated to a user.
	FetchBlockListItems(ctx context.Context, username string) ([]*blocklistmodel.Item, error)

	// DeleteBlockListItems deletes all block list items associated to a user.
	DeleteBlockListItems(ctx context.Context, username string) error
}

BlockList defines storage operations for user's block list

type Capabilities

type Capabilities interface {
	// UpsertCapabilities upserts capabilities associated to a node+ver pair.
	UpsertCapabilities(ctx context.Context, caps *capsmodel.Capabilities) error

	// CapabilitiesExist tells whether node+ver capabilities have been already registered.
	CapabilitiesExist(ctx context.Context, node, ver string) (bool, error)

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

Capabilities defines user capabilities repository operations.

type Last

type Last interface {
	// UpsertLast upserts a last activity entity into storage.
	UpsertLast(ctx context.Context, last *lastmodel.Last) error

	// FetchLast retrieves from storage last activity entity associated to a user.
	FetchLast(ctx context.Context, username string) (*lastmodel.Last, error)

	// DeleteLast removes last activity entity from storage.
	DeleteLast(ctx context.Context, username string) error
}

Last defines user last activity repository operations.

type Locker added in v0.57.0

type Locker interface {
	// Lock obtains an exclusive lock.
	Lock(ctx context.Context, lockID string) error

	// Unlock releases an exclusive lock.
	Unlock(ctx context.Context, lockID string) error
}

Locker defines repository locker interface.

type Offline

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

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

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

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

Offline defines user offline repository operations.

type Private

type Private interface {
	// FetchPrivate retrieves a private element from storage.
	FetchPrivate(ctx context.Context, namespace, username string) (stravaganza.Element, error)

	// UpsertPrivate upserts a new private element into repository.
	UpsertPrivate(ctx context.Context, private stravaganza.Element, namespace, username string) error

	// DeletePrivates deletes all user stored private data.
	DeletePrivates(ctx context.Context, username string) error
}

Private defines operations for private repository.

type Repository

type Repository interface {

	// InTransaction generates a repository transaction and completes it after it's being used by f function.
	// In case f returns no error tx transaction will be committed.
	InTransaction(ctx context.Context, f func(ctx context.Context, tx Transaction) error) error

	// Start initializes repository.
	Start(ctx context.Context) error

	// Stop releases all underlying repository resources.
	Stop(ctx context.Context) error
	// contains filtered or unexported methods
}

Repository represents application repository interface.

type Roster

type Roster interface {
	// TouchRosterVersion increments user roster version.
	TouchRosterVersion(ctx context.Context, username string) (int, error)

	// FetchRosterVersion fetches user roster version.
	FetchRosterVersion(ctx context.Context, username string) (int, error)

	// UpsertRosterItem inserts a new roster item entity into repository.
	UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) error

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

	// DeleteRosterItems deletes all user roster items.
	DeleteRosterItems(ctx context.Context, username string) error

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

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

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

	// UpsertRosterNotification inserts or updates a roster notification entity into repository.
	UpsertRosterNotification(ctx context.Context, rn *rostermodel.Notification) error

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

	// DeleteRosterNotifications deletes all contact roster notifications.
	DeleteRosterNotifications(ctx context.Context, contact string) error

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

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

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

Roster defines user roster repository operations.

type Transaction

type Transaction interface {
	// contains filtered or unexported methods
}

Transaction represents a repository transaction interface. All repository supported operations must be allowed to be used through a derived transaction.

type User

type User interface {
	// UpsertUser inserts a new user entity into repository.
	UpsertUser(ctx context.Context, user *usermodel.User) error

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

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

	// UserExists tells whether or not a user exists within repository.
	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 repository.
	UpsertVCard(ctx context.Context, vCard stravaganza.Element, username string) error

	// FetchVCard retrieves from repository a user vCard.
	FetchVCard(ctx context.Context, username string) (stravaganza.Element, error)

	// DeleteVCard deletes a vCard entity from repository.
	DeleteVCard(ctx context.Context, username string) error
}

VCard defines vCard repository operations.

Jump to

Keyboard shortcuts

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