Documentation ¶
Index ¶
- type Config
- type Repository
- func (r *Repository) CapabilitiesExist(ctx context.Context, node, ver string) (ok bool, err error)
- func (r *Repository) CountOfflineMessages(ctx context.Context, username string) (c int, err error)
- func (r *Repository) DeleteArchive(ctx context.Context, archiveID string) error
- func (r *Repository) DeleteArchiveOldestMessages(ctx context.Context, archiveID string, maxElements int) error
- func (r *Repository) DeleteBlockListItem(ctx context.Context, item *blocklistmodel.Item) error
- func (r *Repository) DeleteBlockListItems(ctx context.Context, username string) error
- func (r *Repository) DeleteLast(ctx context.Context, username string) error
- func (r *Repository) DeleteOfflineMessages(ctx context.Context, username string) error
- func (r *Repository) DeletePrivates(ctx context.Context, username string) error
- func (r *Repository) DeleteRosterItem(ctx context.Context, username, jid string) error
- func (r *Repository) DeleteRosterItems(ctx context.Context, username string) error
- func (r *Repository) DeleteRosterNotification(ctx context.Context, contact, jid string) error
- func (r *Repository) DeleteRosterNotifications(ctx context.Context, contact string) error
- func (r *Repository) DeleteUser(ctx context.Context, username string) error
- func (r *Repository) DeleteVCard(ctx context.Context, username string) error
- func (r *Repository) FetchArchiveMessages(ctx context.Context, f *archivemodel.Filters, archiveID string) (messages []*archivemodel.Message, err error)
- func (r *Repository) FetchArchiveMetadata(ctx context.Context, archiveID string) (metadata *archivemodel.Metadata, err error)
- func (r *Repository) FetchBlockListItems(ctx context.Context, username string) (items []*blocklistmodel.Item, err error)
- func (r *Repository) FetchCapabilities(ctx context.Context, node, ver string) (caps *capsmodel.Capabilities, err error)
- func (r *Repository) FetchLast(ctx context.Context, username string) (lst *lastmodel.Last, err error)
- func (r *Repository) FetchOfflineMessages(ctx context.Context, username string) (msg []*stravaganza.Message, err error)
- func (r *Repository) FetchPrivate(ctx context.Context, namespace, username string) (prv stravaganza.Element, err error)
- func (r *Repository) FetchRosterGroups(ctx context.Context, username string) (groups []string, err error)
- func (r *Repository) FetchRosterItem(ctx context.Context, username, jid string) (item *rostermodel.Item, err error)
- func (r *Repository) FetchRosterItems(ctx context.Context, username string) (items []*rostermodel.Item, err error)
- func (r *Repository) FetchRosterItemsInGroups(ctx context.Context, username string, groups []string) (items []*rostermodel.Item, err error)
- func (r *Repository) FetchRosterNotification(ctx context.Context, contact string, jid string) (n *rostermodel.Notification, err error)
- func (r *Repository) FetchRosterNotifications(ctx context.Context, contact string) (ns []*rostermodel.Notification, err error)
- func (r *Repository) FetchRosterVersion(ctx context.Context, username string) (v int, err error)
- func (r *Repository) FetchUser(ctx context.Context, username string) (usr *usermodel.User, err error)
- func (r *Repository) FetchVCard(ctx context.Context, username string) (vc stravaganza.Element, err error)
- func (r *Repository) InTransaction(ctx context.Context, ...) error
- func (r *Repository) InsertArchiveMessage(ctx context.Context, message *archivemodel.Message) error
- func (r *Repository) InsertOfflineMessage(ctx context.Context, message *stravaganza.Message, username string) error
- func (r *Repository) Lock(_ context.Context, _ string) error
- func (r *Repository) Start(_ context.Context) error
- func (r *Repository) Stop(_ context.Context) error
- func (r *Repository) TouchRosterVersion(ctx context.Context, username string) (v int, err error)
- func (r *Repository) Unlock(_ context.Context, _ string) error
- func (r *Repository) UpsertBlockListItem(ctx context.Context, item *blocklistmodel.Item) error
- func (r *Repository) UpsertCapabilities(ctx context.Context, caps *capsmodel.Capabilities) error
- func (r *Repository) UpsertLast(ctx context.Context, last *lastmodel.Last) error
- func (r *Repository) UpsertPrivate(ctx context.Context, private stravaganza.Element, namespace, username string) error
- func (r *Repository) UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) error
- func (r *Repository) UpsertRosterNotification(ctx context.Context, rn *rostermodel.Notification) error
- func (r *Repository) UpsertUser(ctx context.Context, user *usermodel.User) error
- func (r *Repository) UpsertVCard(ctx context.Context, vCard stravaganza.Element, username string) error
- func (r *Repository) UserExists(ctx context.Context, username string) (ok bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Path string `fig:"path" default:".jackal.db"`
}
Config contains BoltDB configuration value.
type Repository ¶
type Repository struct { repository.User repository.Last repository.Capabilities repository.Offline repository.BlockList repository.Private repository.Roster repository.VCard repository.Archive repository.Locker // contains filtered or unexported fields }
Repository represents a BoltDB repository implementation.
func New ¶
func New(cfg Config, logger kitlog.Logger) *Repository
New creates and returns an initialized BoltDB Repository instance.
func (*Repository) CapabilitiesExist ¶
CapabilitiesExist tells whether node+ver capabilities have been already registered.
func (*Repository) CountOfflineMessages ¶
CountOfflineMessages satisfies repository.Offline interface.
func (*Repository) DeleteArchive ¶ added in v0.62.0
func (r *Repository) DeleteArchive(ctx context.Context, archiveID string) error
DeleteArchive clears an archive queue.
func (*Repository) DeleteArchiveOldestMessages ¶ added in v0.62.0
func (r *Repository) DeleteArchiveOldestMessages(ctx context.Context, archiveID string, maxElements int) error
DeleteArchiveOldestMessages trims archive oldest messages up to a maxElements total count.
func (*Repository) DeleteBlockListItem ¶
func (r *Repository) DeleteBlockListItem(ctx context.Context, item *blocklistmodel.Item) error
DeleteBlockListItem deletes a block list item entity from storage.
func (*Repository) DeleteBlockListItems ¶
func (r *Repository) DeleteBlockListItems(ctx context.Context, username string) error
DeleteBlockListItems deletes all block list items associated to a user.
func (*Repository) DeleteLast ¶
func (r *Repository) DeleteLast(ctx context.Context, username string) error
DeleteLast satisfies repository.Last interface.
func (*Repository) DeleteOfflineMessages ¶
func (r *Repository) DeleteOfflineMessages(ctx context.Context, username string) error
DeleteOfflineMessages satisfies repository.Offline interface.
func (*Repository) DeletePrivates ¶
func (r *Repository) DeletePrivates(ctx context.Context, username string) error
DeletePrivates satisfies repository.Private interface.
func (*Repository) DeleteRosterItem ¶
func (r *Repository) DeleteRosterItem(ctx context.Context, username, jid string) error
DeleteRosterItem satisfies repository.Roster interface.
func (*Repository) DeleteRosterItems ¶
func (r *Repository) DeleteRosterItems(ctx context.Context, username string) error
DeleteRosterItems satisfies repository.Roster interface.
func (*Repository) DeleteRosterNotification ¶
func (r *Repository) DeleteRosterNotification(ctx context.Context, contact, jid string) error
DeleteRosterNotification satisfies repository.Roster interface.
func (*Repository) DeleteRosterNotifications ¶
func (r *Repository) DeleteRosterNotifications(ctx context.Context, contact string) error
DeleteRosterNotifications satisfies repository.Roster interface.
func (*Repository) DeleteUser ¶
func (r *Repository) DeleteUser(ctx context.Context, username string) error
DeleteUser satisfies repository.User interface.
func (*Repository) DeleteVCard ¶
func (r *Repository) DeleteVCard(ctx context.Context, username string) error
DeleteVCard satisfies repository.VCard interface.
func (*Repository) FetchArchiveMessages ¶ added in v0.62.0
func (r *Repository) FetchArchiveMessages(ctx context.Context, f *archivemodel.Filters, archiveID string) (messages []*archivemodel.Message, err error)
FetchArchiveMessages fetches archive asscociated messages applying the passed f filters.
func (*Repository) FetchArchiveMetadata ¶ added in v0.62.0
func (r *Repository) FetchArchiveMetadata(ctx context.Context, archiveID string) (metadata *archivemodel.Metadata, err error)
FetchArchiveMetadata returns the metadata value associated to an archive.
func (*Repository) FetchBlockListItems ¶
func (r *Repository) FetchBlockListItems(ctx context.Context, username string) (items []*blocklistmodel.Item, err error)
FetchBlockListItems retrieves from storage all block list items associated to a user.
func (*Repository) FetchCapabilities ¶
func (r *Repository) FetchCapabilities(ctx context.Context, node, ver string) (caps *capsmodel.Capabilities, err error)
FetchCapabilities fetches capabilities associated to a given node+ver pair.
func (*Repository) FetchLast ¶
func (r *Repository) FetchLast(ctx context.Context, username string) (lst *lastmodel.Last, err error)
FetchLast satisfies repository.Last interface.
func (*Repository) FetchOfflineMessages ¶
func (r *Repository) FetchOfflineMessages(ctx context.Context, username string) (msg []*stravaganza.Message, err error)
FetchOfflineMessages satisfies repository.Offline interface.
func (*Repository) FetchPrivate ¶
func (r *Repository) FetchPrivate(ctx context.Context, namespace, username string) (prv stravaganza.Element, err error)
FetchPrivate satisfies repository.Private interface.
func (*Repository) FetchRosterGroups ¶
func (r *Repository) FetchRosterGroups(ctx context.Context, username string) (groups []string, err error)
FetchRosterGroups satisfies repository.Roster interface.
func (*Repository) FetchRosterItem ¶
func (r *Repository) FetchRosterItem(ctx context.Context, username, jid string) (item *rostermodel.Item, err error)
FetchRosterItem satisfies repository.Roster interface.
func (*Repository) FetchRosterItems ¶
func (r *Repository) FetchRosterItems(ctx context.Context, username string) (items []*rostermodel.Item, err error)
FetchRosterItems satisfies repository.Roster interface.
func (*Repository) FetchRosterItemsInGroups ¶
func (r *Repository) FetchRosterItemsInGroups(ctx context.Context, username string, groups []string) (items []*rostermodel.Item, err error)
FetchRosterItemsInGroups satisfies repository.Roster interface.
func (*Repository) FetchRosterNotification ¶
func (r *Repository) FetchRosterNotification(ctx context.Context, contact string, jid string) (n *rostermodel.Notification, err error)
FetchRosterNotification satisfies repository.Roster interface.
func (*Repository) FetchRosterNotifications ¶
func (r *Repository) FetchRosterNotifications(ctx context.Context, contact string) (ns []*rostermodel.Notification, err error)
FetchRosterNotifications satisfies repository.Roster interface.
func (*Repository) FetchRosterVersion ¶
FetchRosterVersion satisfies repository.Roster interface.
func (*Repository) FetchUser ¶
func (r *Repository) FetchUser(ctx context.Context, username string) (usr *usermodel.User, err error)
FetchUser satisfies repository.User interface.
func (*Repository) FetchVCard ¶
func (r *Repository) FetchVCard(ctx context.Context, username string) (vc stravaganza.Element, err error)
FetchVCard satisfies repository.VCard interface.
func (*Repository) InTransaction ¶
func (r *Repository) InTransaction(ctx context.Context, f func(ctx context.Context, tx repository.Transaction) error) error
InTransaction generates a BoltDB transaction and completes it after it's being used by f function.
func (*Repository) InsertArchiveMessage ¶ added in v0.62.0
func (r *Repository) InsertArchiveMessage(ctx context.Context, message *archivemodel.Message) error
InsertArchiveMessage inserts a new message element into an archive queue.
func (*Repository) InsertOfflineMessage ¶
func (r *Repository) InsertOfflineMessage(ctx context.Context, message *stravaganza.Message, username string) error
InsertOfflineMessage satisfies repository.Offline interface.
func (*Repository) Lock ¶
func (r *Repository) Lock(_ context.Context, _ string) error
Lock satisfies repository.Locker interface.
func (*Repository) Start ¶
func (r *Repository) Start(_ context.Context) error
Start implements Start interface method.
func (*Repository) Stop ¶
func (r *Repository) Stop(_ context.Context) error
Stop closes BoltDB database.
func (*Repository) TouchRosterVersion ¶
TouchRosterVersion satisfies repository.Roster interface.
func (*Repository) Unlock ¶
func (r *Repository) Unlock(_ context.Context, _ string) error
Unlock satisfies repository.Locker interface.
func (*Repository) UpsertBlockListItem ¶
func (r *Repository) UpsertBlockListItem(ctx context.Context, item *blocklistmodel.Item) error
UpsertBlockListItem satisfies repository.BlockList interface.
func (*Repository) UpsertCapabilities ¶
func (r *Repository) UpsertCapabilities(ctx context.Context, caps *capsmodel.Capabilities) error
UpsertCapabilities satisfies repository.Capabilities interface.
func (*Repository) UpsertLast ¶
UpsertLast satisfies repository.Last interface.
func (*Repository) UpsertPrivate ¶
func (r *Repository) UpsertPrivate(ctx context.Context, private stravaganza.Element, namespace, username string) error
UpsertPrivate satisfies repository.Private interface.
func (*Repository) UpsertRosterItem ¶
func (r *Repository) UpsertRosterItem(ctx context.Context, ri *rostermodel.Item) error
UpsertRosterItem satisfies repository.Roster interface.
func (*Repository) UpsertRosterNotification ¶
func (r *Repository) UpsertRosterNotification(ctx context.Context, rn *rostermodel.Notification) error
UpsertRosterNotification satisfies repository.Roster interface.
func (*Repository) UpsertUser ¶
UpsertUser satisfies repository.User interface.
func (*Repository) UpsertVCard ¶
func (r *Repository) UpsertVCard(ctx context.Context, vCard stravaganza.Element, username string) error
UpsertVCard satisfies repository.VCard interface.
func (*Repository) UserExists ¶
UserExists satisfies repository.User interface.