store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageServer

type StorageServer struct {
	// contains filtered or unexported fields
}

StorageServer is an in-memory implementation of a data store.

func NewStorageServer

func NewStorageServer() *StorageServer

NewStorageServer constructs a new instance of StorageServer.

func (*StorageServer) DeleteSession

func (s *StorageServer) DeleteSession(sessionName string)

DeleteSession deletes a session from the StorageServer.

func (*StorageServer) GetLatestEvent

func (s *StorageServer) GetLatestEvent(sessionName string) (*types.Event, error)

GetLatestEvent returns the latest event associated with an existing session, and an error if the session does not exist.

func (*StorageServer) GetSession

func (s *StorageServer) GetSession(sessionName string) *types.Session

GetSession retrieves an existing session from the StorageServer.

func (*StorageServer) StoreEvent

func (s *StorageServer) StoreEvent(sessionName string, event *types.Event) error

StoreEvent stores an event associated with an existing session.

func (*StorageServer) StoreSession

func (s *StorageServer) StoreSession(session *types.Session) error

StoreSession stores a session in the StorageServer.

type Store

type Store interface {
	// Adds a Session object to the Store.
	StoreSession(session *types.Session) error
	// Retrieves an existing session from the Store.
	GetSession(sessionName string) *types.Session
	// Records an event and associates it to an existing session.
	StoreEvent(sessionName string, event *types.Event) error
	// Gets the latest event associated to an existing session,
	// and an error if the session does not exist.
	GetLatestEvent(sessionName string) (*types.Event, error)
	// Deletes a Session object and associated events from the
	// Store.
	DeleteSession(sessionName string)
}

Store is the interface for a data store. The data store stores sessions and associated events.

Jump to

Keyboard shortcuts

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