storage

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountOfflineMessages added in v0.3.4

func CountOfflineMessages(username string) (int, error)

CountOfflineMessages returns current length of user's offline queue.

func DeleteBlockListItems added in v0.3.4

func DeleteBlockListItems(items []model.BlockListItem) error

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

func DeleteOfflineMessages added in v0.3.4

func DeleteOfflineMessages(username string) error

DeleteOfflineMessages clears a user offline queue.

func DeleteRosterItem added in v0.3.4

func DeleteRosterItem(username, jid string) (rostermodel.Version, error)

DeleteRosterItem deletes a roster item entity from storage.

func DeleteRosterNotification added in v0.3.4

func DeleteRosterNotification(contact, jid string) error

DeleteRosterNotification deletes a roster notification entity from storage.

func DeleteUser added in v0.3.4

func DeleteUser(username string) error

DeleteUser deletes a user entity from storage.

func FetchBlockListItems added in v0.3.4

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

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

func FetchOfflineMessages added in v0.3.4

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

FetchOfflineMessages retrieves from storage current user offline queue.

func FetchPrivateXML added in v0.3.4

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

FetchPrivateXML retrieves from storage a private element.

func FetchRosterItem added in v0.3.4

func FetchRosterItem(username, jid string) (*rostermodel.Item, error)

FetchRosterItem retrieves from storage a roster item entity.

func FetchRosterItems added in v0.3.4

func FetchRosterItems(username string) ([]rostermodel.Item, rostermodel.Version, error)

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

func FetchRosterNotification added in v0.3.4

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

FetchRosterNotification retrieves from storage a roster notification entity.

func FetchRosterNotifications added in v0.3.4

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

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

func FetchUser added in v0.3.4

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

FetchUser retrieves from storage a user entity.

func FetchVCard added in v0.3.4

func FetchVCard(username string) (xmpp.XElement, error)

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

func InsertBlockListItems added in v0.3.4

func 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 InsertOfflineMessage added in v0.3.4

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

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

func InsertOrUpdatePrivateXML added in v0.3.4

func 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 InsertOrUpdateRosterItem added in v0.3.4

func 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 InsertOrUpdateRosterNotification added in v0.3.4

func 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 InsertOrUpdateUser added in v0.3.4

func InsertOrUpdateUser(user *model.User) error

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

func InsertOrUpdateVCard added in v0.3.4

func 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 Set added in v0.3.4

func Set(storage Storage)

func Unset added in v0.3.4

func Unset()

func UserExists added in v0.3.4

func UserExists(username string) (bool, error)

UserExists returns whether or not a user exists within storage.

Types

type Config added in v0.2.0

type Config struct {
	Type     StorageType
	MySQL    *sql.Config
	BadgerDB *badgerdb.Config
}

Config represents an storage manager configuration.

func (*Config) UnmarshalYAML added in v0.2.0

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type Storage

type Storage interface {
	io.Closer
	// contains filtered or unexported methods
}

Storage represents an entity storage interface.

var Disabled Storage = &disabledStorage{}

func New added in v0.3.4

func New(config *Config) (Storage, error)

Initialize initializes storage sub system.

type StorageType added in v0.2.0

type StorageType int

StorageType represents a storage manager type.

const (
	// MySQL represents a MySQL storage type.
	MySQL StorageType = iota

	// BadgerDB represents a BadgerDB storage type.
	BadgerDB

	// Memory represents a in-memstorage storage type.
	Memory
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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