Documentation ¶
Overview ¶
Package trigger provides interface for trigger plugins. A trigger plugin has to implement the following function. - NewTrigger(config map[string]interface{}) (Trigger, error)
The trigger instance returned by this function will be called on Fire() with the filePath (relative to root directory) and indexes that have been written (appended or updated). It is guaranteed that the new content has been written on disk when Fire() is called, so it is safe to read it from disk. Keep in mind that the trigger might be called on the startup, due to the WAL recovery.
Triggers can be configured in the marketstore config file.
triggers: - module: xxxTrigger.so on: "*/1Min/OHLCV" config: <according to the plugin>
The "on" value is matched with the file path to decide whether the trigger is fired or not. It can contain wildcard character "*". As of now, trigger fires only on the running state. Trigger on WAL replay may be added later.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordsToColumnSeries ¶
func RecordsToColumnSeries( tbk io.TimeBucketKey, ds []io.DataShape, tf time.Duration, year int16, records []Record) (*io.ColumnSeries, error)
RecordsToColumnSeries takes a slice of Record, along with the required information for constructing a ColumnSeries, and builds it from the slice of Record.
Types ¶
type Matcher ¶ added in v4.1.14
type Matcher struct { Trigger Trigger // On is a string representing the condition of the trigger // fire event. It is the prefix of file path such as // ""*/1Min/OHLC" On string }
Matcher checks if the trigger should be fired or not.
func NewMatcher ¶
NewMatcher creates a new Matcher.
func NewTriggerMatcher ¶ added in v4.1.2
func NewTriggerMatcher(ts *utils.TriggerSetting) *Matcher
func NewTriggerMatchers ¶ added in v4.1.2
func NewTriggerMatchers(triggers []*utils.TriggerSetting) []*Matcher
type Record ¶
type Record []byte
Record represents a serialized byte buffer for a record written to the DB.
type SymbolLoader ¶
SymbolLoader is an interface to retrieve symbol object from plugin.
type Trigger ¶
type Trigger interface { // Fire is called when the target file has been modified. // keyPath is the string path of the modified file relative // from the catalog root directory. indexes is a slice // containing indexes of the rows being modified. Fire(keyPath string, records []Record) }
Trigger is an interface every trigger plugin has to implement.