Code

sysdb.git
9 years agostore: Renamed sdb_store_cmp_XX to sdb_store_XX_matcher.
Sebastian Harl [Wed, 22 Oct 2014 09:26:45 +0000 (11:26 +0200)]
store: Renamed sdb_store_cmp_XX to sdb_store_XX_matcher.

… now that these names have become available again.

9 years agostore: Removed unused, old conditional matchers.
Sebastian Harl [Wed, 22 Oct 2014 09:16:05 +0000 (11:16 +0200)]
store: Removed unused, old conditional matchers.

9 years agostore: Removed now unused support for attribute matchers in old code.
Sebastian Harl [Wed, 22 Oct 2014 09:09:30 +0000 (11:09 +0200)]
store: Removed now unused support for attribute matchers in old code.

9 years agot/: Use expression-based matchers for attribute comparison tests.
Sebastian Harl [Wed, 22 Oct 2014 09:08:17 +0000 (11:08 +0200)]
t/: Use expression-based matchers for attribute comparison tests.

9 years agostore: Removed sdb_store_matcher_parse_field_cmp() and sdb_store_obj_cond().
Sebastian Harl [Wed, 22 Oct 2014 08:48:13 +0000 (10:48 +0200)]
store: Removed sdb_store_matcher_parse_field_cmp() and sdb_store_obj_cond().

Those functions have been superseded by the new expression-based matchers.

9 years agot/: Use the new expression-based matchers for various tests.
Sebastian Harl [Wed, 22 Oct 2014 08:46:35 +0000 (10:46 +0200)]
t/: Use the new expression-based matchers for various tests.

9 years agodata: Format NULL as NULL and never quote it.
Sebastian Harl [Tue, 21 Oct 2014 08:02:07 +0000 (10:02 +0200)]
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.

9 years agostore: Let NULL values never match a regex.
Sebastian Harl [Tue, 21 Oct 2014 07:56:08 +0000 (09:56 +0200)]
store: Let NULL values never match a regex.

9 years agostore: Removed sdb_store_matcher_tostring().
Sebastian Harl [Tue, 21 Oct 2014 07:50:42 +0000 (09:50 +0200)]
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.

9 years agofrontend/grammar: Unified field and attribute value matchers.
Sebastian Harl [Tue, 21 Oct 2014 07:13:47 +0000 (09:13 +0200)]
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.

9 years agostore: Let compare matchers fail if any of the operands is NULL.
Sebastian Harl [Tue, 21 Oct 2014 06:17:17 +0000 (08:17 +0200)]
store: Let compare matchers fail if any of the operands is NULL.

9 years agot/: Let tests use '<expr> IN .backend'.
Sebastian Harl [Tue, 21 Oct 2014 05:57:19 +0000 (07:57 +0200)]
t/: Let tests use '<expr> IN .backend'.

9 years agofrontend/grammar: Added support for the IN operator.
Sebastian Harl [Tue, 21 Oct 2014 05:45:31 +0000 (07:45 +0200)]
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.

9 years agostore: Added sdb_store_in_matcher().
Sebastian Harl [Tue, 21 Oct 2014 05:36:41 +0000 (07:36 +0200)]
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.

9 years agodata: Added sdb_data_inarray().
Sebastian Harl [Tue, 21 Oct 2014 05:25:37 +0000 (07:25 +0200)]
data: Added sdb_data_inarray().

The function determines whether a value is included in an array.

9 years agostore: Added support for querying the BACKEND field.
Sebastian Harl [Mon, 20 Oct 2014 17:17:53 +0000 (19:17 +0200)]
store: Added support for querying the BACKEND field.

… returning an array of strings.

9 years agodata: Added support for comparing integer, decimal, and string arrays.
Sebastian Harl [Mon, 20 Oct 2014 07:44:16 +0000 (09:44 +0200)]
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.

9 years agodata_test: Use int64_t instead of int for integer array data.
Sebastian Harl [Mon, 20 Oct 2014 07:43:33 +0000 (09:43 +0200)]
data_test: Use int64_t instead of int for integer array data.

9 years agodata: Fixed length of newly allocated array in concat().
Sebastian Harl [Mon, 20 Oct 2014 07:42:35 +0000 (09:42 +0200)]
data: Fixed length of newly allocated array in concat().

9 years agodata: Added basic support for arrays.
Sebastian Harl [Mon, 20 Oct 2014 06:03:13 +0000 (08:03 +0200)]
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.

9 years agodata_test: Removed unnecessary and possibly misleading checks.
Sebastian Harl [Sun, 19 Oct 2014 21:20:49 +0000 (23:20 +0200)]
data_test: Removed unnecessary and possibly misleading checks.

9 years agodata: Use if-statements rather than switch-statements.
Sebastian Harl [Sun, 19 Oct 2014 20:52:44 +0000 (22:52 +0200)]
data: Use if-statements rather than switch-statements.

9 years agodata: Added sdb_data_sizeof().
Sebastian Harl [Sun, 19 Oct 2014 20:21:45 +0000 (22:21 +0200)]
data: Added sdb_data_sizeof().

This function returns the size of the data-type for a given type.

9 years agostore: Clarify behavior of expr_attrvalue if the attribute does not exist.
Sebastian Harl [Sun, 19 Oct 2014 15:58:46 +0000 (17:58 +0200)]
store: Clarify behavior of expr_attrvalue if the attribute does not exist.

9 years agofrontend/grammar: Fixed parsing of 'attribute[<string>]'.
Sebastian Harl [Sun, 19 Oct 2014 15:24:50 +0000 (17:24 +0200)]
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.

9 years agofrontend/grammar: Make IS NULL operators available to any expression.
Sebastian Harl [Sun, 19 Oct 2014 14:57:34 +0000 (16:57 +0200)]
frontend/grammar: Make IS NULL operators available to any expression.

9 years agostore: Return NULL if an attribute was not found.
Sebastian Harl [Sun, 19 Oct 2014 12:58:45 +0000 (14:58 +0200)]
store: Return NULL if an attribute was not found.

9 years agodata: Added explicit NULL values.
Sebastian Harl [Sun, 19 Oct 2014 12:56:38 +0000 (14:56 +0200)]
data: Added explicit NULL values.

… and let all expressions involving NULL values to return NULL.

9 years agodata: Let CONCAT return NULL if any of its operands is NULL.
Sebastian Harl [Sun, 19 Oct 2014 12:00:41 +0000 (14:00 +0200)]
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.

9 years agofrontend/grammar: Use strings to access attribute value: attribute['name'].
Sebastian Harl [Fri, 17 Oct 2014 22:42:43 +0000 (00:42 +0200)]
frontend/grammar: Use strings to access attribute value: attribute['name'].

9 years agostore, frontend: Make IS (NOT) NULL an unary operator on expressions.
Sebastian Harl [Fri, 17 Oct 2014 17:50:34 +0000 (19:50 +0200)]
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.

9 years agoparser_test: Added various arithmetic expressions to the expr parser test.
Sebastian Harl [Fri, 17 Oct 2014 08:52:45 +0000 (10:52 +0200)]
parser_test: Added various arithmetic expressions to the expr parser test.

9 years agoAdded tests for sdb_fe_parse_expr() and fixed the implementation.
Sebastian Harl [Fri, 17 Oct 2014 08:43:45 +0000 (10:43 +0200)]
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.

9 years agofrontend/parser: Made clear that parser modes are flags.
Sebastian Harl [Fri, 17 Oct 2014 08:35:07 +0000 (10:35 +0200)]
frontend/parser: Made clear that parser modes are flags.

It doesn't make a difference so far, but will avoid problems in the future.

9 years agofrontend/grammar: Added a destructor for data objects.
Sebastian Harl [Fri, 17 Oct 2014 08:34:20 +0000 (10:34 +0200)]
frontend/grammar: Added a destructor for data objects.

9 years agofrontend/parser: Don't override fields of unknown types.
Sebastian Harl [Fri, 17 Oct 2014 08:33:46 +0000 (10:33 +0200)]
frontend/parser: Don't override fields of unknown types.

9 years agofrontend: Added sdb_fe_parse_expr().
Sebastian Harl [Fri, 17 Oct 2014 07:12:08 +0000 (09:12 +0200)]
frontend: Added sdb_fe_parse_expr().

This function enables a special new parser mode in which it only accepts
simple expressions.

9 years agofrontend: Renamed CONNECTION_EXPR to CONNECTION_MATCHER.
Sebastian Harl [Fri, 17 Oct 2014 07:10:03 +0000 (09:10 +0200)]
frontend: Renamed CONNECTION_EXPR to CONNECTION_MATCHER.

That's more specific.

9 years agostore: Added sdb_store_parse_matcher_op().
Sebastian Harl [Fri, 17 Oct 2014 06:36:42 +0000 (08:36 +0200)]
store: Added sdb_store_parse_matcher_op().

This function parses the string representation of an operator and returns a
constructor for the respective matcher.

9 years agodata: Don't free memory before using it for the last time.
Sebastian Harl [Fri, 17 Oct 2014 06:30:16 +0000 (08:30 +0200)]
data: Don't free memory before using it for the last time.

9 years agostore: Added not-equal and not-regex matchers.
Sebastian Harl [Wed, 15 Oct 2014 13:57:24 +0000 (15:57 +0200)]
store: Added not-equal and not-regex matchers.

9 years agostore: Added support for regex matchers.
Sebastian Harl [Wed, 15 Oct 2014 13:36:29 +0000 (15:36 +0200)]
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.

9 years agodata: Let sdb_data_parse() support inline casts from string to other types.
Sebastian Harl [Wed, 15 Oct 2014 13:15:25 +0000 (15:15 +0200)]
data: Let sdb_data_parse() support inline casts from string to other types.

9 years agostore: Added child matchers.
Sebastian Harl [Tue, 14 Oct 2014 21:44:19 +0000 (23:44 +0200)]
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.

9 years agostore: Added matchers comparing two expressions.
Sebastian Harl [Tue, 14 Oct 2014 21:07:43 +0000 (23:07 +0200)]
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.

9 years agostore: Apply filters when evaluating attribute values or expressions.
Sebastian Harl [Tue, 14 Oct 2014 20:45:07 +0000 (22:45 +0200)]
store: Apply filters when evaluating attribute values or expressions.

9 years agofrontend/grammar: Added (limited) support for attribute values in expressions.
Sebastian Harl [Tue, 14 Oct 2014 07:16:09 +0000 (09:16 +0200)]
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.

9 years agostore: Added sdb_store_expr_attrvalue().
Sebastian Harl [Tue, 14 Oct 2014 07:13:11 +0000 (09:13 +0200)]
store: Added sdb_store_expr_attrvalue().

This function allows to use attribute values in an expression.

9 years agostore: Added sdb_store_get_attr().
Sebastian Harl [Mon, 13 Oct 2014 07:18:41 +0000 (09:18 +0200)]
store: Added sdb_store_get_attr().

9 years agostore: sdb_store_get_field: Make result parameter optional.
Sebastian Harl [Mon, 13 Oct 2014 07:07:37 +0000 (09:07 +0200)]
store: sdb_store_get_field: Make result parameter optional.

9 years agot/cibuild.sh: Use 'make -j10' to run tests in parallel.
Sebastian Harl [Fri, 10 Oct 2014 11:12:07 +0000 (13:12 +0200)]
t/cibuild.sh: Use 'make -j10' to run tests in parallel.

9 years agointegration tests: Split simple_query into query, matching, and filter.
Sebastian Harl [Fri, 10 Oct 2014 11:02:57 +0000 (13:02 +0200)]
integration tests: Split simple_query into query, matching, and filter.

9 years agointegration tests: Make sure test_lib always knows about the socket file.
Sebastian Harl [Fri, 10 Oct 2014 10:21:22 +0000 (12:21 +0200)]
integration tests: Make sure test_lib always knows about the socket file.

9 years agofrontend/parser: Added support for string concatenation.
Sebastian Harl [Thu, 9 Oct 2014 06:57:07 +0000 (08:57 +0200)]
frontend/parser: Added support for string concatenation.

9 years agofrontend/grammary.y: Renamed 'op' to 'cmp'.
Sebastian Harl [Wed, 8 Oct 2014 20:29:57 +0000 (22:29 +0200)]
frontend/grammary.y: Renamed 'op' to 'cmp'.

That's a better name ;-)

9 years agodata: Added sdb_data_parse_op().
Sebastian Harl [Wed, 8 Oct 2014 10:24:51 +0000 (12:24 +0200)]
data: Added sdb_data_parse_op().

This function parses the string representation of an operator.

9 years agostore: Added quaryable field ‘name’.
Sebastian Harl [Tue, 7 Oct 2014 21:28:33 +0000 (23:28 +0200)]
store: Added quaryable field ‘name’.

9 years agodata: Document that regexes are extended, case-insensitive POSIX regexes.
Sebastian Harl [Tue, 7 Oct 2014 19:45:13 +0000 (21:45 +0200)]
data: Document that regexes are extended, case-insensitive POSIX regexes.

9 years agodata: Added support for a "regex" data-type.
Sebastian Harl [Tue, 7 Oct 2014 19:41:54 +0000 (21:41 +0200)]
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.

9 years agodata_test: Fixed name/order of the cmp() and strcmp() tests.
Sebastian Harl [Tue, 7 Oct 2014 19:30:32 +0000 (21:30 +0200)]
data_test: Fixed name/order of the cmp() and strcmp() tests.

;-)

9 years agodata_test: Fixed a typo.
Sebastian Harl [Tue, 7 Oct 2014 19:11:34 +0000 (21:11 +0200)]
data_test: Fixed a typo.

9 years agodata: Fixed copying of NULL data.
Sebastian Harl [Tue, 7 Oct 2014 17:43:24 +0000 (19:43 +0200)]
data: Fixed copying of NULL data.

9 years agoversion-gen.sh: Added .git suffix to default version again.
Sebastian Harl [Mon, 6 Oct 2014 19:51:49 +0000 (21:51 +0200)]
version-gen.sh: Added .git suffix to default version again.

9 years agoRelease SysDB 0.5.0. sysdb-0.5.0
Sebastian Harl [Mon, 6 Oct 2014 19:44:37 +0000 (21:44 +0200)]
Release SysDB 0.5.0.

9 years agoReleaseNotes: Added entry for the 0.5.0 release.
Sebastian Harl [Mon, 6 Oct 2014 19:44:03 +0000 (21:44 +0200)]
ReleaseNotes: Added entry for the 0.5.0 release.

9 years agot/valgrind.suppress: Use a pattern for the full name of gcov_exit.
Sebastian Harl [Mon, 6 Oct 2014 18:34:51 +0000 (20:34 +0200)]
t/valgrind.suppress: Use a pattern for the full name of gcov_exit.

For example, I've seen gcov_exit.part.5.

9 years agosysdbql(7): Fixed an incomplete sentence.
Sebastian Harl [Mon, 6 Oct 2014 18:24:17 +0000 (20:24 +0200)]
sysdbql(7): Fixed an incomplete sentence.

9 years agosysdbql(7): Updated documentation for attribute and field access.
Sebastian Harl [Mon, 6 Oct 2014 06:29:32 +0000 (08:29 +0200)]
sysdbql(7): Updated documentation for attribute and field access.

9 years agofrontend/grammar: Use '.' instead of ':' to access queryable object fields.
Sebastian Harl [Mon, 6 Oct 2014 06:24:13 +0000 (08:24 +0200)]
frontend/grammar: Use '.' instead of ':' to access queryable object fields.

9 years agofrontend/grammar: Access attribute values using attributes[<name>].
Sebastian Harl [Mon, 6 Oct 2014 06:18:10 +0000 (08:18 +0200)]
frontend/grammar: Access attribute values using attributes[<name>].

… instead of attribute.<name>. We'll use <obj>.<field> for all directly
accessible object fields instead.

9 years agostore_lookup: Compare attribute string values on type mismatch.
Sebastian Harl [Sun, 5 Oct 2014 18:49:19 +0000 (20:49 +0200)]
store_lookup: Compare attribute string values on type mismatch.

Given that we don't support any schema for attribute values, this sounds like
a better option than assuming that those values never match no matter which
comparison operator is used.

9 years agodata: Added sdb_data_strcmp().
Sebastian Harl [Sun, 5 Oct 2014 18:43:24 +0000 (20:43 +0200)]
data: Added sdb_data_strcmp().

This function compares the string values of two data points.

9 years agodata: Use %g format when formatting decimal numbers.
Sebastian Harl [Sun, 5 Oct 2014 18:39:33 +0000 (20:39 +0200)]
data: Use %g format when formatting decimal numbers.

This is much better human-readable and we don't need an exact representation.
In fact, given that a datum's string value is used when comparing attribute
values, the human readable format is much better suited given that chances are
higher that users will enter numbers in the same format (but it's still just a
best guess kind of thing).

9 years agodata: Added sdb_data_isnull().
Sebastian Harl [Sun, 5 Oct 2014 18:25:32 +0000 (20:25 +0200)]
data: Added sdb_data_isnull().

The function determines if a datum pointer or a string or binary datum is
NULL.

9 years agodata: Format NULL values as "<NULL>".
Sebastian Harl [Sun, 5 Oct 2014 18:23:26 +0000 (20:23 +0200)]
data: Format NULL values as "<NULL>".

9 years agostore_lookup: Fixed lookup by back-end name.
Sebastian Harl [Sun, 5 Oct 2014 17:50:20 +0000 (19:50 +0200)]
store_lookup: Fixed lookup by back-end name.

Added an integration test which reproduces the problem -- previously, all
compare operations reported a mismatch.

9 years agodata: Ensure a stable ordering in cmp() in case of type-mismatches.
Sebastian Harl [Sun, 5 Oct 2014 17:19:49 +0000 (19:19 +0200)]
data: Ensure a stable ordering in cmp() in case of type-mismatches.

So far, this doesn't make a difference but it's better style anyway.

9 years agostore_lookup: Fixed parsing of invalid compare expressions.
Sebastian Harl [Sun, 5 Oct 2014 16:19:39 +0000 (18:19 +0200)]
store_lookup: Fixed parsing of invalid compare expressions.

Previously, expressions like 'host.foo != 123' would be silently accepted by
the parser.

Added test cases to reproduce and catch the problem.

9 years agoutils dbi: Guard against multiple calls to dbi_shutdown_r().
Sebastian Harl [Sun, 5 Oct 2014 16:10:09 +0000 (18:10 +0200)]
utils dbi: Guard against multiple calls to dbi_shutdown_r().

This should not happen anyway but better be safe than sorry.

9 years agoobject: Assert that object's are not free'd multiple times.
Sebastian Harl [Sun, 5 Oct 2014 16:09:00 +0000 (18:09 +0200)]
object: Assert that object's are not free'd multiple times.

Else, we'd access free'd memory when trying to do so.

9 years agofrontend/proto.h: Improved documentation of all message types.
Sebastian Harl [Sun, 5 Oct 2014 14:27:52 +0000 (16:27 +0200)]
frontend/proto.h: Improved documentation of all message types.

9 years agofrontend, proto: Include object type in FETCH and LOOKUP messages.
Sebastian Harl [Sun, 5 Oct 2014 14:25:36 +0000 (16:25 +0200)]
frontend, proto: Include object type in FETCH and LOOKUP messages.

The respective commands only support hosts at the moment but this change
prepares the wire-format to support other types as well.

9 years agoReleaseNotes: Fixed date of the 0.2.0 release.
Sebastian Harl [Sun, 5 Oct 2014 09:59:39 +0000 (11:59 +0200)]
ReleaseNotes: Fixed date of the 0.2.0 release.

9 years agosysdbql(7): Fixed example LIST output.
Sebastian Harl [Sat, 4 Oct 2014 17:15:56 +0000 (19:15 +0200)]
sysdbql(7): Fixed example LIST output.

9 years agoWhen querying services/metrics skip hosts without such children.
Sebastian Harl [Tue, 30 Sep 2014 14:40:52 +0000 (07:40 -0700)]
When querying services/metrics skip hosts without such children.

This takes into account any filters and, thus, might mean that filters have to
be evaluated multiple times: once for determining if there are any children
and then again while serializing the data. This is because filtering happens
during serialization at which point it's too late to skip a host.

9 years agosysdbql(7): Use “SysQL” as the official abbreviation.
Sebastian Harl [Tue, 30 Sep 2014 12:51:05 +0000 (05:51 -0700)]
sysdbql(7): Use “SysQL” as the official abbreviation.

This is to avoid that people will call it “SQL”. Thanks to Julian Hein (and
others) for suggesting this.

9 years agosysdbql(7): Updated documentation for the LIST command.
Sebastian Harl [Tue, 30 Sep 2014 12:49:33 +0000 (05:49 -0700)]
sysdbql(7): Updated documentation for the LIST command.

9 years agofrontend/grammar: Added support for LISTing services and metrics.
Sebastian Harl [Tue, 30 Sep 2014 12:44:07 +0000 (05:44 -0700)]
frontend/grammar: Added support for LISTing services and metrics.

9 years agostore: Added a helper function to parse object type names.
Sebastian Harl [Tue, 30 Sep 2014 12:43:42 +0000 (05:43 -0700)]
store: Added a helper function to parse object type names.

9 years agofrontend: Added support for LISTing services and metrics as well.
Sebastian Harl [Tue, 30 Sep 2014 12:40:53 +0000 (05:40 -0700)]
frontend: Added support for LISTing services and metrics as well.

When listing objects other than hosts, the returned JSON list will include the
respective type listed below each host object.

9 years agofrontend: Use sdb_proto_get_int() instead of a custom helper.
Sebastian Harl [Tue, 30 Sep 2014 12:23:49 +0000 (05:23 -0700)]
frontend: Use sdb_proto_get_int() instead of a custom helper.

9 years agoReleaseNotes: Fixed a typo.
Sebastian Harl [Wed, 24 Sep 2014 20:34:06 +0000 (13:34 -0700)]
ReleaseNotes: Fixed a typo.

9 years agostore: Fixed JSON for serialized time-series.
Sebastian Harl [Fri, 19 Sep 2014 03:38:46 +0000 (20:38 -0700)]
store: Fixed JSON for serialized time-series.

Each field needs a name, add the name to the "data" field.

9 years agostore: Don't wrap JSON serialized LIST replies in a separate object.
Sebastian Harl [Fri, 19 Sep 2014 03:24:11 +0000 (20:24 -0700)]
store: Don't wrap JSON serialized LIST replies in a separate object.

Previously, the reply was {"hosts": [<list>]} while now it's just the list.
This way, the response format matches that of other commands which return host
lists.

9 years agoutils strbuf: Exponentially increase the buffer size.
Sebastian Harl [Wed, 17 Sep 2014 09:22:54 +0000 (11:22 +0200)]
utils strbuf: Exponentially increase the buffer size.

That'll make sure that lots of small writes don't result in lots of memory
reallocations.

9 years agoutils strbuf: Added 'min_size' to be considered when shrinking the buffer.
Sebastian Harl [Wed, 17 Sep 2014 09:10:13 +0000 (11:10 +0200)]
utils strbuf: Added 'min_size' to be considered when shrinking the buffer.

It's set to the initial size of the buffer (or 64). The idea is that the
initial size should provide an estimate of a reasonable size and shrinking the
buffer below that size causes unecessary churn.

For example, this is important for the frontend's command handlers which
usually need a large buffer size but initial writes to the buffer may be
small.

9 years agoutils strbuf: Renamed buffer variables from 'strbuf' to 'buf'.
Sebastian Harl [Wed, 17 Sep 2014 09:01:11 +0000 (11:01 +0200)]
utils strbuf: Renamed buffer variables from 'strbuf' to 'buf'.

9 years agofrontend, sysdb: Correctly handle empty queries.
Sebastian Harl [Tue, 16 Sep 2014 17:36:23 +0000 (19:36 +0200)]
frontend, sysdb: Correctly handle empty queries.

Let the frontend send back a DATA message even on empty queries to make sure
the client sees the expected reply.

Let sysdb handle empty replies correctly and also not print any errors on
empty replies (successful command not returning any data).

9 years agofrontend/proto: Include the log priority in LOG messages.
Sebastian Harl [Tue, 16 Sep 2014 16:48:57 +0000 (18:48 +0200)]
frontend/proto: Include the log priority in LOG messages.

The priority is encoded as 32 bit integer in network byte order and added as a
separate field before the actual log message.

The 'sysdb' client now handles LOG messages accordingly and prefixes the
message with a string describing the priority.

9 years agofrontend/proto: Let CONNECTION_DATA not replace CONNECTION_ERROR.
Sebastian Harl [Mon, 15 Sep 2014 17:44:13 +0000 (19:44 +0200)]
frontend/proto: Let CONNECTION_DATA not replace CONNECTION_ERROR.

Instead, reserve some space for groups of status/state codes and then use a
new number / block for CONNECTION_DATA.