Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LocalClient = NewClient(&txnFactory{local.DefaultRegistry})
LocalClient is global client for direct local access.
Functions ¶
This section is empty.
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 interface { // KnownModels retrieves list of known modules. KnownModels() ([]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) }
ConfigClient defines the client-side interface for config.
func NewClient ¶
func NewClient(factory ProtoTxnFactory) ConfigClient
NewClient returns new instance that uses given registry for data propagation.
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 ¶
Items 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.