badgerdb

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir string `yaml:"data_dir"`
}

Config represents BadgerDB storage configuration.

type Storage

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

Storage represents a BadgerDB storage sub system.

func New

func New(cfg *Config) *Storage

New returns a new BadgerDB storage instance.

func (*Storage) CountOfflineMessages

func (b *Storage) CountOfflineMessages(username string) (int, error)

CountOfflineMessages returns current length of user's offline queue.

func (*Storage) DeleteBlockListItems

func (b *Storage) DeleteBlockListItems(items []model.BlockListItem) error

DeleteBlockListItems deletes a set of block list item entities from storage.

func (*Storage) DeleteOfflineMessages

func (b *Storage) DeleteOfflineMessages(username string) error

DeleteOfflineMessages clears a user offline queue.

func (*Storage) DeleteRosterItem

func (b *Storage) DeleteRosterItem(user, contact string) (rostermodel.Version, error)

DeleteRosterItem deletes a roster item entity from storage.

func (*Storage) DeleteRosterNotification

func (b *Storage) DeleteRosterNotification(contact, jid string) error

DeleteRosterNotification deletes a roster notification entity from storage.

func (*Storage) DeleteUser

func (b *Storage) DeleteUser(username string) error

DeleteUser deletes a user entity from storage.

func (*Storage) FetchBlockListItems

func (b *Storage) FetchBlockListItems(username string) ([]model.BlockListItem, error)

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

func (*Storage) FetchOfflineMessages

func (b *Storage) FetchOfflineMessages(username string) ([]*xmpp.Message, error)

FetchOfflineMessages retrieves from storage current user offline queue.

func (*Storage) FetchPrivateXML

func (b *Storage) FetchPrivateXML(namespace string, username string) ([]xmpp.XElement, error)

FetchPrivateXML retrieves from storage a private element.

func (*Storage) FetchRosterItem

func (b *Storage) FetchRosterItem(user, contact string) (*rostermodel.Item, error)

FetchRosterItem retrieves from storage a roster item entity.

func (*Storage) FetchRosterItems

func (b *Storage) FetchRosterItems(user string) ([]rostermodel.Item, rostermodel.Version, error)

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

func (*Storage) FetchRosterNotification added in v0.3.0

func (b *Storage) FetchRosterNotification(contact string, jid string) (*rostermodel.Notification, error)

FetchRosterNotification retrieves from storage a roster notification entity.

func (*Storage) FetchRosterNotifications

func (b *Storage) FetchRosterNotifications(contact string) ([]rostermodel.Notification, error)

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

func (*Storage) FetchUser

func (b *Storage) FetchUser(username string) (*model.User, error)

FetchUser retrieves from storage a user entity.

func (*Storage) FetchVCard

func (b *Storage) FetchVCard(username string) (xmpp.XElement, error)

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

func (*Storage) InsertBlockListItems

func (b *Storage) InsertBlockListItems(items []model.BlockListItem) error

InsertBlockListItems inserts a set of block list item entities into storage, only in case they haven't been previously inserted.

func (*Storage) InsertOfflineMessage

func (b *Storage) InsertOfflineMessage(message *xmpp.Message, username string) error

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

func (*Storage) InsertOrUpdatePrivateXML

func (b *Storage) InsertOrUpdatePrivateXML(privateXML []xmpp.XElement, namespace string, username string) error

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

func (*Storage) InsertOrUpdateRosterItem

func (b *Storage) InsertOrUpdateRosterItem(ri *rostermodel.Item) (rostermodel.Version, error)

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

func (*Storage) InsertOrUpdateRosterNotification

func (b *Storage) InsertOrUpdateRosterNotification(rn *rostermodel.Notification) error

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

func (*Storage) InsertOrUpdateUser

func (b *Storage) InsertOrUpdateUser(user *model.User) error

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

func (*Storage) InsertOrUpdateVCard

func (b *Storage) InsertOrUpdateVCard(vCard xmpp.XElement, username string) error

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

func (*Storage) Shutdown

func (b *Storage) Shutdown()

Shutdown shuts down BadgerDB storage sub system.

func (*Storage) UserExists

func (b *Storage) UserExists(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