storage

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMockedError = errors.New("storage mocked error")

ErrMockedError represents a storage mocked error value.

Functions

func ActivateMockedError

func ActivateMockedError()

ActivateMockedError forces the return of ErrMockedError from current storage manager. This method should only be used for testing purposes.

func DeactivateMockedError

func DeactivateMockedError()

DeactivateMockedError disables mocked storage error from a previous activation. This method should only be used for testing purposes.

func Initialize

func Initialize(storageConfig *config.Storage)

Initialize initializes storage sub system.

func Shutdown

func Shutdown()

Shutdown shuts down storage sub system. This method should be used only for testing purposes.

Types

type Storage

type Storage interface {
	Shutdown()

	InsertOrUpdateUser(user *model.User) error
	DeleteUser(username string) error
	FetchUser(username string) (*model.User, error)
	UserExists(username string) (bool, error)

	InsertOrUpdateRosterItem(ri *model.RosterItem) error
	DeleteRosterItem(user, contact string) error
	FetchRosterItems(user string) ([]model.RosterItem, error)
	FetchRosterItem(user, contact string) (*model.RosterItem, error)

	InsertOrUpdateRosterNotification(rn *model.RosterNotification) error
	DeleteRosterNotification(user, contact string) error
	FetchRosterNotifications(contact string) ([]model.RosterNotification, error)

	InsertOrUpdateVCard(vCard xml.Element, username string) error
	FetchVCard(username string) (xml.Element, error)

	FetchPrivateXML(namespace string, username string) ([]xml.Element, error)
	InsertOrUpdatePrivateXML(privateXML []xml.Element, namespace string, username string) error

	InsertOfflineMessage(message xml.Element, username string) error
	CountOfflineMessages(username string) (int, error)
	FetchOfflineMessages(username string) ([]xml.Element, error)
	DeleteOfflineMessages(username string) error
}

Storage represents an entity storage interface.

func Instance

func Instance() Storage

Instance returns global storage sub system.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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