store

package
v0.0.0-...-eae675d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEventsSince

func GetEventsSince(serialNumber int64, topicName string) ([]*pb.Event, error)

GetEventsSince returns all events with a serial number greater than provided

func Init

func Init()

Init starts the store

Types

type EventStore

type EventStore interface {
	SaveEvent(event *pb.Event, topicName string) error
	GetEvent(serialNumber int64, topicName string) (*pb.Event, error)
	GetEventsSince(serialNumber int64, topicName string) ([]*pb.Event, error)
}

EventStore defines event related methods

type Store

type Store struct {
	Events map[string][]*pb.Event
}

Store holds database implementations

func (*Store) CreateTopic

func (store *Store) CreateTopic(name string) error

CreateTopic creates a new topic

func (*Store) DeleteTopic

func (store *Store) DeleteTopic(name string) error

DeleteTopic deletes a topic

func (*Store) GetEvent

func (store *Store) GetEvent(serialNumber int64, topicName string) (*pb.Event, error)

GetEvent returns an event at a given serial number

func (*Store) Init

func (store *Store) Init()

Init starts an empty store

func (*Store) ListTopics

func (store *Store) ListTopics(pattern string) ([]string, error)

ListTopics lists topics matching the pattern

func (*Store) SaveEvent

func (store *Store) SaveEvent(event *pb.Event, topicName string) (int64, error)

SaveEvent saves an event and returns the serial number

func (*Store) Sync

func (store *Store) Sync()

Sync syncs the recent commit log

type TopicStore

type TopicStore interface {
	CreateTopic(name string) error
	DeleteTopic(name string) error
	ListTopics(pattern string) ([]string, error)
}

TopicStore defines topic related methods

Jump to

Keyboard shortcuts

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