Code

sysdb.git
9 years agoMove the timeseries serialize to the timeseries module.
Sebastian Harl [Tue, 6 Oct 2015 19:34:25 +0000 (21:34 +0200)]
Move the timeseries serialize to the timeseries module.

9 years agostore: Don't report an error if a missing writer callback isn't used.
Sebastian Harl [Tue, 6 Oct 2015 18:01:27 +0000 (20:01 +0200)]
store: Don't report an error if a missing writer callback isn't used.

That is, allow to emit store objects to an incomplete writer as long as all
required callbacks are present.

9 years agostore: Use the JSON writer when querying the in-memory store.
Sebastian Harl [Wed, 30 Sep 2015 20:10:25 +0000 (22:10 +0200)]
store: Use the JSON writer when querying the in-memory store.

That is, instead of writing to a JSON formatter directly, access it through
it's writer API. This will allow for more flexible store access.

9 years agostore_json: Base the memstore emitter on the store-writer API.
Sebastian Harl [Wed, 30 Sep 2015 09:18:22 +0000 (11:18 +0200)]
store_json: Base the memstore emitter on the store-writer API.

9 years agostore_json: Let the formatter implement the store-writer interface.
Sebastian Harl [Wed, 30 Sep 2015 09:17:07 +0000 (11:17 +0200)]
store_json: Let the formatter implement the store-writer interface.

9 years agoRead-only store types: const char ** → const char * const *.
Sebastian Harl [Wed, 30 Sep 2015 09:14:46 +0000 (11:14 +0200)]
Read-only store types: const char ** → const char * const *.

This makes it truely read-only.

9 years agostore_json: Remove any memstore-specific code.
Sebastian Harl [Mon, 28 Sep 2015 20:15:41 +0000 (22:15 +0200)]
store_json: Remove any memstore-specific code.

This will allow to further separate the JSON code from the memstore
implementation.

9 years agostore_json: Fix parent/child detection.
Sebastian Harl [Mon, 28 Sep 2015 20:07:08 +0000 (22:07 +0200)]
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.

9 years agostore_json: Split sdb_store_json_emit into private functions.
Sebastian Harl [Mon, 28 Sep 2015 08:06:33 +0000 (10:06 +0200)]
store_json: Split sdb_store_json_emit into private functions.

The public function will only handle memstore specific logic.

9 years agostore_json: Moved special casing of parent objects into the caller.
Sebastian Harl [Mon, 28 Sep 2015 07:54:15 +0000 (09:54 +0200)]
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.

9 years agostore, plugin: Let the plugin module determine an objects backends.
Sebastian Harl [Thu, 24 Sep 2015 18:49:55 +0000 (20:49 +0200)]
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).

9 years agostore: Further abstract internal handling of new objects.
Sebastian Harl [Thu, 24 Sep 2015 07:38:26 +0000 (09:38 +0200)]
store: Further abstract internal handling of new objects.

Add a new type representing a to-be-stored object to simplify storing new
objects.

9 years agostore: Simplified store-attribute callback.
Sebastian Harl [Wed, 23 Sep 2015 19:49:38 +0000 (21:49 +0200)]
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.

9 years agostore: Add separate store-object types for the store writer API.
Sebastian Harl [Tue, 22 Sep 2015 08:09:24 +0000 (10:09 +0200)]
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.

9 years agostore: Dropped sdb_ prefix from private store types.
Sebastian Harl [Thu, 17 Sep 2015 07:20:15 +0000 (09:20 +0200)]
store: Dropped sdb_ prefix from private store types.

9 years agostore.h: Updated some documentation comments.
Sebastian Harl [Wed, 16 Sep 2015 19:46:18 +0000 (21:46 +0200)]
store.h: Updated some documentation comments.

A store instance isn't synonym to "the database" anymore.

9 years agoplugin, store: Add service/metric "hostname" attributes centrally.
Sebastian Harl [Wed, 16 Sep 2015 19:33:05 +0000 (21:33 +0200)]
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.

9 years agofrontend/query_test: Test some weird, special cases.
Sebastian Harl [Thu, 3 Sep 2015 08:05:38 +0000 (10:05 +0200)]
frontend/query_test: Test some weird, special cases.

9 years agostore: Fix execution of more complex iterators.
Sebastian Harl [Wed, 2 Sep 2015 22:40:39 +0000 (00:40 +0200)]
store: Fix execution of more complex iterators.

That is, follow "indirections" of typed expressions if the iterator is not on
the top-most level.

9 years agoRemove unused sdb_store_expr_iterable().
Sebastian Harl [Wed, 2 Sep 2015 22:13:25 +0000 (00:13 +0200)]
Remove unused sdb_store_expr_iterable().

9 years agoAllow and implement iterating arbitrary (non-constant) array values.
Sebastian Harl [Wed, 2 Sep 2015 21:49:20 +0000 (23:49 +0200)]
Allow and implement iterating arbitrary (non-constant) array values.

That is, iterators may now work with arithmetic expressions that evaluate to
an array.

9 years agoanalyzer: Support more flexible iterator expressions.
Sebastian Harl [Mon, 31 Aug 2015 20:50:20 +0000 (22:50 +0200)]
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.

9 years agoanalyzer: Fixed some error messages.
Sebastian Harl [Mon, 31 Aug 2015 20:28:28 +0000 (22:28 +0200)]
analyzer: Fixed some error messages.

9 years agoparser: Require a context for each parser operation.
Sebastian Harl [Mon, 31 Aug 2015 20:08:45 +0000 (22:08 +0200)]
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.

9 years agoLet the front-end handle STORE commands.
Sebastian Harl [Mon, 24 Aug 2015 19:16:06 +0000 (21:16 +0200)]
Let the front-end handle STORE commands.

… rather than requiring each reader plugin to do so which doesn't make any
sense at all.

9 years agot/integration/store.sh: Add integration tests for the STORE command.
Sebastian Harl [Mon, 24 Aug 2015 19:15:28 +0000 (21:15 +0200)]
t/integration/store.sh: Add integration tests for the STORE command.

9 years agostore: Do not canonicalize the hostname when fetching a timeseries.
Sebastian Harl [Thu, 13 Aug 2015 17:02:14 +0000 (19:02 +0200)]
store: Do not canonicalize the hostname when fetching a timeseries.

This decision should be made on a higher level.

9 years agofrontend: Connection-specific functions now use the sdb_conn_ prefix.
Sebastian Harl [Thu, 13 Aug 2015 16:55:34 +0000 (18:55 +0200)]
frontend: Connection-specific functions now use the sdb_conn_ prefix.

… instead of sdb_fe_.

9 years agofrontend/connection.h: Removed sdb_fe_parse, it has been dropped.
Sebastian Harl [Thu, 13 Aug 2015 07:04:51 +0000 (09:04 +0200)]
frontend/connection.h: Removed sdb_fe_parse, it has been dropped.

9 years agostore: Removed obsolete TODO note.
Sebastian Harl [Thu, 13 Aug 2015 06:52:34 +0000 (08:52 +0200)]
store: Removed obsolete TODO note.

9 years agoplugin, store: Handle hostname canonicalization in the plugin module.
Sebastian Harl [Wed, 12 Aug 2015 19:55:41 +0000 (21:55 +0200)]
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.

9 years agosysdb(7): Briefly mention the object store.
Sebastian Harl [Mon, 10 Aug 2015 07:44:23 +0000 (09:44 +0200)]
sysdb(7): Briefly mention the object store.

9 years agosysdbd-store-memory(5): Added a manpage for store::memory.
Sebastian Harl [Mon, 10 Aug 2015 07:36:50 +0000 (09:36 +0200)]
sysdbd-store-memory(5): Added a manpage for store::memory.

9 years agostore::memory: Add a plugin providing an in-memory store.
Sebastian Harl [Sun, 9 Aug 2015 22:19:28 +0000 (00:19 +0200)]
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.

9 years agot/Makefile: Drop unused, old frontend/parser_test.
Sebastian Harl [Sun, 9 Aug 2015 21:55:23 +0000 (23:55 +0200)]
t/Makefile: Drop unused, old frontend/parser_test.

9 years agoplugin: Report an error when writing to the store with no writers.
Sebastian Harl [Sat, 8 Aug 2015 07:57:48 +0000 (09:57 +0200)]
plugin: Report an error when writing to the store with no writers.

9 years agostore: Drop the global (default) store.
Sebastian Harl [Sat, 8 Aug 2015 07:34:56 +0000 (09:34 +0200)]
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.

9 years agostore: All store functions now accept a store object.
Sebastian Harl [Fri, 7 Aug 2015 16:26:51 +0000 (18:26 +0200)]
store: All store functions now accept a store object.

That is, instead of operating on a global, shared instance.

9 years agostore: Add wrapper functions to store an object in an arbitrary store.
Sebastian Harl [Thu, 6 Aug 2015 15:39:45 +0000 (17:39 +0200)]
store: Add wrapper functions to store an object in an arbitrary store.

9 years agocore: Export the sdb_store, sdb_store_reader, sdb_store_writer types.
Sebastian Harl [Thu, 6 Aug 2015 15:22:31 +0000 (17:22 +0200)]
core: Export the sdb_store, sdb_store_reader, sdb_store_writer types.

This is in preparation to more flexible store handling.

9 years agot/valgrind.suppress: Refine the suppression in the libc exit handler.
Sebastian Harl [Thu, 6 Aug 2015 06:56:24 +0000 (08:56 +0200)]
t/valgrind.suppress: Refine the suppression in the libc exit handler.

9 years agofrontend: Use the plugin query interface instead of direct store access.
Sebastian Harl [Wed, 5 Aug 2015 08:45:11 +0000 (10:45 +0200)]
frontend: Use the plugin query interface instead of direct store access.

The built-in store is registered as a reader automatically at the moment.

9 years agocore: Add support for reader/query plugins.
Sebastian Harl [Wed, 5 Aug 2015 08:38:48 +0000 (10:38 +0200)]
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.

9 years agot/valgrind.suppress: Add an invalid free in a libc exit handler.
Sebastian Harl [Tue, 4 Aug 2015 07:13:47 +0000 (09:13 +0200)]
t/valgrind.suppress: Add an invalid free in a libc exit handler.

9 years agoplugin: Drop sdb_plugin prefix from private names.
Sebastian Harl [Thu, 28 May 2015 08:29:21 +0000 (10:29 +0200)]
plugin: Drop sdb_plugin prefix from private names.

9 years agostore_exec: Remove unnecessary casts.
Sebastian Harl [Thu, 28 May 2015 08:08:45 +0000 (10:08 +0200)]
store_exec: Remove unnecessary casts.

9 years agostore: Let sdb_store_json_formatter_t inherit from sdb_object_t.
Sebastian Harl [Wed, 27 May 2015 20:49:20 +0000 (22:49 +0200)]
store: Let sdb_store_json_formatter_t inherit from sdb_object_t.

9 years agoDrop sdb_store_get_host() from tests.
Sebastian Harl [Wed, 27 May 2015 20:48:21 +0000 (22:48 +0200)]
Drop sdb_store_get_host() from tests.

9 years agostore: Drop unused sdb_store_has_host.
Sebastian Harl [Fri, 22 May 2015 07:21:26 +0000 (09:21 +0200)]
store: Drop unused sdb_store_has_host.

9 years agoReplaced sdb_store_<type> with sdb_plugin_store_<type>.
Sebastian Harl [Thu, 21 May 2015 22:47:24 +0000 (00:47 +0200)]
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.

9 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Thu, 21 May 2015 22:46:58 +0000 (00:46 +0200)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

9 years agostore: Register a store writer and handle all updates through the plugin API.
Sebastian Harl [Thu, 21 May 2015 22:18:25 +0000 (00:18 +0200)]
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.

9 years agoplugin: sdb_plugin_store_* now return >0 if the new value was too old.
Sebastian Harl [Thu, 21 May 2015 22:16:04 +0000 (00:16 +0200)]
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.

9 years agostore: Reordered some functions to group by general purpose.
Sebastian Harl [Thu, 21 May 2015 21:42:11 +0000 (23:42 +0200)]
store: Reordered some functions to group by general purpose.

9 years agoFix an uninitialized value warnings caused by clang not knowing about fail().
Sebastian Harl [Thu, 21 May 2015 21:39:22 +0000 (23:39 +0200)]
Fix an uninitialized value warnings caused by clang not knowing about fail().

9 years agostore: Make the actual store a separate object.
Sebastian Harl [Thu, 21 May 2015 21:36:57 +0000 (23:36 +0200)]
store: Make the actual store a separate object.

That'll allow us to use different store objects in multiple places in the
future.

9 years agostore: Drop sdb_ prefix from private symbols.
Sebastian Harl [Thu, 21 May 2015 18:17:42 +0000 (20:17 +0200)]
store: Drop sdb_ prefix from private symbols.

9 years agodata: Use a predefined format for sdb_strftime().
Sebastian Harl [Wed, 20 May 2015 21:53:48 +0000 (23:53 +0200)]
data: Use a predefined format for sdb_strftime().

Also, print the nanosecond fraction of a second.

9 years agot/: Use ck_assert() instead of assert() in all tests.
Sebastian Harl [Wed, 20 May 2015 20:04:54 +0000 (22:04 +0200)]
t/: Use ck_assert() instead of assert() in all tests.

9 years agosysdbql(7): Document 'value' and 'timeseries' fields.
Sebastian Harl [Wed, 20 May 2015 09:36:37 +0000 (11:36 +0200)]
sysdbql(7): Document 'value' and 'timeseries' fields.

9 years agoparser: Add support for metric timeseries fields.
Sebastian Harl [Wed, 20 May 2015 08:35:29 +0000 (10:35 +0200)]
parser: Add support for metric timeseries fields.

9 years agostore: Add the timeseries field to metrics.
Sebastian Harl [Wed, 20 May 2015 08:34:27 +0000 (10:34 +0200)]
store: Add the timeseries field to metrics.

This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.

9 years agoparser: Skip context-specific checks if the context is unspecified.
Sebastian Harl [Wed, 20 May 2015 08:32:37 +0000 (10:32 +0200)]
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.

9 years agostore: Remove (now unused) sdb_store_parse_*() helpers.
Sebastian Harl [Wed, 20 May 2015 06:49:38 +0000 (08:49 +0200)]
store: Remove (now unused) sdb_store_parse_*() helpers.

9 years agostore: Remove (now unused) sdb_store_nin_matcher().
Sebastian Harl [Wed, 20 May 2015 06:48:42 +0000 (08:48 +0200)]
store: Remove (now unused) sdb_store_nin_matcher().

9 years agosysdbql(7): Document IS [NOT] TRUE / FALSE.
Sebastian Harl [Tue, 19 May 2015 21:17:11 +0000 (23:17 +0200)]
sysdbql(7): Document IS [NOT] TRUE / FALSE.

9 years agoparser: Add support for <expr> IS [NOT] TRUE / FALSE queries.
Sebastian Harl [Tue, 19 May 2015 21:11:35 +0000 (23:11 +0200)]
parser: Add support for <expr> IS [NOT] TRUE / FALSE queries.

9 years agostore: Add support for unary IS TRUE / IS FALSE matchers.
Sebastian Harl [Tue, 19 May 2015 21:08:30 +0000 (23:08 +0200)]
store: Add support for unary IS TRUE / IS FALSE matchers.

9 years agostore: Drop the special IS-NOT-NULL matcher.
Sebastian Harl [Tue, 19 May 2015 20:28:49 +0000 (22:28 +0200)]
store: Drop the special IS-NOT-NULL matcher.

In the AST world, this is NOT(IS-NULL).

9 years agoutils/proto: Support boolean values.
Sebastian Harl [Tue, 19 May 2015 20:11:50 +0000 (22:11 +0200)]
utils/proto: Support boolean values.

They are encoded as a single byte on the wire.

9 years agodata: Add basic support for a boolean type.
Sebastian Harl [Tue, 19 May 2015 19:42:20 +0000 (21:42 +0200)]
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 ;-)

9 years agoDrop the old frontend parser.
Sebastian Harl [Tue, 19 May 2015 18:10:22 +0000 (20:10 +0200)]
Drop the old frontend parser.

It's fully replaced by the new parser module now.

9 years agostore: Add sdb_store_query_prepare_matcher().
Sebastian Harl [Tue, 19 May 2015 18:08:56 +0000 (20:08 +0200)]
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.

9 years agofrontend: Drop sdb_fe_store_* in favor of sdb_store_query_execute.
Sebastian Harl [Mon, 18 May 2015 21:57:06 +0000 (23:57 +0200)]
frontend: Drop sdb_fe_store_* in favor of sdb_store_query_execute.

Instead, build a temporary AST to represent the command to be executed.

9 years agofrontend: Drop sdb_fe_exec_* in favor of sdb_store_query_execute.
Sebastian Harl [Mon, 18 May 2015 21:14:54 +0000 (23:14 +0200)]
frontend: Drop sdb_fe_exec_* in favor of sdb_store_query_execute.

Instead, build a temporary AST to represent the command to be executed.

9 years agoRemove (now) usued sdb_fe_exec_timeseries().
Sebastian Harl [Mon, 18 May 2015 20:50:19 +0000 (22:50 +0200)]
Remove (now) usued sdb_fe_exec_timeseries().

9 years agofrontend/query_test: Add tests for the lower level functions.
Sebastian Harl [Mon, 18 May 2015 20:48:57 +0000 (22:48 +0200)]
frontend/query_test: Add tests for the lower level functions.

9 years agofrontend/query: Split AST execution into a separate function.
Sebastian Harl [Mon, 18 May 2015 19:18:40 +0000 (21:18 +0200)]
frontend/query: Split AST execution into a separate function.

9 years agostore: Use a separate type for prepared querys.
Sebastian Harl [Mon, 18 May 2015 19:04:18 +0000 (21:04 +0200)]
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.

9 years agostore, frontend: Add sdb_store_query_execute use it instead of sdb_fe_exec.
Sebastian Harl [Sun, 17 May 2015 19:58:03 +0000 (21:58 +0200)]
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.

9 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.
Sebastian Harl [Fri, 15 May 2015 20:53:44 +0000 (22:53 +0200)]
Merged branch 'master' of git://git.tokkee.org/sysdb.

9 years agofrontend/query_test: Test various QUERY functions.
Sebastian Harl [Fri, 15 May 2015 20:41:43 +0000 (22:41 +0200)]
frontend/query_test: Test various QUERY functions.

These will, in turn, call the sdb_fe_exec_<CMD> functions, thus guaranteeing
good test coverage.

9 years agofrontend: Fixed reply from STORE command.
Sebastian Harl [Fri, 15 May 2015 20:40:00 +0000 (22:40 +0200)]
frontend: Fixed reply from STORE command.

9 years agostore: Fixed a memory leak in fetch_timeseries().
Sebastian Harl [Fri, 15 May 2015 20:39:26 +0000 (22:39 +0200)]
store: Fixed a memory leak in fetch_timeseries().

9 years agofrontend, parser: Allow typed access to host objects from any context.
Sebastian Harl [Fri, 15 May 2015 19:41:14 +0000 (21:41 +0200)]
frontend, parser: Allow typed access to host objects from any context.

That is, even from the "generic" or "filter" contexts.

9 years agostore: Add sdb_store_query_prepare().
Sebastian Harl [Fri, 15 May 2015 08:03:47 +0000 (10:03 +0200)]
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.

9 years agostore: Store a service/metric's parent hostname as an attribute.
Sebastian Harl [Thu, 14 May 2015 22:43:12 +0000 (00:43 +0200)]
store: Store a service/metric's parent hostname as an attribute.

9 years agostore: Fixed handling of metric store values.
Sebastian Harl [Thu, 14 May 2015 22:41:12 +0000 (00:41 +0200)]
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.

9 years agoparser/analyzer: Fixed iterator type checks.
Sebastian Harl [Fri, 8 May 2015 16:49:59 +0000 (18:49 +0200)]
parser/analyzer: Fixed iterator type checks.

Also, added some more test-cases covering affected cases.

9 years agot/coverage: Ignore parser/scanner and parser/grammar.
Sebastian Harl [Wed, 6 May 2015 22:32:35 +0000 (00:32 +0200)]
t/coverage: Ignore parser/scanner and parser/grammar.

9 years agot/Makefile: Update EXTRA_DIST based on recent changes.
Sebastian Harl [Wed, 6 May 2015 22:27:32 +0000 (00:27 +0200)]
t/Makefile: Update EXTRA_DIST based on recent changes.

9 years agoparser/analyzer: Migrate value expression checks.
Sebastian Harl [Wed, 6 May 2015 22:01:42 +0000 (00:01 +0200)]
parser/analyzer: Migrate value expression checks.

The new parser and analyzer now pass the full test-suite of frontend/parser.

9 years agoparser/analyzer: Migrate type and iterator checks.
Sebastian Harl [Wed, 6 May 2015 21:33:52 +0000 (23:33 +0200)]
parser/analyzer: Migrate type and iterator checks.

9 years agoparser: Add support for analyzing conditional and arithmetic expressions.
Sebastian Harl [Tue, 5 May 2015 22:15:49 +0000 (00:15 +0200)]
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.

9 years agoparser: Convert AST op types to data op types when necessary.
Sebastian Harl [Tue, 5 May 2015 22:15:09 +0000 (00:15 +0200)]
parser: Convert AST op types to data op types when necessary.

9 years agoparser: Determine the data-type of each node.
Sebastian Harl [Tue, 5 May 2015 21:52:41 +0000 (23:52 +0200)]
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.

9 years agoparser: Fixed setup of iterator nodes.
Sebastian Harl [Tue, 5 May 2015 21:36:14 +0000 (23:36 +0200)]
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.

9 years agoparser/ast: Add some helper defines.
Sebastian Harl [Tue, 5 May 2015 21:33:04 +0000 (23:33 +0200)]
parser/ast: Add some helper defines.

9 years agoMigrate top-level checks to the new parser/analyzer.
Sebastian Harl [Wed, 15 Apr 2015 09:38:26 +0000 (11:38 +0200)]
Migrate top-level checks to the new parser/analyzer.

Call the analyzer from sdb_parser_parse().

9 years agoparser_test: Make sure that TIMESERIES end times are greater than start times.
Sebastian Harl [Wed, 15 Apr 2015 09:29:55 +0000 (11:29 +0200)]
parser_test: Make sure that TIMESERIES end times are greater than start times.