Documentation ¶
Index ¶
- Constants
- func Transact(pg *PGBackend, txFunc func(*DBTrans) error) error
- type CurrentBackend
- type DBTrans
- type Deployment
- type FileBackend
- type MemBackend
- func (m *MemBackend) GetDeployment(context.Context) (Deployment, error)
- func (m *MemBackend) GetLicense(context.Context) (string, keys.LicenseMetadata, error)
- func (m *MemBackend) Init(context.Context, *keys.LicenseParser) error
- func (m *MemBackend) SetLicense(ctx context.Context, s string) error
- func (m *MemBackend) StoreDeployment(context.Context, string) error
- type NoLicenseError
- type PGBackend
- func (p *PGBackend) GetDeployment(ctx context.Context) (Deployment, error)
- func (p *PGBackend) GetLicense(ctx context.Context) (string, keys.LicenseMetadata, error)
- func (p *PGBackend) Init(ctx context.Context, l *keys.LicenseParser) error
- func (p *PGBackend) SetLicense(ctx context.Context, data string) error
- func (p *PGBackend) StoreDeployment(ctx context.Context, id string) error
- type RetriableBackendError
- type UpgradeableBackend
Constants ¶
const HATEMPPATH = "/hab/var/automate-ha"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CurrentBackend ¶
type CurrentBackend interface { // Init prepares the backend and migrates data from any known // Upgradeable Backends. Must be called before GetLicense and // SetLicense. Init(context.Context, *keys.LicenseParser) error // GetLicense returns the currently configured automate // license. If no license is configured, NoLicense is // returned. GetLicense(context.Context) (string, keys.LicenseMetadata, error) // SetLicense stores the given license in the backend. SetLicense(context.Context, string) error // StoreDeployment stores the deployment info in the backend StoreDeployment(context.Context, string) error // GetDeployment returns the deployment info from backend GetDeployment(context.Context) (Deployment, error) }
A CurrentBackend can be used as a storage backend for the license-control-service.
func NewCurrentBackend ¶
func NewCurrentBackend(pgURL, migrationPath, legacyFilePath string) CurrentBackend
type Deployment ¶
type FileBackend ¶
type FileBackend struct {
// contains filtered or unexported fields
}
The FileBackend is a UpgradeableBackend for the previous file-based license storage.
func NewFileBackend ¶
func NewFileBackend(path string) *FileBackend
func (*FileBackend) GetLicense ¶
func (f *FileBackend) GetLicense(context.Context) (string, error)
type MemBackend ¶
MemBackend is a CurrentBackend for testing purposes only.
func (*MemBackend) GetDeployment ¶
func (m *MemBackend) GetDeployment(context.Context) (Deployment, error)
func (*MemBackend) GetLicense ¶
func (m *MemBackend) GetLicense(context.Context) (string, keys.LicenseMetadata, error)
func (*MemBackend) Init ¶
func (m *MemBackend) Init(context.Context, *keys.LicenseParser) error
func (*MemBackend) SetLicense ¶
func (m *MemBackend) SetLicense(ctx context.Context, s string) error
func (*MemBackend) StoreDeployment ¶
func (m *MemBackend) StoreDeployment(context.Context, string) error
type NoLicenseError ¶
type NoLicenseError struct {
// contains filtered or unexported fields
}
NoLicenseError is the error returned by a backend when it does not have a configured License.
func (*NoLicenseError) Error ¶
func (n *NoLicenseError) Error() string
type PGBackend ¶
type PGBackend struct {
// contains filtered or unexported fields
}
PgBackend is the CurrentBackend used in production. It stores the raw key data in PostgreSQL.
func (*PGBackend) GetDeployment ¶
func (p *PGBackend) GetDeployment(ctx context.Context) (Deployment, error)
GetDeployment: fetches the deployment data
func (*PGBackend) GetLicense ¶
func (*PGBackend) SetLicense ¶
type RetriableBackendError ¶
type RetriableBackendError struct {
// contains filtered or unexported fields
}
RetriableBackendError is the error returned by a backend when an update has failed but may work if retried.
func (*RetriableBackendError) Error ¶
func (r *RetriableBackendError) Error() string
type UpgradeableBackend ¶
type UpgradeableBackend interface { // GetLicense returns the currently configured automate // license. If no license is configured, ErrNoLicense is // returned. GetLicense(context.Context) (string, error) // Cleanup removes the state kept by this backend. After // Cleanup is called, GetLicense should return a // NoLicenseError. Cleanup(context.Context) error }
An UpgradeableBackend is an old backend that can no longer be used as a backend for the license-control-service but which might have data that needs to be migrated into the CurrentBackend.