storage

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: GPL-3.0 Imports: 11 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 DeleteBlockListItem added in v0.7.0

func DeleteBlockListItem(item *model.BlockListItem) error

DeleteBlockListItem deletes a block list item entity from storage.

func DeleteNode added in v0.7.0

func DeleteNode(host, name string) error

func DeleteNodeAffiliation added in v0.7.0

func DeleteNodeAffiliation(jid, host, name string) error

func DeleteNodeSubscription added in v0.7.0

func DeleteNodeSubscription(jid, host, name string) error

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 FetchCapabilities added in v0.7.0

func FetchCapabilities(node, ver string) (*model.Capabilities, error)

func FetchHosts added in v0.7.0

func FetchHosts() (hosts []string, err error)

func FetchNode added in v0.7.0

func FetchNode(host, name string) (*pubsubmodel.Node, error)

func FetchNodeAffiliation added in v0.7.0

func FetchNodeAffiliation(host, name, jid string) (*pubsubmodel.Affiliation, error)

func FetchNodeAffiliations added in v0.7.0

func FetchNodeAffiliations(host, name string) ([]pubsubmodel.Affiliation, error)

func FetchNodeItems added in v0.7.0

func FetchNodeItems(host, name string) ([]pubsubmodel.Item, error)

func FetchNodeItemsWithIDs added in v0.7.0

func FetchNodeItemsWithIDs(host, name string, identifiers []string) ([]pubsubmodel.Item, error)

func FetchNodeLastItem added in v0.7.0

func FetchNodeLastItem(host, name string) (*pubsubmodel.Item, error)

func FetchNodeSubscriptions added in v0.7.0

func FetchNodeSubscriptions(host, name string) ([]pubsubmodel.Subscription, error)

func FetchNodes added in v0.7.0

func FetchNodes(host string) ([]pubsubmodel.Node, error)

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 FetchRosterGroups added in v0.7.0

func FetchRosterGroups(username string) ([]string, error)

FetchRosterGroups retrieves all groups associated to a user roster

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 FetchRosterItemsInGroups added in v0.4.10

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

FetchRosterItemsInGroups retrieves from storage all roster item entities associated to a given user and a set of groups.

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 FetchSubscribedNodes added in v0.7.0

func FetchSubscribedNodes(jid string) ([]pubsubmodel.Node, error)

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 InsertBlockListItem added in v0.7.0

func InsertBlockListItem(item *model.BlockListItem) error

InsertBlockListItem inserts a block list item entity into storage, only in case they haven't been previously inserted.

func InsertCapabilities added in v0.7.0

func InsertCapabilities(caps *model.Capabilities) error

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

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

func IsClusterCompatible added in v0.4.0

func IsClusterCompatible() bool

IsClusterCompatible returns whether or not the underlying storage subsystem can be used in cluster mode.

func Set added in v0.3.4

func Set(storage Storage)

Set sets the global storage.

func Unset added in v0.3.4

func Unset()

Unset disables a previously set global storage.

func UpsertNode added in v0.7.0

func UpsertNode(node *pubsubmodel.Node) error

func UpsertNodeAffiliation added in v0.7.0

func UpsertNodeAffiliation(affiliation *pubsubmodel.Affiliation, host, name string) error

func UpsertNodeItem added in v0.7.0

func UpsertNodeItem(item *pubsubmodel.Item, host, name string, maxNodeItems int) error

func UpsertNodeSubscription added in v0.7.0

func UpsertNodeSubscription(subscription *pubsubmodel.Subscription, host, name string) error

func UpsertRosterItem added in v0.7.0

func UpsertRosterItem(ri *rostermodel.Item) (rostermodel.Version, error)

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

func UpsertRosterNotification added in v0.7.0

func UpsertRosterNotification(rn *rostermodel.Notification) error

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

func UpsertUser added in v0.7.0

func UpsertUser(user *model.User) error

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

func UpsertVCard added in v0.7.0

func UpsertVCard(vCard xmpp.XElement, username string) error

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

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       Type
	MySQL      *mysql.Config
	PostgreSQL *pgsql.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 {
	Close() error

	IsClusterCompatible() bool
	// contains filtered or unexported methods
}

Storage represents an entity storage interface.

var Disabled Storage = &disabledStorage{}

Disabled stores a disabled storage instance.

func New added in v0.3.4

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

New initializes storage sub system.

type Type added in v0.4.0

type Type int

Type represents a storage manager type.

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

	// PostgreSQL represents a PostgreSQL storage type.
	PostgreSQL

	// BadgerDB represents a BadgerDB storage type.
	BadgerDB

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

func (Type) String added in v0.4.0

func (t Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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