Documentation
¶
Index ¶
- type Annotation
- type State
- func (st *State) GetAnnotations(ctx context.Context, id annotations.ID) (map[string]string, error)
- func (st *State) GetCharmAnnotations(ctx context.Context, id annotation.GetCharmArgs) (map[string]string, error)
- func (st *State) SetAnnotations(ctx context.Context, id annotations.ID, values map[string]string) error
- func (st *State) SetCharmAnnotations(ctx context.Context, id annotation.GetCharmArgs, values map[string]string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
Annotation represents an annotation in the state layer that we read/write to/from DB.
type State ¶
State represents a type for interacting with the underlying state.
func NewState ¶
func NewState(factory database.TxnRunnerFactory) *State
NewState returns a new State for interacting with the underlying state.
func (*State) GetAnnotations ¶
GetAnnotations will retrieve all the annotations associated with the given ID from the database. If no annotations are found, an empty map is returned.
func (*State) GetCharmAnnotations ¶
func (st *State) GetCharmAnnotations(ctx context.Context, id annotation.GetCharmArgs) (map[string]string, error)
GetCharmAnnotations will retrieve all the annotations associated with the given ID from the database. If no annotations are found, an empty map is returned.
func (*State) SetAnnotations ¶
func (st *State) SetAnnotations( ctx context.Context, id annotations.ID, values map[string]string, ) error
SetAnnotations associates key/value annotation pairs with a given ID. If an annotation already exists for the given ID, then it will be updated with the given value. First all annotations are deleted, then the given pairs are inserted, so unsetting an annotation is implicit.
func (*State) SetCharmAnnotations ¶
func (st *State) SetCharmAnnotations( ctx context.Context, id annotation.GetCharmArgs, values map[string]string, ) error
SetCharmAnnotations associates key/value annotation pairs with a given ID. If an annotation already exists for the given ID, then it will be updated with the given value. First all annotations are deleted, then the given pairs are inserted, so unsetting an annotation is implicit.