storage

package
v2.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 9 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 LocalDb added in v1.0.39

type LocalDb struct {
	libkb.Contextified
}

func NewLocalDB added in v1.0.39

func NewLocalDB(g *libkb.GlobalContext) *LocalDb

func (*LocalDb) Load added in v1.0.39

func (db *LocalDb) Load(u gregor.UID) (state []byte, outbox [][]byte, localDismissals [][]byte, err error)

func (*LocalDb) Store added in v1.0.39

func (db *LocalDb) Store(u gregor.UID, state []byte, outbox [][]byte, localDismissals [][]byte) error

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, log logger.Logger) *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) ConsumeLocalDismissal added in v1.0.39

func (m *MemEngine) ConsumeLocalDismissal(ctx context.Context, u gregor.UID, msgID gregor.MsgID) error

func (*MemEngine) ConsumeMessage

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

func (*MemEngine) ConsumeOutboxMessage

func (m *MemEngine) ConsumeOutboxMessage(ctx context.Context, u gregor.UID, msg gregor.Message) error

func (*MemEngine) DeleteReminder

func (m *MemEngine) DeleteReminder(ctx context.Context, r gregor.ReminderID) error

func (*MemEngine) InBandMessagesSince

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

func (*MemEngine) InitLocalDismissals added in v1.0.39

func (m *MemEngine) InitLocalDismissals(ctx context.Context, u gregor.UID, msgIDs []gregor.MsgID) error

func (*MemEngine) InitOutbox

func (m *MemEngine) InitOutbox(ctx context.Context, u gregor.UID, msgs []gregor.Message) 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(ctx context.Context, u gregor.UID, d gregor.DeviceID) *time.Time

func (*MemEngine) LocalDismissals added in v1.0.39

func (m *MemEngine) LocalDismissals(ctx context.Context, u gregor.UID) (res []gregor.MsgID, err error)

func (*MemEngine) ObjFactory

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

func (*MemEngine) Outbox

func (m *MemEngine) Outbox(ctx context.Context, u gregor.UID) ([]gregor.Message, error)

func (*MemEngine) ReminderLockDuration

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

func (*MemEngine) Reminders

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

func (*MemEngine) State

func (*MemEngine) StateByCategoryPrefix

func (m *MemEngine) StateByCategoryPrefix(ctx context.Context, 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