Documentation ¶
Index ¶
- Constants
- type Broker
- type Builtin
- type Config
- type Engine
- func (e *Engine) AddSpecActivationListener(listener SpecActivationsListener)
- func (e *Engine) BroadcastData(ctx context.Context, data common.Data) error
- func (e *Engine) HasMatch(data common.Data) (bool, error)
- func (e *Engine) ListensToSigners(data common.Data) bool
- func (e *Engine) Subscribe(ctx context.Context, spec Spec, cb OnMatchedData) (SubscriptionID, Unsubscriber, error)
- func (e *Engine) Unsubscribe(ctx context.Context, id SubscriptionID)
- type OnMatchedData
- type Spec
- type SpecActivationsListener
- type SpecID
- type SpecPredicate
- type SubscriptionID
- type SubscriptionPredicate
- type TimeService
- type Unsubscriber
Constants ¶
const ( BuiltinPrefix = "vegaprotocol.builtin" BuiltinTimestamp = BuiltinPrefix + ".timestamp" BuiltinTimeTrigger = BuiltinPrefix + ".timetrigger" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builtin ¶
type Builtin struct {
// contains filtered or unexported fields
}
func NewBuiltin ¶
func NewBuiltin(engine *Engine, ts TimeService) *Builtin
type Config ¶
Config represent the configuration of the oracle engine.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is responsible for broadcasting the Data to products and risk models interested in it.
func (*Engine) AddSpecActivationListener ¶
func (e *Engine) AddSpecActivationListener(listener SpecActivationsListener)
func (*Engine) BroadcastData ¶
BroadcastData broadcasts data to products and risk models that are interested in it. If no one is listening to this Data, it is discarded.
func (*Engine) ListensToSigners ¶
ListensToSigners checks if the signatures (pubkeys, ETH addresses) from provided sourcing Data are among the keys current Specs listen to.
func (*Engine) Subscribe ¶
func (e *Engine) Subscribe(ctx context.Context, spec Spec, cb OnMatchedData) (SubscriptionID, Unsubscriber, error)
Subscribe registers a callback for a given Spec that is called when an signedoracle Data matches the spec. It returns a SubscriptionID that is used to Unsubscribe. If cb is nil, the method panics.
func (*Engine) Unsubscribe ¶
func (e *Engine) Unsubscribe(ctx context.Context, id SubscriptionID)
Unsubscribe unregisters the callback associated to the SubscriptionID. If the id doesn't exist, this method panics.
type OnMatchedData ¶
OnMatchedData describes the callback function used when an data dource data matches the spec.
type Spec ¶
type Spec struct { // OriginalSpec is the protobuf description of Spec OriginalSpec *datasource.Spec // contains filtered or unexported fields }
func New ¶
func New(originalSpec datasource.Spec) (*Spec, error)
New builds a new Spec from a common.Spec (currently uses one level below - common.ExternalDataSourceSpec) in a form that suits the processing of the filters. Spec allows the existence of one and only one. Currently VEGA network utilises internal triggers in the oracle function path, even though the oracles are treated as external data sources. For this reason this function checks if the provided external type of data source definition contains a key name that indicates a builtin type of logic and if the given data source definition is an internal type of data source, for more context refer to https://github.com/vegaprotocol/specs/blob/master/protocol/0048-DSRI-data_source_internal.md#13-vega-time-changed
func (Spec) EnsureBoundableProperty ¶
func (s Spec) EnsureBoundableProperty(property string, propType datapb.PropertyKey_Type) error
type SpecActivationsListener ¶
type SpecActivationsListener interface { OnSpecActivated(context.Context, datasource.Spec) error OnSpecDeactivated(context.Context, datasource.Spec) }
The verifier and filterer need to know about new spec immediately, waiting on the event will lead to spec not found issues
type SpecPredicate ¶
SpecPredicate describes the predicate used to filter the subscribers. When returning true, all the subscribers associated to the matching Spec are collected. The order between specs and subscribers is preserved.
type SubscriptionID ¶
type SubscriptionID uint64
SubscriptionID is a unique identifier referencing the subscription of an OnMatchedData to a Spec.
type SubscriptionPredicate ¶
SubscriptionPredicate describes the predicate used to check if any of the currently existing subscriptions expects the public keys inside the incoming Spec object.
type Unsubscriber ¶
type Unsubscriber func(context.Context, SubscriptionID)
Unsubscriber is a closure that is created at subscription step in order to provide the ability to unsubscribe at any conveninent moment.
Directories ¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |