mocks

package
v0.0.0-...-e652847 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvelopeStorage

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

EnvelopeStorage implements EnvelopeStorage on top of a SQL database

func NewEnvelopeStorage

func NewEnvelopeStorage(logger xbus.Logger) *EnvelopeStorage

NewEnvelopeStorage init an empty EnvelopeStorage suitable for tests

func (*EnvelopeStorage) CheckStalled

func (s *EnvelopeStorage) CheckStalled(id api.UUID, delay time.Duration) bool

CheckStalled ...

func (*EnvelopeStorage) GetEventTypes

func (s *EnvelopeStorage) GetEventTypes(id api.UUID) ([]string, bool)

GetEventTypes returns an envelop event types

func (*EnvelopeStorage) Purge

func (s *EnvelopeStorage) Purge(filter storage.EnvelopeFilter)

Purge removes the envelopes fitered by the given filter

func (*EnvelopeStorage) ReadEnvelope

func (s *EnvelopeStorage) ReadEnvelope(id api.UUID, position storage.EnvelopeReadPos, maxsize int) (api.Envelope, storage.EnvelopeReadPos, error)

ReadEnvelope reads as much as it can of an envelope, starting at 'position' The returned envelope should be suitable for encrypted nats transfert, ie its total jsonified size should be under maxsize

func (*EnvelopeStorage) SetEventHandler

func (s *EnvelopeStorage) SetEventHandler(handler storage.EnvelopeStorageEventHandler)

SetEventHandler sets the event handler

func (*EnvelopeStorage) StoreEnvelope

func (s *EnvelopeStorage) StoreEnvelope(e api.Envelope) (storage.EnvelopeState, error)

StoreEnvelope store a part of an envelope and returns its status in the storage

type JobStorage

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

JobStorage is a mock for storage.Storage

func NewJobStorage

func NewJobStorage() *JobStorage

NewJobStorage ...

func (*JobStorage) GetState

func (s *JobStorage) GetState(id storage.JobID) storage.JobState

GetState ...

func (*JobStorage) ListDetachedJobByActor

func (s *JobStorage) ListDetachedJobByActor(actorID api.UUID) (storage.JobList, error)

ListDetachedJobByActor ...

func (*JobStorage) ListJobByProcess

func (s *JobStorage) ListJobByProcess(processID api.UUID) (jobs []storage.Job)

ListJobByProcess ...

func (*JobStorage) ListPendingJobByActor

func (s *JobStorage) ListPendingJobByActor(actorID api.UUID, after *storage.JobID, limit int) (jobs []storage.Job)

ListPendingJobByActor ...

func (*JobStorage) ListRunningJobByEnvelopeID

func (s *JobStorage) ListRunningJobByEnvelopeID(envelopeID api.UUID) (jobs []storage.Job)

ListRunningJobByEnvelopeID ...

func (*JobStorage) NewJob

func (s *JobStorage) NewJob(id storage.JobID, state storage.JobState)

NewJob ...

func (*JobStorage) Purge

func (s *JobStorage) Purge([]api.UUID) error

Purge ...

func (*JobStorage) SetState

func (s *JobStorage) SetState(id storage.JobID, state storage.JobState)

SetState ...

type ProcessStorage

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

ProcessStorage implements storage.ProcessStorage

func NewProcessStorage

func NewProcessStorage() *ProcessStorage

NewProcessStorage returns a new ProcessStorage

func (*ProcessStorage) CreateProcess

func (s *ProcessStorage) CreateProcess(p storage.Process) (api.UUID, error)

CreateProcess saves a process

func (*ProcessStorage) GetProcess

func (s *ProcessStorage) GetProcess(id api.UUID) (storage.Process, error)

GetProcess returns a process data

func (*ProcessStorage) GetProcessByTrigger

func (s *ProcessStorage) GetProcessByTrigger(emitter api.Actor, envelopeID api.UUID) (storage.Process, error)

GetProcessByTrigger returns a process matching a trigger or an empty value if not found

func (*ProcessStorage) ListActiveEmissions

func (s *ProcessStorage) ListActiveEmissions(targetActor api.UUID) ([]storage.Emission, error)

ListActiveEmissions returns the active emissions

type SessionStorage

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

SessionStorage is a in-memory implementation of storage.SessionStorage

func (*SessionStorage) Delete

func (store *SessionStorage) Delete(token string) error

Delete deletes a token

func (*SessionStorage) DeleteOlderThan

func (store *SessionStorage) DeleteOlderThan(time time.Time) error

DeleteOlderThan deletes the sessions based on their 'validUntil'

func (*SessionStorage) Get

func (store *SessionStorage) Get(token string) (*storage.Session, error)

Get returns a Session from its token

func (*SessionStorage) List

func (store *SessionStorage) List() ([]storage.Session, error)

List returns all the opened sessions

func (*SessionStorage) Set

func (store *SessionStorage) Set(session storage.Session) error

Set create or update a Session

Jump to

Keyboard shortcuts

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