storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigurations

func LoadConfigurations(environment utils.Environment, applicationBuilder *models.ApplicationBuilder) (*models.RootConfiguration, []*models.Application)

func UnmarshalConfiguration

func UnmarshalConfiguration(file string, applicationBuilder *models.ApplicationBuilder) (models.RootConfiguration, error)

Types

type Application

type Application struct {
	utils.RWLocker
	// contains filtered or unexported fields
}

Application is the application storage. Contains methods to access and store applications

func NewApplication

func NewApplication(environment utils.Environment) *Application

NewApplication builds new application storage

func (*Application) Add

func (a *Application) Add(application *models.Application)

Add stores an application

func (*Application) Get

func (a *Application) Get(name string) *models.Application

Get retrieves an application by its name. If name is an empty string, the "default" application is returned

func (*Application) GetAll

func (a *Application) GetAll() []*models.Application

GetAll retrieves all applications

type Database

type Database interface {
	GetDB() *badger.DB
}

type DatabaseImpl

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

func NewDB

func NewDB(folder string) *DatabaseImpl

func (*DatabaseImpl) GetDB

func (d *DatabaseImpl) GetDB() *badger.DB

type Instance

type Instance struct {
	Host string
}

func DetectInstance

func DetectInstance(environment utils.Environment) (*Instance, error)

func NewInstance

func NewInstance(port string) *Instance

func (*Instance) Persist

func (i *Instance) Persist(environment utils.Environment)

type Session

type Session struct {
	utils.RWLocker
	// contains filtered or unexported fields
}

Session is the session storage. Contains methods to access and store sessions into the database

func NewSession

func NewSession(db Database, mutexBuilder utils.MutexBuilder) *Session

NewSession creates new database storage

func (*Session) Add

func (s *Session) Add(session *models.Session)

Add stores a session Database-wise works as an upsert

func (*Session) AddSessionToCategory

func (s *Session) AddSessionToCategory(category SessionCategory, session *models.Session)

func (*Session) AliveByApplicationCount

func (s *Session) AliveByApplicationCount(application *models.Application) int

AliveByApplicationCount retrieves the number of sessions of an application

func (*Session) Delete

func (s *Session) Delete(session *models.Session)

Delete removes a session

func (*Session) GetAliveApplicationSessionByCheckout

func (s *Session) GetAliveApplicationSessionByCheckout(checkout string, application *models.Application) *models.Session

GetAliveApplicationSessionByCheckout retrieves a single session identified by its status (which must be "alvie") and by its checkout

func (*Session) GetAllAliveSessions

func (s *Session) GetAllAliveSessions() []*models.Session

GetAllAliveSessions retrieves a slice of sessions whose status is "alive". A session is "alive" if it can or is about to ready for being used

func (*Session) GetApplicationSessionsByCategory

func (s *Session) GetApplicationSessionsByCategory(category SessionCategory) []*models.Session

func (*Session) GetByApplicationName

func (s *Session) GetByApplicationName(app string) []*models.Session

GetByApplicationName retrieves a slice of sessions given their app name

func (*Session) GetByUUID

func (s *Session) GetByUUID(uuid string) *models.Session

GetByUUID retrieves a session given its UUID

func (*Session) LoadSessions

func (s *Session) LoadSessions(application *Application, sessionBuilder *models.SessionBuilder)

LoadSessions given an application, restores its sessions retrieving them from the database

func (*Session) Update

func (s *Session) Update(session *models.Session)

Update updates a session. Database-wise works as an upsert

type SessionCategory

type SessionCategory string
const (
	SessionCategoryFailedToStart SessionCategory = "failed_to_start"
)

type SessionsByCategory

type SessionsByCategory struct {
	utils.RWLocker

	Data map[SessionCategory][]*models.Session
}

Jump to

Keyboard shortcuts

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