storage

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 29, 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() (*models.RootConfiguration, []*models.Application)

func UnmarshalConfiguration

func UnmarshalConfiguration(file string) (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() *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 struct {
	DB *badger.DB
}

func NewDB

func NewDB() *Database

type Instance

type Instance struct {
	Host string
}

func DetectInstance

func DetectInstance() (*Instance, error)

func NewInstance

func NewInstance(port string) *Instance

func (*Instance) Persist

func (i *Instance) Persist()

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) *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) 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) 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)

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

Jump to

Keyboard shortcuts

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