session

package
v0.0.0-...-2d1a207 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const EVENT_CHAN_BUFFER = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType int
const (
	SESSION_STARTED EventType = iota
	SESSION_ENDED
	SESSION_PAUSED
	SESSION_RESUMED
)

type ID

type ID uint64

type Session

type Session struct {
	Id           ID   `yaml:"id"`
	Paused       bool `yaml:"paused"`
	Complete     bool `yaml:"complete"`
	Production   bool `yaml:"production"`
	ProductionId ID   `yaml:"production_id"`
}

func (*Session) ToProto

func (s *Session) ToProto() *machinepb.SessionStatus

type SessionEvent

type SessionEvent struct {
	SessionID ID
	Type      EventType
}

type SessionManager

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

func NewSessionManager

func NewSessionManager(useMemoryStorage bool) *SessionManager

func (*SessionManager) BeginSession

func (sm *SessionManager) BeginSession(production bool) (*Session, error)

BeginSession will attempt to begin a new session

func (*SessionManager) EndSession

func (sm *SessionManager) EndSession() (*Session, error)

EndSession will end a session if one is in progress

func (*SessionManager) GetLatestSession

func (sm *SessionManager) GetLatestSession() (*Session, error)

GetLatestSession returns nil, nil if there are no sessions yet

func (*SessionManager) PauseSession

func (sm *SessionManager) PauseSession() (*Session, error)

PauseSession will pause a current session

func (*SessionManager) ResumeSession

func (sm *SessionManager) ResumeSession() (*Session, error)

ResumeSession will resume a paused in-progress session

func (*SessionManager) SubscribeToEvents

func (sm *SessionManager) SubscribeToEvents() <-chan *SessionEvent

type SessionMatcher

type SessionMatcher struct {
	Id           *ID
	Paused       *bool
	Complete     *bool
	Production   *bool
	ProductionId *ID
}

Jump to

Keyboard shortcuts

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