storage

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterFutureDismissals

func FilterFutureDismissals(msgs []gregor.InBandMessage,
	allmsgs map[string]gregor.InBandMessage, cutoff time.Time) []gregor.InBandMessage

Types

type MemEngine

type MemEngine struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MemEngine is an implementation of a gregor StateMachine that just keeps all incoming messages in a hash table, with one entry per user. It doesn't do anything fancy w/r/t indexing Items, so just iterates over all of them every time a dismissal or a state dump comes in. Used mainly for testing when SQLite isn't available.

func NewMemEngine

func NewMemEngine(f gregor.ObjFactory, cl clockwork.Clock) *MemEngine

NewMemEngine makes a new MemEngine with the given object factory and the potentially fake clock (or a real clock if not testing).

func (*MemEngine) Clear

func (m *MemEngine) Clear() error

func (*MemEngine) Clock

func (m *MemEngine) Clock() clockwork.Clock

func (*MemEngine) ConsumeMessage

func (m *MemEngine) ConsumeMessage(msg gregor.Message) (time.Time, error)

func (*MemEngine) DeleteReminder

func (m *MemEngine) DeleteReminder(r gregor.ReminderID) error

func (*MemEngine) InBandMessagesSince

func (m *MemEngine) InBandMessagesSince(u gregor.UID, d gregor.DeviceID, t time.Time) ([]gregor.InBandMessage, error)

func (*MemEngine) InitState

func (m *MemEngine) InitState(s gregor.State) error

func (*MemEngine) IsEphemeral

func (m *MemEngine) IsEphemeral() bool

func (*MemEngine) LatestCTime

func (m *MemEngine) LatestCTime(u gregor.UID, d gregor.DeviceID) *time.Time

func (*MemEngine) ObjFactory

func (m *MemEngine) ObjFactory() gregor.ObjFactory

func (*MemEngine) ReminderLockDuration

func (m *MemEngine) ReminderLockDuration() time.Duration

func (*MemEngine) Reminders

func (m *MemEngine) Reminders(maxReminders int) (gregor.ReminderSet, error)

func (*MemEngine) State

func (*MemEngine) StateByCategoryPrefix

func (m *MemEngine) StateByCategoryPrefix(u gregor.UID, d gregor.DeviceID, t gregor.TimeOrOffset, cp gregor.Category) (gregor.State, error)

Jump to

Keyboard shortcuts

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