msgstore

package module
v0.0.0-...-5635d8a Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: Apache-1.1 Imports: 9 Imported by: 0

README

go-msgstore

Build Status

Documentation

Index

Constants

View Source
const (
	// SQLStoreDriver is the driverName that will be passed to database/sql, e.g. "sqlite", "mysql".
	SQLStoreDriver string = "SQLStoreDriver"
	// SQLStoreDataSourceName is the dataSourceName that will be passed to database/sql.
	SQLStoreDataSourceName string = "SQLStoreDataSourceName"
	// SQLStoreConnMaxLifetime is the value that will be passed to database/sql SetConnMaxLifetime.
	SQLStoreConnMaxLifetime string = "SQLStoreConnMaxLifetime"
	// SQLStoreTableNamePrefix will be prepended to the names of the database tables.  Optional.
	SQLStoreTableNamePrefix string = "SQLStoreTableNamePrefix"
)
View Source
const (
	// FileStorePath is the name of the filesystem directory that will be used.
	FileStorePath string = "FileStorePath"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageStore

type MessageStore interface {
	NextSenderMsgSeqNum() int
	NextTargetMsgSeqNum() int

	IncrNextSenderMsgSeqNum() error
	IncrNextTargetMsgSeqNum() error

	SetNextSenderMsgSeqNum(next int) error
	SetNextTargetMsgSeqNum(next int) error

	CreationTime() time.Time

	SaveMessage(seqNum int, msg []byte) error
	GetMessages(beginSeqNum, endSeqNum int) ([][]byte, error)

	Refresh() error
	Reset() error

	Close() error
}

The MessageStore interface provides methods to record and retrieve messages for resend purposes

type MessageStoreFactory

type MessageStoreFactory interface {
	Create(sessionID string) (MessageStore, error)
}

The MessageStoreFactory interface is used by session to create a session specific message store

func NewFileStoreFactory

func NewFileStoreFactory(settings map[string]string) MessageStoreFactory

NewFileStoreFactory returns a file-based implementation of MessageStoreFactory

func NewMemoryStoreFactory

func NewMemoryStoreFactory() MessageStoreFactory

NewMemoryStoreFactory returns a MessageStoreFactory instance that created in-memory MessageStores

func NewMongoStoreFactory

func NewMongoStoreFactory(dbURL string, dbName string) MessageStoreFactory

NewMongoStoreFactory returns a transactional, mongo-based implementation of MessageStoreFactory

func NewMongoStoreFactoryWithTablePrefix

func NewMongoStoreFactoryWithTablePrefix(dbURL string, dbName string, tablePrefix string) MessageStoreFactory

NewMongoStoreFactoryWithTablePrefix returns an initialized MessageStoreFactory that will use the provided prefix for table names

func NewSQLStoreFactory

func NewSQLStoreFactory(settings map[string]string) MessageStoreFactory

NewSQLStoreFactory returns a sql-based implementation of MessageStoreFactory

Jump to

Keyboard shortcuts

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