Documentation
¶
Overview ¶
A collection of models. Provides methods to reconcile the collection of stored models with the collection of desired models.
Container
|__Collector |__Collector |__Collector
The container is a collection of data model collectors. Each collector is responsible for ensuring that changes made to the external data source are reflected in the DB. The goal is for the data model to be eventually consistent.
Index ¶
- type Collection
- type Collector
- type Container
- func (c *Container) Add(collector Collector) (err error)
- func (c *Container) Delete(owner meta.Object) (p Collector, found bool)
- func (c *Container) Get(owner meta.Object) (Collector, bool)
- func (c *Container) List() []Collector
- func (c *Container) Replace(collector Collector) (p Collector, found bool, err error)
- type DefaultShepherd
- type Disposition
- type Dispositions
- type Key
- type Shepherd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// Stored models.
Stored fb.Iterator
// DB transaction.
Tx *model.Tx
// An (optional) shepherd.
Shepherd Shepherd
// Number of models added.
Added int
// Number models updated.
Updated int
// Number models deleted.
Deleted int
}
Model collection.
func (*Collection) Add ¶
func (r *Collection) Add(desired fb.Iterator) error
Add models included in desired but not stored.
func (*Collection) Delete ¶
func (r *Collection) Delete(desired fb.Iterator) error
Delete stored models not included in the desired.
type Collector ¶
type Collector interface {
// The name.
Name() string
// The resource that owns the collector.
Owner() meta.Object
// Start the collector.
// Expected to do basic validation, start a
// goroutine and return quickly.
Start() error
// Shutdown the collector.
// Expected to disconnect, destroy created resources
// and return quickly.
Shutdown()
// The collector has achieved parity.
HasParity() bool
// Get the associated DB.
DB() model.DB
// Return the status code of the connection
// 0 = Ignore
Test() (int, error)
// Follow the link
Follow(moRef interface{}, p []string, dst interface{}) error
// Reset
Reset()
// Get the system version - currently, ovirt-only
Version() (string, string, string, string, error)
}
Data collector.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
A container manages a collection of `Collector`.
type DefaultShepherd ¶
type DefaultShepherd struct {
}
Default (reflect-based) shepherd. Fields are ignored when:
- Is the PK.
- Is (auto) incremented.
- Has the `eq:"-"` tag.
func (*DefaultShepherd) Equals ¶
func (r *DefaultShepherd) Equals(mA, mB model.Model) bool
Model comparison.
func (*DefaultShepherd) Update ¶
func (r *DefaultShepherd) Update(mA, mB model.Model)
Update model A (stored) with model B (desired).
type Disposition ¶
type Disposition struct {
// contains filtered or unexported fields
}
Disposition.