storage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: GPL-3.0 Imports: 12 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(ctx context.Context, username string) (int, error)

CountOfflineMessages returns current length of user's offline queue.

func DeleteBlockListItem added in v0.7.0

func DeleteBlockListItem(ctx context.Context, item *model.BlockListItem) error

DeleteBlockListItem deletes a block list item entity from storage.

func DeleteNode added in v0.7.0

func DeleteNode(ctx context.Context, host, name string) error

func DeleteNodeAffiliation added in v0.7.0

func DeleteNodeAffiliation(ctx context.Context, jid, host, name string) error

func DeleteNodeSubscription added in v0.7.0

func DeleteNodeSubscription(ctx context.Context, jid, host, name string) error

func DeleteOfflineMessages added in v0.3.4

func DeleteOfflineMessages(ctx context.Context, username string) error

DeleteOfflineMessages clears a user offline queue.

func DeleteRosterItem added in v0.3.4

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

DeleteRosterItem deletes a roster item entity from storage.

func DeleteRosterNotification added in v0.3.4

func DeleteRosterNotification(ctx context.Context, contact, jid string) error

DeleteRosterNotification deletes a roster notification entity from storage.

func DeleteUser added in v0.3.4

func DeleteUser(ctx context.Context, username string) error

DeleteUser deletes a user entity from storage.

func FetchBlockListItems added in v0.3.4

func FetchBlockListItems(ctx context.Context, 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(ctx context.Context, node, ver string) (*model.Capabilities, error)

func FetchHosts added in v0.7.0

func FetchHosts(ctx context.Context) (hosts []string, err error)

func FetchNode added in v0.7.0

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

func FetchNodeAffiliation added in v0.7.0

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

func FetchNodeAffiliations added in v0.7.0

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

func FetchNodeItems added in v0.7.0

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

func FetchNodeItemsWithIDs added in v0.7.0

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

func FetchNodeLastItem added in v0.7.0

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

func FetchNodeSubscriptions added in v0.7.0

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

func FetchNodes added in v0.7.0

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

func FetchOfflineMessages added in v0.3.4

func FetchOfflineMessages(ctx context.Context, username string) ([]xmpp.Message, error)

FetchOfflineMessages retrieves from storage current user offline queue.

func FetchPrivateXML added in v0.3.4

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

FetchPrivateXML retrieves from storage a private element.

func FetchRosterGroups added in v0.7.0

func FetchRosterGroups(ctx context.Context, username string) ([]string, error)

FetchRosterGroups retrieves all groups associated to a user roster

func FetchRosterItem added in v0.3.4

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

FetchRosterItem retrieves from storage a roster item entity.

func FetchRosterItems added in v0.3.4

func FetchRosterItems(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, contact string, jid string) (*rostermodel.Notification, error)

FetchRosterNotification retrieves from storage a roster notification entity.

func FetchRosterNotifications added in v0.3.4

func FetchRosterNotifications(ctx context.Context, 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(ctx context.Context, jid string) ([]pubsubmodel.Node, error)

func FetchUser added in v0.3.4

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

FetchUser retrieves from storage a user entity.

func FetchVCard added in v0.3.4

func FetchVCard(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, caps *model.Capabilities) error

func InsertOfflineMessage added in v0.3.4

func InsertOfflineMessage(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, node *pubsubmodel.Node) error

func UpsertNodeAffiliation added in v0.7.0

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

func UpsertNodeItem added in v0.7.0

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

func UpsertNodeSubscription added in v0.7.0

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

func UpsertRosterItem added in v0.7.0

func UpsertRosterItem(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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