state

package
v0.0.0-...-587f487 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppManifest

type AppManifest struct {
	Files     map[string]AppOptions `yaml:"files"`
	Locations map[string]AppOptions `yaml:"locations"`
	Rewrite   map[string]string     `yaml:"rewrite"`
	Page403   string                `yaml:"page403"`
	Page404   string                `yaml:"page404"`
}

AppManifest represents the manifest of an app

type AppOptions

type AppOptions struct {
	ClientCaching string            `yaml:"clientCaching"`
	Headers       map[string]string `yaml:"headers"`
	CleanHeaders  map[string]string `yaml:"-"`
}

AppOptions is used by the AppManifest struct to represent options for a specific location or file type

type Manager

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

Manager is the state manager class

var Instance *Manager

Instance is a singleton for Manager

func (*Manager) AcquireLock

func (m *Manager) AcquireLock() (interface{}, error)

AcquireLock acquires a lock on the state before making changes, across all nodes in the cluster

func (*Manager) AddSite

func (m *Manager) AddSite(site *SiteState) error

AddSite adds a site to the store

func (*Manager) DeleteSite

func (m *Manager) DeleteSite(domain string) error

DeleteSite remvoes a site from the store

func (*Manager) DumpState

func (m *Manager) DumpState() (*NodeState, error)

DumpState exports the entire state

func (*Manager) GetSecret

func (m *Manager) GetSecret(key string) ([]byte, error)

GetSecret returns the value for a secret (encrypted in the state)

func (*Manager) GetSite

func (m *Manager) GetSite(domain string) *SiteState

GetSite returns the site object for a specific domain (including aliases)

func (*Manager) GetSites

func (m *Manager) GetSites() []SiteState

GetSites returns the list of all sites

func (*Manager) Init

func (m *Manager) Init() (err error)

Init loads the state from the store

func (*Manager) LastUpdated

func (m *Manager) LastUpdated() *time.Time

LastUpdated returns the time the state was updated last

func (*Manager) OnStateUpdate

func (m *Manager) OnStateUpdate(callback func())

OnStateUpdate stores the callback to invoke if the state is updated because of an external event

func (*Manager) ReleaseLock

func (m *Manager) ReleaseLock(leaseID interface{}) error

ReleaseLock releases the lock on the state

func (*Manager) ReplaceState

func (m *Manager) ReplaceState(state *NodeState) error

ReplaceState replaces the full state for the node with the provided one

func (*Manager) SetSecret

func (m *Manager) SetSecret(key string, value []byte) error

SetSecret sets the value for a secret (encrypted in the state)

func (*Manager) StoreHealth

func (m *Manager) StoreHealth() (healthy bool, err error)

StoreHealth returns true if the store is healthy

func (*Manager) UpdateSite

func (m *Manager) UpdateSite(site *SiteState, setUpdated bool) error

UpdateSite updates a site with the same Domain

type NodeState

type NodeState struct {
	Sites   []SiteState       `json:"sites"`
	Secrets map[string][]byte `json:"secrets"`
}

NodeState represents the global state of the node

type SiteApp

type SiteApp struct {
	// App details
	Name    string `json:"name" binding:"required"`
	Version string `json:"version" binding:"required"`

	// App manifest (for internal use)
	Manifest *AppManifest `json:"-"`
}

SiteApp represents the state of an app deployed or being deployed

type SiteState

type SiteState struct {
	// Configuration
	TLSCertificateSelfSigned bool    `json:"tlsCertificateSelfSigned"`
	TLSCertificate           *string `json:"tlsCertificate"`
	TLSCertificateVersion    *string `json:"tlsCertificateVersion"`

	// Domains: primary and aliases
	Domain  string   `json:"domain" binding:"required,ne=_default"`
	Aliases []string `json:"aliases" binding:"dive,ne=_default"`

	// Deployment error
	Error    error   `json:"-"`
	ErrorStr *string `json:"error" binding:"-"` // Not allowed as input

	// App
	App *SiteApp `json:"app"`
}

SiteState represents the state of a single site

Jump to

Keyboard shortcuts

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