Documentation ¶
Index ¶
- Variables
- type EnvPersistence
- type EnvPersistenceBase
- type Persistence
- func (pp Persistence) List(ids ...string) ([]payload.Payload, []string, error)
- func (pp Persistence) ListAll() ([]payload.Payload, error)
- func (pp Persistence) LookUp(name, rawID string) (string, error)
- func (pp Persistence) SetStatus(id, status string) (bool, error)
- func (pp Persistence) Track(id string, pl payload.Payload) (bool, error)
- func (pp Persistence) Untrack(id string) (bool, error)
- type PersistenceBase
Constants ¶
This section is empty.
Variables ¶
var Collections = []string{
payloadsC,
}
Collections is the list of names of the mongo collections where state is stored for payloads. TODO(ericsnow) Not needed anymore...modify for a new registration scheme?
Functions ¶
This section is empty.
Types ¶
type EnvPersistence ¶
type EnvPersistence struct {
// contains filtered or unexported fields
}
EnvPersistence provides the persistence functionality for the Juju environment as a whole.
func NewEnvPersistence ¶
func NewEnvPersistence(base EnvPersistenceBase) *EnvPersistence
NewEnvPersistence wraps the base in a new EnvPersistence.
func (*EnvPersistence) ListAll ¶
func (ep *EnvPersistence) ListAll() ([]payload.FullPayloadInfo, error)
ListAll returns the list of all payloads in the environment.
type EnvPersistenceBase ¶
type EnvPersistenceBase interface { PersistenceBase // Machines builds the list of the names that identify // all machines in State. Machines() ([]string, error) // MachineUnits builds the list of names that identify all units // for a given machine. MachineUnits(machineName string) ([]string, error) }
EnvPersistenceBase provides all the information needed to produce a new EnvPersistence value.
type Persistence ¶
type Persistence struct {
// contains filtered or unexported fields
}
Persistence exposes the high-level persistence functionality related to payloads in Juju.
func NewPersistence ¶
func NewPersistence(st PersistenceBase, unit string) *Persistence
NewPersistence builds a new Persistence based on the provided info.
func (Persistence) List ¶
List builds the list of payloads found in persistence which match the provided IDs. The lists of IDs with missing records is also returned.
func (Persistence) ListAll ¶
func (pp Persistence) ListAll() ([]payload.Payload, error)
ListAll builds the list of all payloads found in persistence. Inconsistent records result in errors.NotValid.
func (Persistence) LookUp ¶
func (pp Persistence) LookUp(name, rawID string) (string, error)
LookUp returns the payload ID for the given name/rawID pair.
func (Persistence) SetStatus ¶
func (pp Persistence) SetStatus(id, status string) (bool, error)
SetStatus updates the raw status for the identified payload in persistence. The return value corresponds to whether or not the record was found in persistence. Any other problem results in an error. The payload is not checked for inconsistent records.
func (Persistence) Track ¶
Track adds records for the payload to persistence. If the payload is already there then false gets returned (true if inserted). Existing records are not checked for consistency.
func (Persistence) Untrack ¶
func (pp Persistence) Untrack(id string) (bool, error)
Untrack removes all records associated with the identified payload from persistence. Also returned is whether or not the payload was found. If the records for the payload are not consistent then errors.NotValid is returned.
type PersistenceBase ¶
type PersistenceBase interface { // One populates doc with the document corresponding to the given // ID. Missing documents result in errors.NotFound. One(collName, id string, doc interface{}) error // All populates docs with the list of the documents corresponding // to the provided query. All(collName string, query, docs interface{}) error // Run runs the transaction generated by the provided factory // function. It may be retried several times. Run(transactions jujutxn.TransactionSource) error }
PersistenceBase exposes the core persistence functionality needed for payloads.