1313** Quamina** implements a data type that has APIs to
1414create an instance and add multiple ** Patterns** to it,
1515and then query data objects called ** Events** to
16- discover which of the patterns match
17- the fields in the event .
16+ discover which of the Patterns match
17+ the fields in the Event .
1818
1919Quamina [ welcomes contributions] ( CONTRIBUTING.md ) .
2020
@@ -127,7 +127,7 @@ support for a larger subset of regular expressions,
127127eventually.
128128
129129Number matching is weak - the number has to appear
130- exactly the same in the pattern and the event . I.e.,
130+ exactly the same in the Pattern and the Event . I.e.,
131131Quamina doesn't know that 35, 35.000, and 3.5e1 are the
132132same number. There's a fix for this in the code which
133133is not yet activated because it causes a
@@ -142,10 +142,7 @@ into a list of pathname/value pairs called Fields. Quamina
142142defines a ` Flattener ` interface type and has a built-in
143143` Flattener ` for JSON.
144144
145- ` Flattener ` implementations in general will have
146- internal state and thus not be thread-safe.
147-
148- Note that should you wish to process events
145+ Note that should you wish to process Events
149146in a format other than JSON, you can implement
150147the ` Flattener ` interface yourself.
151148
@@ -157,7 +154,7 @@ greater than 0XF4 (can't occur in correctly composed UTF-8)
157154are rejected by the APIs.
158155### Control APIs
159156``` go
160- func New (...Option ) (*Quamina , error )
157+ func New (opts ...Option ) (*Quamina , error )
161158
162159func WithMediaType(mediaType string) Option
163160func WithFlattener(f Flattener) Option
@@ -177,7 +174,7 @@ Avro, Protobufs, and so on. This option will make sure
177174to invoke the correct Flattener. At the moment, the only
178175supported value is `application/json`, the default.
179176
180- `WithFlattener`: Requests that Quamina flatten events with
177+ `WithFlattener`: Requests that Quamina flatten Events with
181178the provided (presumably user-written) Flattener.
182179
183180`WithPatternDeletion`: If true, arranges that Quamina
@@ -189,7 +186,7 @@ to improve this.)
189186`WithPatternStorage`: If you provide an argument that
190187supports the `LivePatternStorage` API, Quamina will
191188use it to
192- maintain a list of which patterns have currently been
189+ maintain a list of which Patterns have currently been
193190added but not deleted. This could be useful if you
194191wanted to rebuild Quamina instances for sharded
195192processing or after a system failure. ***Note: Not
@@ -202,17 +199,17 @@ func (q *Quamina) AddPattern(x X, patternJSON string) error
202199```
203200The first argument identifies the Pattern and will be
204201returned by Quamina when asked to match against Events.
205- X is defined as `any`.
202+ X is defined as `any`.
206203
207- The Pattern must be provided as a string which is a
208- JSON object as exemplified above in this document.
204+ The Pattern is provided in the second argument string which
205+ must be a JSON object as exemplified above in this document.
209206
210207The `error` return is used to signal invalid Pattern
211208structure, which could be bad UTF-8 or malformed JSON
212209or leaf values which are not provided as arrays.
213210
214211As many Patterns as desired can be added to a Quamina
215- instance. More than one pattern can be added with the
212+ instance. More than one Pattern can be added with the
216213same `X` identifier.
217214
218215The `AddPattern` call is single-threaded; if multiple
@@ -251,9 +248,8 @@ copies may safely run in parallel in different
251248goroutines executing any combination of
252249`MatchesForEvent()`, `AddPattern()`, and
253250`DeletePattern()` calls. There is a significant
254- performance penalty if there is a high rate of
255- `AddPattern()` invocations in parallel with
256- `MatchesForEvent()`.
251+ performance penalty if a high proportion of these
252+ calls are `AddPattern()`.
257253
258254Note that the `Copy()` API is somewhat expensive, and
259255that a Quamina instance exhibits “warm-up” behavior,
@@ -262,7 +258,7 @@ slightly upon repeated calls, especially over the
262258first few calls. The conclusion is that, for maximum efficiency, once
263259you’ve created a Quamina instance, whether through
264260`New()` or `Copy()`, keep it around and run as many
265- events through it as is practical.
261+ Events through it as is practical.
266262
267263
268264### Performance
@@ -272,23 +268,23 @@ I used to say that the performance of
272268Patterns. While that’s probably the right way to think
273269about it, it’s not *quite* true,
274270as it varies somewhat as a function of the number of
275- unique fields that appear in all the patterns that have
271+ unique fields that appear in all the Patterns that have
276272been added to Quamina, but still remains sublinear
277273in that number.
278274
279275A word of explanation: Quamina compiles the
280- patterns into a somewhat-decorated automaton and uses
281- that to find matches in events ; the matching process is
282- O(1) in the number of patterns .
276+ Patterns into a somewhat-decorated automaton and uses
277+ that to find matches in Events ; the matching process is
278+ ` O(1)` in the number of Patterns .
283279
284- However, for this to work, the incoming event must be
280+ However, for this to work, the incoming Event must be
285281flattened into a list of pathname/value pairs and
286282sorted. This process exceeds 50% of execution time,
287283and is optimized by discarding any fields that
288- do not appear in one or more of the patterns added
289- to Quamina. Thus, adding a new pattern that only
290- mentions fields mentioned in previous patterns is
291- effectively free i.e. `O(1)` in terms of run-time
284+ do not appear in one or more of the Patterns added
285+ to Quamina. Thus, adding a new Pattern that only
286+ mentions fields which are already mentioned in previous
287+ Patterns is effectively free i.e. `O(1)` in terms of run-time
292288performance.
293289
294290### Name
0 commit comments