Documentation
¶
Index ¶
- type State
- func (st *State) EnsureUnitStateRecord(ctx domain.AtomicContext, uuid string) error
- func (st *State) GetUnitState(ctx context.Context, uuid string) (unitstate.RetrievedUnitState, error)
- func (st *State) GetUnitUUIDForName(ctx domain.AtomicContext, name string) (string, error)
- func (st *State) SetUnitStateCharm(ctx domain.AtomicContext, uuid string, state map[string]string) error
- func (st *State) SetUnitStateRelation(ctx domain.AtomicContext, uuid string, state map[int]string) error
- func (st *State) UpdateUnitStateSecret(ctx domain.AtomicContext, uuid, state string) error
- func (st *State) UpdateUnitStateStorage(ctx domain.AtomicContext, uuid, state string) error
- func (st *State) UpdateUnitStateUniter(ctx domain.AtomicContext, uuid, state string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
State implements persistence for unit state.
func NewState ¶
func NewState(factory database.TxnRunnerFactory) *State
NewState returns a new state reference.
func (*State) EnsureUnitStateRecord ¶
func (st *State) EnsureUnitStateRecord(ctx domain.AtomicContext, uuid string) error
EnsureUnitStateRecord ensures that there is a row in the unit_state table for the input unit UUID. This eliminates the need for upsert statements when updating state for uniter, storage and secrets.
func (*State) GetUnitState ¶
func (st *State) GetUnitState(ctx context.Context, uuid string) (unitstate.RetrievedUnitState, error)
GetUnitState returns the full unit state. The state may be empty. If no unit with the uuid exists, a errors.UnitNotFound error is returned.
func (*State) GetUnitUUIDForName ¶
GetUnitUUIDForName returns the UUID corresponding to the input unit name. If no unit with the name exists, a errors.UnitNotFound error is returned.
func (*State) SetUnitStateCharm ¶
func (st *State) SetUnitStateCharm(ctx domain.AtomicContext, uuid string, state map[string]string) error
SetUnitStateCharm sets the input key/value pairs as the charm state for the input unit UUID.
func (*State) SetUnitStateRelation ¶
func (st *State) SetUnitStateRelation(ctx domain.AtomicContext, uuid string, state map[int]string) error
SetUnitStateRelation sets the input key/value pairs as the relation state for the input unit UUID.
func (*State) UpdateUnitStateSecret ¶
func (st *State) UpdateUnitStateSecret(ctx domain.AtomicContext, uuid, state string) error
UpdateUnitStateSecret sets the input secret state against the input unit UUID.
func (*State) UpdateUnitStateStorage ¶
func (st *State) UpdateUnitStateStorage(ctx domain.AtomicContext, uuid, state string) error
UpdateUnitStateStorage sets the input storage state against the input unit UUID.
func (*State) UpdateUnitStateUniter ¶
func (st *State) UpdateUnitStateUniter(ctx domain.AtomicContext, uuid, state string) error
UpdateUnitStateUniter sets the input uniter state against the input unit UUID.