Documentation ¶
Index ¶
- Variables
- func DynamicConfigExport(dynamicConfig *dynamicpb.Message) ([]proto.Message, error)
- func DynamicConfigGroupFieldNaming(modelDetail *models.ModelInfo) string
- func DynamicConfigKnownModelFieldNaming(modelDetail *models.ModelInfo) (protoName, jsonName string)
- func ExportDynamicConfigStructure(dynamicConfig proto.Message) (string, error)
- func ModelOptionFor(key string, options []*generic.ModelDetail_Option) (string, error)
- func NewDynamicConfig(knownModels []*models.ModelInfo) (*dynamicpb.Message, error)
- type ChangeRequest
- type ConfigClient
- type GenericClient
- type ModelInfo
- type ProtoTxnFactory
- type StateItem
- type Txn
Constants ¶
This section is empty.
Variables ¶
var LocalClient = NewClient(&txnFactory{local.DefaultRegistry}, &orchestrator.DefaultPlugin)
LocalClient is global client for direct local access. Updates and resyncs of this client use local.DefaultRegistry for propagating data to orchestrator.Dispatcher (going through watcher.Aggregator together with other data sources). However, data retrieval uses orchestrator.Dispatcher directly.
Functions ¶
func DynamicConfigExport ¶ added in v3.3.0
DynamicConfigExport exports from dynamic config the proto.Messages corresponding to known models that were given as input when dynamic config was created using NewDynamicConfig. This is a convenient method how to extract data for generic client usage (proto.Message instances) from value-filled dynamic config (i.e. after json/yaml loading into dynamic config).
func DynamicConfigGroupFieldNaming ¶ added in v3.3.0
DynamicConfigGroupFieldNaming computes for given known model the naming of configuration group proto field containing the instances of given model inside the dynamic config describing the whole VPP-Agent configuration. The json name of the field is the same as proto name of field.
func DynamicConfigKnownModelFieldNaming ¶ added in v3.3.0
DynamicConfigKnownModelFieldNaming compute for given known model the (proto and json) naming of proto field containing the instances of given model inside the dynamic config describing the whole VPP-Agent configuration.
func ExportDynamicConfigStructure ¶ added in v3.3.0
ExportDynamicConfigStructure is a debugging helper function revealing current structure of dynamic config. Debugging tools can't reveal that because dynamic config is dynamic proto message with no fields named by proto fields as it is in generated proto messages.
func ModelOptionFor ¶ added in v3.3.0
func ModelOptionFor(key string, options []*generic.ModelDetail_Option) (string, error)
ModelOptionFor extracts value for given model detail option key
func NewDynamicConfig ¶ added in v3.3.0
NewDynamicConfig creates dynamically proto Message that contains all given configuration models(knowModels). This proto message(when all VPP-Agent models are given as input) is json/yaml compatible with configurator.Config. The configurator.Config config have all models hardcoded (generated from config proto model, but that model is hardcoded). Dynamic config can contain also custom 3rd party models and therefore can be used to import/export config data also for 3rd party models that are registered, but not part of VPP-Agent repository and therefore not know to hardcoded configurator.Config.
Types ¶
type ChangeRequest ¶
type ChangeRequest interface { // Update appends updates for given items to the request. Update(items ...proto.Message) ChangeRequest // Delete appends deletes for given items to the request. Delete(items ...proto.Message) ChangeRequest // Send sends the request. Send(ctx context.Context) error }
ChangeRequest is interface for config change request.
type ConfigClient ¶
type ConfigClient = GenericClient
ConfigClient ... Deprecated: use GenericClient instead
func NewClient ¶
func NewClient(factory ProtoTxnFactory, dispatcher orchestrator.Dispatcher) ConfigClient
NewClient returns new instance that uses given registry for data propagation and dispatcher for data retrieval.
type GenericClient ¶ added in v3.2.0
type GenericClient interface { // KnownModels retrieves list of known modules. KnownModels(class string) ([]*ModelInfo, error) // ChangeRequest returns transaction for changing config. ChangeRequest() ChangeRequest // ResyncConfig overwrites existing config. ResyncConfig(items ...proto.Message) error // GetConfig retrieves current config into dsts. // TODO: return as list of config items GetConfig(dsts ...interface{}) error // DumpState dumps actual running state. DumpState() ([]*StateItem, error) }
GenericClient is the client-side interface for generic handler.
type ModelInfo ¶
ModelInfo is just retyped models.ModelInfo for backward compatibility purpose Deprecated: use models.ModelInfo instead
type ProtoTxnFactory ¶
ProtoTxnFactory defines interface for keyval transaction provider.
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn is the
func (*Txn) FindItem ¶
FindItem returns item with given ID from the request items. If the found is true the model with such ID is found and if the model is nil the item represents delete.
func (*Txn) ListItems ¶
ListItems returns map of items defined for the request, where key represents model ID and nil value represents delete. NOTE: Do not alter the returned map directly.
func (*Txn) RemoveItem ¶
RemoveItem removes an item from the transaction. This will revert any Update or Delete done for the item.