Read-only store types: const char ** → const char * const *.
This makes it truely read-only.
This makes it truely read-only.
store_json: Remove any memstore-specific code.
This will allow to further separate the JSON code from the memstore
implementation.
This will allow to further separate the JSON code from the memstore
implementation.
store_json: Fix parent/child detection.
Rewinding the formatter state has to happen any time we see a parent object of
the current object. This happens every time the current context isn't HOST
(hosts don't have any parents) or the new object is an ATTRIBUTE (which are
always children of whatever other object type).
This broke in 3603db13105aefac4d6ceb356bcfd118a92fa654.
Rewinding the formatter state has to happen any time we see a parent object of
the current object. This happens every time the current context isn't HOST
(hosts don't have any parents) or the new object is an ATTRIBUTE (which are
always children of whatever other object type).
This broke in 3603db13105aefac4d6ceb356bcfd118a92fa654.
store_json: Split sdb_store_json_emit into private functions.
The public function will only handle memstore specific logic.
The public function will only handle memstore specific logic.
store_json: Moved special casing of parent objects into the caller.
This makes the JSON module more generic by removing a special case of the
memory store. The caller may now emit arbitrary objects and the formatter will
do the right thing as long as parent-child relationships are right.
This makes the JSON module more generic by removing a special case of the
memory store. The caller may now emit arbitrary objects and the formatter will
do the right thing as long as parent-child relationships are right.
store, plugin: Let the plugin module determine an objects backends.
The store writer plugins are only expected to record the provided backend
(after merging it with existing entries).
The store writer plugins are only expected to record the provided backend
(after merging it with existing entries).
store: Further abstract internal handling of new objects.
Add a new type representing a to-be-stored object to simplify storing new
objects.
Add a new type representing a to-be-stored object to simplify storing new
objects.
store: Simplified store-attribute callback.
There's no need anymore to split this across multiple functions. It's easier
to follow if the code is in one place.
There's no need anymore to split this across multiple functions. It's easier
to follow if the code is in one place.
store: Add separate store-object types for the store writer API.
The argument list of some of the callbacks has already gotten kinda long and
we'll want to add more (backends, etc.). Introduce new types which provide all
meta-data of the respective store types.
Also, only use a single callback to store all kinds of attributes, similar to
how it was already done in the "proto" module.
The argument list of some of the callbacks has already gotten kinda long and
we'll want to add more (backends, etc.). Introduce new types which provide all
meta-data of the respective store types.
Also, only use a single callback to store all kinds of attributes, similar to
how it was already done in the "proto" module.
store: Dropped sdb_ prefix from private store types.
store.h: Updated some documentation comments.
A store instance isn't synonym to "the database" anymore.
A store instance isn't synonym to "the database" anymore.
plugin, store: Add service/metric "hostname" attributes centrally.
That is, let the respective sdb_plugin_store* functions do that instead of
requiring each store implementation to do so.
That is, let the respective sdb_plugin_store* functions do that instead of
requiring each store implementation to do so.
frontend/query_test: Test some weird, special cases.
store: Fix execution of more complex iterators.
That is, follow "indirections" of typed expressions if the iterator is not on
the top-most level.
That is, follow "indirections" of typed expressions if the iterator is not on
the top-most level.
Remove unused sdb_store_expr_iterable().
Allow and implement iterating arbitrary (non-constant) array values.
That is, iterators may now work with arithmetic expressions that evaluate to
an array.
That is, iterators may now work with arithmetic expressions that evaluate to
an array.
analyzer: Support more flexible iterator expressions.
In particular, more complex typed expressions may now include an iterator on a
lower level, like `LOOKUP services MATCHING ANY host.backend =~ 'foo'`. This
is done by adding more information to the analyzer context and pushing it down
to child nodes in the AST if necessary.
As a nice side-effect, the iterator analyzer does not longer have to know
about the specific type of its child node.
In particular, more complex typed expressions may now include an iterator on a
lower level, like `LOOKUP services MATCHING ANY host.backend =~ 'foo'`. This
is done by adding more information to the analyzer context and pushing it down
to child nodes in the AST if necessary.
As a nice side-effect, the iterator analyzer does not longer have to know
about the specific type of its child node.
analyzer: Fixed some error messages.
parser: Require a context for each parser operation.
That is, let the caller provide the execution context (object type) when
parsing incomplete commands (conditionals / arithmetic expressions). This
removes the need to call the analyzer again and avoids some special code in
the analyzer.
That is, let the caller provide the execution context (object type) when
parsing incomplete commands (conditionals / arithmetic expressions). This
removes the need to call the analyzer again and avoids some special code in
the analyzer.
Let the front-end handle STORE commands.
… rather than requiring each reader plugin to do so which doesn't make any
sense at all.
… rather than requiring each reader plugin to do so which doesn't make any
sense at all.
t/integration/store.sh: Add integration tests for the STORE command.
store: Do not canonicalize the hostname when fetching a timeseries.
This decision should be made on a higher level.
This decision should be made on a higher level.
frontend: Connection-specific functions now use the sdb_conn_ prefix.
… instead of sdb_fe_.
… instead of sdb_fe_.
frontend/connection.h: Removed sdb_fe_parse, it has been dropped.
store: Removed obsolete TODO note.
plugin, store: Handle hostname canonicalization in the plugin module.
This is a high-level functionality. Each store implementation should not have
to worry about it.
This is a high-level functionality. Each store implementation should not have
to worry about it.
sysdb(7): Briefly mention the object store.
sysdbd-store-memory(5): Added a manpage for store::memory.
store::memory: Add a plugin providing an in-memory store.
This plugin replaces the default, built-in store. It is a simple wrapper
around the built-in store implementation and, thus, provides exactly the same
functionality but wrapped into a plugin.
This plugin replaces the default, built-in store. It is a simple wrapper
around the built-in store implementation and, thus, provides exactly the same
functionality but wrapped into a plugin.
t/Makefile: Drop unused, old frontend/parser_test.
plugin: Report an error when writing to the store with no writers.
store: Drop the global (default) store.
Instead, register a store from sysdbd and make sure to re-register it on
reconfigure. Previously, the store plugin would have been dropped in that
case.
Instead, register a store from sysdbd and make sure to re-register it on
reconfigure. Previously, the store plugin would have been dropped in that
case.
store: All store functions now accept a store object.
That is, instead of operating on a global, shared instance.
That is, instead of operating on a global, shared instance.
store: Add wrapper functions to store an object in an arbitrary store.
core: Export the sdb_store, sdb_store_reader, sdb_store_writer types.
This is in preparation to more flexible store handling.
This is in preparation to more flexible store handling.
t/valgrind.suppress: Refine the suppression in the libc exit handler.
frontend: Use the plugin query interface instead of direct store access.
The built-in store is registered as a reader automatically at the moment.
The built-in store is registered as a reader automatically at the moment.
core: Add support for reader/query plugins.
A reader plugin can be used to query a data-store based on a query described
by an AST. The plugin module provides a generic function for this purpose.
At the moment, only a single reader plugin can be used at a time. Supporting
multiple readers requires a good merge strategy. The challenge is to handle
filters and query conditions correctly which may evaluate differently after
two stores have been merged.
A reader plugin can be used to query a data-store based on a query described
by an AST. The plugin module provides a generic function for this purpose.
At the moment, only a single reader plugin can be used at a time. Supporting
multiple readers requires a good merge strategy. The challenge is to handle
filters and query conditions correctly which may evaluate differently after
two stores have been merged.
t/valgrind.suppress: Add an invalid free in a libc exit handler.
plugin: Drop sdb_plugin prefix from private names.
store_exec: Remove unnecessary casts.
store: Let sdb_store_json_formatter_t inherit from sdb_object_t.
Drop sdb_store_get_host() from tests.
store: Drop unused sdb_store_has_host.
Replaced sdb_store_<type> with sdb_plugin_store_<type>.
That is, all store updates will now directly go through the plugin API and be
distributed to all store-writer plugins from there.
That is, all store updates will now directly go through the plugin API and be
distributed to all store-writer plugins from there.
Merged branch 'master' of git://git.tokkee.org/sysdb.
store: Register a store writer and handle all updates through the plugin API.
We still reference a global store object. This change further encapsulates the
store.
We still reference a global store object. This change further encapsulates the
store.
plugin: sdb_plugin_store_* now return >0 if the new value was too old.
That is, the return values now mean the same as for the sdb_store_* functions.
That is, the return values now mean the same as for the sdb_store_* functions.
store: Reordered some functions to group by general purpose.
Fix an uninitialized value warnings caused by clang not knowing about fail().
store: Make the actual store a separate object.
That'll allow us to use different store objects in multiple places in the
future.
That'll allow us to use different store objects in multiple places in the
future.
store: Drop sdb_ prefix from private symbols.
data: Use a predefined format for sdb_strftime().
Also, print the nanosecond fraction of a second.
Also, print the nanosecond fraction of a second.
t/: Use ck_assert() instead of assert() in all tests.
sysdbql(7): Document 'value' and 'timeseries' fields.
parser: Add support for metric timeseries fields.
store: Add the timeseries field to metrics.
This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.
This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.
parser: Skip context-specific checks if the context is unspecified.
Else, the analyzer may reject valid queries. It's up to the caller to run the
analyzer using the right context once it's known.
Else, the analyzer may reject valid queries. It's up to the caller to run the
analyzer using the right context once it's known.
store: Remove (now unused) sdb_store_parse_*() helpers.
store: Remove (now unused) sdb_store_nin_matcher().
sysdbql(7): Document IS [NOT] TRUE / FALSE.
parser: Add support for <expr> IS [NOT] TRUE / FALSE queries.
store: Add support for unary IS TRUE / IS FALSE matchers.
store: Drop the special IS-NOT-NULL matcher.
In the AST world, this is NOT(IS-NULL).
In the AST world, this is NOT(IS-NULL).
utils/proto: Support boolean values.
They are encoded as a single byte on the wire.
They are encoded as a single byte on the wire.
data: Add basic support for a boolean type.
This change breaks backward compatibility of the network protocol because it
changes the encoding of a datum. I felt this is still acceptable (given the
current (non-)compatibility promise) and it made the order of types feel more
natural ;-)
This change breaks backward compatibility of the network protocol because it
changes the encoding of a datum. I felt this is still acceptable (given the
current (non-)compatibility promise) and it made the order of types feel more
natural ;-)
Drop the old frontend parser.
It's fully replaced by the new parser module now.
It's fully replaced by the new parser module now.
store: Add sdb_store_query_prepare_matcher().
This prepares a logical expression described by an AST for execution as a
store matcher. This is useful for anything that uses the lower level store
lookup functions.
This prepares a logical expression described by an AST for execution as a
store matcher. This is useful for anything that uses the lower level store
lookup functions.
frontend: Drop sdb_fe_store_* in favor of sdb_store_query_execute.
Instead, build a temporary AST to represent the command to be executed.
Instead, build a temporary AST to represent the command to be executed.
frontend: Drop sdb_fe_exec_* in favor of sdb_store_query_execute.
Instead, build a temporary AST to represent the command to be executed.
Instead, build a temporary AST to represent the command to be executed.
Remove (now) usued sdb_fe_exec_timeseries().
frontend/query_test: Add tests for the lower level functions.
frontend/query: Split AST execution into a separate function.
store: Use a separate type for prepared querys.
It's sufficiently different from the general matchers/filters approach to not
benefit from sharing a base type.
It's sufficiently different from the general matchers/filters approach to not
benefit from sharing a base type.
store, frontend: Add sdb_store_query_execute use it instead of sdb_fe_exec.
This new function executes a generic QUERY matcher as returned by
sdb_store_query_prepare and writes the reply to a string buffer.
This new function executes a generic QUERY matcher as returned by
sdb_store_query_prepare and writes the reply to a string buffer.
Merged branch 'master' of git://git.tokkee.org/sysdb.
frontend/query_test: Test various QUERY functions.
These will, in turn, call the sdb_fe_exec_<CMD> functions, thus guaranteeing
good test coverage.
These will, in turn, call the sdb_fe_exec_<CMD> functions, thus guaranteeing
good test coverage.
frontend: Fixed reply from STORE command.
store: Fixed a memory leak in fetch_timeseries().
frontend, parser: Allow typed access to host objects from any context.
That is, even from the "generic" or "filter" contexts.
That is, even from the "generic" or "filter" contexts.
store: Add sdb_store_query_prepare().
This function prepares a query, represented by its AST, for execution in a
store by generating a store matcher.
This function prepares a query, represented by its AST, for execution in a
store by generating a store matcher.
store: Store a service/metric's parent hostname as an attribute.
store: Fixed handling of metric store values.
- Call sdb_plugin_store_metric() even if store=NULL (don't return early).
- Don't drop old values if strdup failed when storing store type/id.
- Fixed a segfault in sdb_plugin_store_metric() when using store=NULL.
- Call sdb_plugin_store_metric() even if store=NULL (don't return early).
- Don't drop old values if strdup failed when storing store type/id.
- Fixed a segfault in sdb_plugin_store_metric() when using store=NULL.
parser/analyzer: Fixed iterator type checks.
Also, added some more test-cases covering affected cases.
Also, added some more test-cases covering affected cases.
t/coverage: Ignore parser/scanner and parser/grammar.
t/Makefile: Update EXTRA_DIST based on recent changes.
parser/analyzer: Migrate value expression checks.
The new parser and analyzer now pass the full test-suite of frontend/parser.
The new parser and analyzer now pass the full test-suite of frontend/parser.
parser/analyzer: Migrate type and iterator checks.
parser: Add support for analyzing conditional and arithmetic expressions.
Let all parser functions call the respective analyzer. For now, this is only
used to propagate data-type information but it will later ensure a certain
amount of semantical correctness. Note that the new analyzers usually don't
have any context information, so they might accept expressions that are not
right for their later target use case. If that matters, the caller will have
to check again providing the right context.
Let all parser functions call the respective analyzer. For now, this is only
used to propagate data-type information but it will later ensure a certain
amount of semantical correctness. Note that the new analyzers usually don't
have any context information, so they might accept expressions that are not
right for their later target use case. If that matters, the caller will have
to check again providing the right context.
parser: Convert AST op types to data op types when necessary.
parser: Determine the data-type of each node.
For now, we only use this for arithmetic expressions. The field will be
populated by the analyzer.
For now, we only use this for arithmetic expressions. The field will be
populated by the analyzer.
parser: Fixed setup of iterator nodes.
The iterator value was supposed to be an "incomplete operator" node, that is,
one of the operands should be NULL. This is actually the case now and this
also means we don't have to store the operator type separately.
The iterator value was supposed to be an "incomplete operator" node, that is,
one of the operands should be NULL. This is actually the case now and this
also means we don't have to store the operator type separately.
parser/ast: Add some helper defines.
Migrate top-level checks to the new parser/analyzer.
Call the analyzer from sdb_parser_parse().
Call the analyzer from sdb_parser_parse().
parser_test: Make sure that TIMESERIES end times are greater than start times.
parser/grammar: Fix the hostname in a 'FETCH host' node.
Migrate parser from frontend/ to parser/ and to use the AST.
The new parser now returns AST nodes instead of a "compiled" store lookup
operator. The old parser is still in place unmodified and currently still in
use.
The new parser now returns AST nodes instead of a "compiled" store lookup
operator. The old parser is still in place unmodified and currently still in
use.
parser/ast: Introduce a data-structure representing a SysQL AST.
This will be used by the parser in the future.
This will be used by the parser in the future.
frontend/parser: Renamed SDB_PARSE_EXPR to SDB_PARSE_ARITH.
That's a bit more specific ;-)
That's a bit more specific ;-)
build system: Fix VPATH (out-of-tree) builds.