Documentation ¶
Index ¶
- type Manager
- func (m *Manager) AcquireSyncLock() (interface{}, error)
- func (m *Manager) AddSite(site *SiteState) error
- func (m *Manager) DeleteSite(domain string) error
- func (m *Manager) DumpState() (*NodeState, error)
- func (m *Manager) GetSecret(key string) ([]byte, error)
- func (m *Manager) GetSite(domain string) *SiteState
- func (m *Manager) GetSites() []SiteState
- func (m *Manager) Init() (err error)
- func (m *Manager) LastUpdated() *time.Time
- func (m *Manager) OnStateUpdate(callback func())
- func (m *Manager) ReleaseSyncLock(leaseID interface{}) error
- func (m *Manager) ReplaceState(state *NodeState) error
- func (m *Manager) SetSecret(key string, value []byte) error
- func (m *Manager) StoreHealth() (healthy bool, err error)
- func (m *Manager) UpdateSite(site *SiteState, setUpdated bool) error
- type NodeState
- type SiteApp
- type SiteState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) AcquireSyncLock ¶
AcquireSyncLock acquires a lock on the sync semaphore, ensuring that only one node at a time can be syncing
func (*Manager) DeleteSite ¶
DeleteSite remvoes a site from the store
func (*Manager) LastUpdated ¶
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) ReleaseSyncLock ¶
ReleaseSyncLock releases the lock on the sync semaphore
func (*Manager) ReplaceState ¶
ReplaceState replaces the full state for the node with the provided one
func (*Manager) StoreHealth ¶
StoreHealth returns true if the store is healthy
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 *utils.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