frontend: Fixed various size checks.
frontend: Let the 'fetch' command support other types besides hosts.
store: Added sdb_store_get_child().
This function may be used to retrieve a host's child object (service, metric,
attribute) by it's name.
This function may be used to retrieve a host's child object (service, metric,
attribute) by it's name.
store: Removed now unused tojson functions.
frontend: Let FETCH and LIST use JSON formatters.
… instead of the old tojson functions.
… instead of the old tojson functions.
frontend: Let FETCH apply filters to the host as well.
store: Let JSON formatter know about the to-be-formatted object type.
When formatting services or metrics, expect those objects to be emitted on the
highest level and then create the host object for them first (once for a
series of objects belonging to the same host).
When formatting services or metrics, expect those objects to be emitted on the
highest level and then create the host object for them first (once for a
series of objects belonging to the same host).
store: Let the JSON formatter know about arrays at top level.
There's no reason to require this to be handled separately.
There's no reason to require this to be handled separately.
t/: Added tests for json_formatter-based JSON generation.
store: Record each object's parent.
frontend/query: Use the new JSON formatter to implement LOOKUP.
This will allow for more flexiblity.
This will allow for more flexiblity.
store: Added a generic JSON formatter.
It works by consuming single objects of any type (host, service, metric,
attribute) at a time and appending their JSON serialization to a string
buffer. The current position in the object tree is recorded in an internal
state.
A helper function is provided on top of the base formatter which allows to
handle an full object at a time.
It works by consuming single objects of any type (host, service, metric,
attribute) at a time and appending their JSON serialization to a string
buffer. The current position in the object tree is recorded in an internal
state.
A helper function is provided on top of the base formatter which allows to
handle an full object at a time.
store: Provide more verbose messages on errors during scanning.
store_lookup_test: Ensure that filters are applied before matchers.
sysdbql(7): Link to the JSON RFC.
store: Let sdb_store_scan() pass on filters to callback functions.
The callback function needs access to the filter anyway, so let's handle this
centrally.
The callback function needs access to the filter anyway, so let's handle this
centrally.
store: Use sdb_avltree_lookup() to retrieve attributes.
… rather than iterating through all attributes. D'oh!
… rather than iterating through all attributes. D'oh!
store: Let sdb_store_scan() support other object types besides hosts.
store: Merged sdb_store_iterate() into sdb_store_scan().
These functions are really the same when using a NULL matcher and filter.
These functions are really the same when using a NULL matcher and filter.
frontend: Added basic support for semantic AST analysis.
For now, the analyzer checks the types of all matcher operands.
For now, the analyzer checks the types of all matcher operands.
frontend: Let scanner/parser know about object types and field names.
This allows to handle all known objects and fields as part of the grammar
rather than manually parsing them and generating custom error messages.
This allows to handle all known objects and fields as part of the grammar
rather than manually parsing them and generating custom error messages.
frontend/grammar: Access fields by their name rather than '.<name>'.
There's no more need for a special and somewhat weird syntax.
There's no more need for a special and somewhat weird syntax.
frontend/grammar: Added support for 'ALL <obj> <cmp> <expr>'.
This matches, if all of the specified objects match the specified expression.
ALL also matches on empty object lists.
This matches, if all of the specified objects match the specified expression.
ALL also matches on empty object lists.
store: Removed unused types.
store: Added support for ALL matchers.
Similar to ANY, this matcher iterators over objects. It matches, if *all* of
those objects match another matcher.
Similar to ANY, this matcher iterators over objects. It matches, if *all* of
those objects match another matcher.
store: Don't special case negated matchers in the ANY matcher.
The old behavior no longer makes sense when thinking about matching *any*
object.
The old behavior no longer makes sense when thinking about matching *any*
object.
frontend/grammar: Changed '<obj> <cmp> <expr>' to 'ANY <obj> <cmp> <expr>'.
… for services, metrics, and attributes. That is, let this involve less magic
but make it clear that this looks at multiple objects and matches if any of
them match.
… for services, metrics, and attributes. That is, let this involve less magic
but make it clear that this looks at multiple objects and matches if any of
them match.
store: Renamed child-matcher to any-matcher.
It matches if any object of an iterable list matches, so this is a more
appropriate name.
It matches if any object of an iterable list matches, so this is a more
appropriate name.
data_test: Test various unsupported expressions.
store: During lookup use strcmp() only for unknown data-types.
Unknown data-types means that we don't know the type of either one expression
before hand. For example, this is true for attributes given that there is no
schema.
Unknown data-types means that we don't know the type of either one expression
before hand. For example, this is true for attributes given that there is no
schema.
store: Record the data-type of an expression.
data: Added sdb_data_expr_type().
This function returns the expected type of the result of an arithmetic
expression based on the operator and input types.
This function returns the expected type of the result of an arithmetic
expression based on the operator and input types.
store: Removed now unused name-matcher and sdb_store_matcher_parse_cmp().
t/: Converted name matcher tests to new style matchers.
frontend/grammar: Implement '<obj> <op> <expr>' using new-style matchers.
store: Added sdb_store_parse_object_type().
This function parses an object type name (singular) and returns the type ID.
This function parses an object type name (singular) and returns the type ID.
store: Let sdb_store_parse_object_type_plural support attributes.
However, the parser will not accept attributes in LIST commands as before.
Still, an attribute is considered to be a stored object.
However, the parser will not accept attributes in LIST commands as before.
Still, an attribute is considered to be a stored object.
store: Let child matchers handle negated operators as before.
That is, negated matchers have to match *all* children because a condition
like "service != 'foo'" would match only on hosts which do not have a service
called 'foo'.
That is, negated matchers have to match *all* children because a condition
like "service != 'foo'" would match only on hosts which do not have a service
called 'foo'.
store: Let child matcher actually match the child.
store: Fixed a typo in the type check of the child matcher.
store: Removed unused old sdb_store_attr_matcher().
store: Renamed sdb_store_cmp_XX to sdb_store_XX_matcher.
… now that these names have become available again.
… now that these names have become available again.
store: Removed unused, old conditional matchers.
store: Removed now unused support for attribute matchers in old code.
t/: Use expression-based matchers for attribute comparison tests.
store: Removed sdb_store_matcher_parse_field_cmp() and sdb_store_obj_cond().
Those functions have been superseded by the new expression-based matchers.
Those functions have been superseded by the new expression-based matchers.
t/: Use the new expression-based matchers for various tests.
data: Format NULL as NULL and never quote it.
The idea, previously, was to make NULL values easily identifiable in all
messages but the focus really is on the JSON output which supports a real null
value.
The idea, previously, was to make NULL values easily identifiable in all
messages but the focus really is on the JSON output which supports a real null
value.
store: Let NULL values never match a regex.
store: Removed sdb_store_matcher_tostring().
This function was mainly used for debugging and more verbose error messages
upon test failures. Given that we have more fine-grained tests now, keeping
the tostring() methods up-to-date is rather annoying but for little benefit.
Instead, we should have a real pretty-printer or similar at some point.
This function was mainly used for debugging and more verbose error messages
upon test failures. Given that we have more fine-grained tests now, keeping
the tostring() methods up-to-date is rather annoying but for little benefit.
Instead, we should have a real pretty-printer or similar at some point.
frontend/grammar: Unified field and attribute value matchers.
Use generic expressions and the new compare matchers instead.
As a side-effect of this change, not-operators (!=, etc.) no longer match on
NULL values (attribute does not exist). This is intended and should have been
like this in the first place (we've got 'IS NULL' for that purpose). For
example, `attribute['foo'] != 123' did previously match if attribute 'foo' did
not exist but now this is no longer the case.
Use generic expressions and the new compare matchers instead.
As a side-effect of this change, not-operators (!=, etc.) no longer match on
NULL values (attribute does not exist). This is intended and should have been
like this in the first place (we've got 'IS NULL' for that purpose). For
example, `attribute['foo'] != 123' did previously match if attribute 'foo' did
not exist but now this is no longer the case.
store: Let compare matchers fail if any of the operands is NULL.
t/: Let tests use '<expr> IN .backend'.
frontend/grammar: Added support for the IN operator.
This is a matcher checking if a value is included in an array. It's mostly
meant to be used to match backends at the moment.
This is a matcher checking if a value is included in an array. It's mostly
meant to be used to match backends at the moment.
store: Added sdb_store_in_matcher().
This function creates a matcher which matches if the right value evaluates to
an array value and the left value is included in that array.
This function creates a matcher which matches if the right value evaluates to
an array value and the left value is included in that array.
data: Added sdb_data_inarray().
The function determines whether a value is included in an array.
The function determines whether a value is included in an array.
store: Added support for querying the BACKEND field.
… returning an array of strings.
… returning an array of strings.
data: Added support for comparing integer, decimal, and string arrays.
Array comparison works element-by-element, returning how the first non-equal
elements compare to each other.
Added tests for array comparison and concatenation.
Array comparison works element-by-element, returning how the first non-equal
elements compare to each other.
Added tests for array comparison and concatenation.
data_test: Use int64_t instead of int for integer array data.
data: Fixed length of newly allocated array in concat().
data: Added basic support for arrays.
An array may contain elements of one type and it's stored in compact raw form
(as in: not an array of union values but an array of the actual values).
'copy', 'free', and 'concat' operations are currently supported but limited to
integer, decimal, or string element types. ENOTSUP is returned for any other
operations.
An array may contain elements of one type and it's stored in compact raw form
(as in: not an array of union values but an array of the actual values).
'copy', 'free', and 'concat' operations are currently supported but limited to
integer, decimal, or string element types. ENOTSUP is returned for any other
operations.
data_test: Removed unnecessary and possibly misleading checks.
data: Use if-statements rather than switch-statements.
data: Added sdb_data_sizeof().
This function returns the size of the data-type for a given type.
This function returns the size of the data-type for a given type.
store: Clarify behavior of expr_attrvalue if the attribute does not exist.
frontend/grammar: Fixed parsing of 'attribute[<string>]'.
That is, don't accept anything besides the string "attribute". Previously,
<anything>[<string>] was accepted as an attribute value.
That is, don't accept anything besides the string "attribute". Previously,
<anything>[<string>] was accepted as an attribute value.
frontend/grammar: Make IS NULL operators available to any expression.
store: Return NULL if an attribute was not found.
data: Added explicit NULL values.
… and let all expressions involving NULL values to return NULL.
… and let all expressions involving NULL values to return NULL.
data: Let CONCAT return NULL if any of its operands is NULL.
This mimics behavior in SQL and also allows for missing values to be reported
as NULL and propagate that information.
This mimics behavior in SQL and also allows for missing values to be reported
as NULL and propagate that information.
frontend/grammar: Use strings to access attribute value: attribute['name'].
store, frontend: Make IS (NOT) NULL an unary operator on expressions.
This is more flexible and in-line with all other operators being migrated to
expression-based constructs.
This is more flexible and in-line with all other operators being migrated to
expression-based constructs.
parser_test: Added various arithmetic expressions to the expr parser test.
Added tests for sdb_fe_parse_expr() and fixed the implementation.
That is, fixed a typo preventing the parsed expression from being returned and
fixed memory leaks in the matcher and expression parsers.
That is, fixed a typo preventing the parsed expression from being returned and
fixed memory leaks in the matcher and expression parsers.
frontend/parser: Made clear that parser modes are flags.
It doesn't make a difference so far, but will avoid problems in the future.
It doesn't make a difference so far, but will avoid problems in the future.
frontend/grammar: Added a destructor for data objects.
frontend/parser: Don't override fields of unknown types.
frontend: Added sdb_fe_parse_expr().
This function enables a special new parser mode in which it only accepts
simple expressions.
This function enables a special new parser mode in which it only accepts
simple expressions.
frontend: Renamed CONNECTION_EXPR to CONNECTION_MATCHER.
That's more specific.
That's more specific.
store: Added sdb_store_parse_matcher_op().
This function parses the string representation of an operator and returns a
constructor for the respective matcher.
This function parses the string representation of an operator and returns a
constructor for the respective matcher.
data: Don't free memory before using it for the last time.
store: Added not-equal and not-regex matchers.
store: Added support for regex matchers.
A regex matcher matches the string value an expression evaluates to against a
regular expression. Dynamic regular expressions are supported as well through
expressions evaluating to a string which is then dynamically compiled into a
regular expression when executing the matcher.
A regex matcher matches the string value an expression evaluates to against a
regular expression. Dynamic regular expressions are supported as well through
expressions evaluating to a string which is then dynamically compiled into a
regular expression when executing the matcher.
data: Let sdb_data_parse() support inline casts from string to other types.
store: Added child matchers.
A child matcher matches an object's children of a certain type. It applies
another matcher to all children and matches if any of the children matches.
A child matcher matches an object's children of a certain type. It applies
another matcher to all children and matches if any of the children matches.
store: Added matchers comparing two expressions.
This is much more powerful than the old conditional matchers and will replace
those once all code has been migrated to the new compare matchers.
This is much more powerful than the old conditional matchers and will replace
those once all code has been migrated to the new compare matchers.
store: Apply filters when evaluating attribute values or expressions.
frontend/grammar: Added (limited) support for attribute values in expressions.
This is not fully supported yet as expressions may not be used in all places
yet.
This is not fully supported yet as expressions may not be used in all places
yet.
store: Added sdb_store_expr_attrvalue().
This function allows to use attribute values in an expression.
This function allows to use attribute values in an expression.
store: Added sdb_store_get_attr().
store: sdb_store_get_field: Make result parameter optional.
t/cibuild.sh: Use 'make -j10' to run tests in parallel.
integration tests: Split simple_query into query, matching, and filter.
integration tests: Make sure test_lib always knows about the socket file.
frontend/parser: Added support for string concatenation.
frontend/grammary.y: Renamed 'op' to 'cmp'.
That's a better name ;-)
That's a better name ;-)
data: Added sdb_data_parse_op().
This function parses the string representation of an operator.
This function parses the string representation of an operator.
store: Added quaryable field ‘name’.
data: Document that regexes are extended, case-insensitive POSIX regexes.
data: Added support for a "regex" data-type.
This type may be used to store the raw and compiled regex in a datum and use
regexes in all places in which a generic value may be used. It does not
support any arithmetic or concatenation operations.
This type may be used to store the raw and compiled regex in a datum and use
regexes in all places in which a generic value may be used. It does not
support any arithmetic or concatenation operations.