Code

store: Added a generic JSON formatter.
[sysdb.git] / src / include / core / store.h
1 /*
2  * SysDB - src/include/core/store.h
3  * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
28 #ifndef SDB_CORE_STORE_H
29 #define SDB_CORE_STORE_H 1
31 #include "sysdb.h"
32 #include "core/object.h"
33 #include "core/data.h"
34 #include "core/time.h"
35 #include "core/timeseries.h"
36 #include "utils/strbuf.h"
38 #include <stdio.h>
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /*
45  * Store object types.
46  */
47 enum {
48         SDB_HOST = 1,
49         SDB_SERVICE,
50         SDB_METRIC,
51         SDB_ATTRIBUTE,
52 };
53 #define SDB_STORE_TYPE_TO_NAME(t) \
54         (((t) == SDB_HOST) ? "host" \
55                 : ((t) == SDB_SERVICE) ? "service" \
56                 : ((t) == SDB_METRIC) ? "metric" \
57                 : ((t) == SDB_ATTRIBUTE) ? "attribute" : "unknown")
59 /*
60  * sdb_store_obj_t represents the super-class of any object stored in the
61  * database. It inherits from sdb_object_t and may safely be cast to a generic
62  * object to access its name.
63  */
64 struct sdb_store_obj;
65 typedef struct sdb_store_obj sdb_store_obj_t;
67 /*
68  * Expressions represent arithmetic expressions based on stored objects and
69  * their various attributes.
70  *
71  * An expression object inherits from sdb_object_t and, thus, may safely be
72  * cast to a generic object.
73  */
74 struct sdb_store_expr;
75 typedef struct sdb_store_expr sdb_store_expr_t;
76 #define SDB_STORE_EXPR(obj) ((sdb_store_expr_t *)(obj))
78 /*
79  * Store matchers may be used to lookup hosts from the store based on their
80  * various attributes. Service and attribute matchers are applied to a host's
81  * services and attributes and evaluate to true if *any* service or attribute
82  * matches.
83  *
84  * A store matcher object inherits from sdb_object_t and, thus, may safely be
85  * cast to a generic object.
86  */
87 struct sdb_store_matcher;
88 typedef struct sdb_store_matcher sdb_store_matcher_t;
89 #define SDB_STORE_MATCHER(obj) ((sdb_store_matcher_t *)(obj))
91 /*
92  * A JSON formatter converts a stored object into the JSON format.
93  * See http://www.ietf.org/rfc/rfc4627.txt
94  */
95 struct sdb_store_json_formatter;
96 typedef struct sdb_store_json_formatter sdb_store_json_formatter_t;
98 /*
99  * Queryable fields of a stored object.
100  */
101 enum {
102         SDB_FIELD_NAME = 1,    /* string */
103         SDB_FIELD_LAST_UPDATE, /* datetime */
104         SDB_FIELD_AGE,         /* datetime */
105         SDB_FIELD_INTERVAL,    /* datetime */
106         SDB_FIELD_BACKEND,     /* string */
107 };
109 #define SDB_FIELD_TO_NAME(f) \
110         (((f) == SDB_FIELD_NAME) ? "name" \
111                 : ((f) == SDB_FIELD_LAST_UPDATE) ? "last-update" \
112                 : ((f) == SDB_FIELD_AGE) ? "age" \
113                 : ((f) == SDB_FIELD_INTERVAL) ? "interval" \
114                 : ((f) == SDB_FIELD_BACKEND) ? "backend" : "unknown")
116 #define SDB_FIELD_TYPE(f) \
117         (((f) == SDB_FIELD_NAME) ? SDB_TYPE_STRING \
118                 : ((f) == SDB_FIELD_LAST_UPDATE) ? SDB_TYPE_DATETIME \
119                 : ((f) == SDB_FIELD_AGE) ? SDB_TYPE_DATETIME \
120                 : ((f) == SDB_FIELD_INTERVAL) ? SDB_TYPE_DATETIME \
121                 : ((f) == SDB_FIELD_BACKEND) ? (SDB_TYPE_ARRAY | SDB_TYPE_STRING) \
122                 : -1)
124 /*
125  * sdb_store_clear:
126  * Clear the entire store and remove all stored objects.
127  */
128 void
129 sdb_store_clear(void);
131 /*
132  * sdb_store_host:
133  * Add/update a host in the store. If the host, identified by its
134  * canonicalized name, already exists, it will be updated according to the
135  * specified name and timestamp. Else, a new entry will be created in the
136  * store. Any memory required for storing the entry will be allocated an
137  * managed by the store itself.
138  *
139  * Returns:
140  *  - 0 on success
141  *  - a positive value if the new entry is older than the currently stored
142  *    entry (in this case, no update will happen)
143  *  - a negative value on error
144  */
145 int
146 sdb_store_host(const char *name, sdb_time_t last_update);
148 /*
149  * sdb_store_has_host:
150  * sdb_store_get_host:
151  * Query the store for a host by its (canonicalized) name.
152  *
153  * sdb_store_get_host increments the ref count of the host object. The caller
154  * needs to deref it when no longer using it.
155  */
156 _Bool
157 sdb_store_has_host(const char *name);
159 sdb_store_obj_t *
160 sdb_store_get_host(const char *name);
162 /*
163  * sdb_store_attribute:
164  * Add/update a host's attribute in the store. If the attribute, identified by
165  * its key, already exists for the specified host, it will be updated to the
166  * specified values. If the referenced host does not exist, an error will be
167  * reported. Else, a new entry will be created in the store. Any memory
168  * required for storing the entry will be allocated and managed by the store
169  * itself.
170  *
171  * Returns:
172  *  - 0 on success
173  *  - a positive value if the new entry is older than the currently stored
174  *    entry (in this case, no update will happen)
175  *  - a negative value on error
176  */
177 int
178 sdb_store_attribute(const char *hostname,
179                 const char *key, const sdb_data_t *value,
180                 sdb_time_t last_update);
182 /*
183  * sdb_store_service:
184  * Add/update a service in the store. If the service, identified by its name,
185  * already exists for the specified host, it will be updated according to the
186  * specified 'service' object. If the referenced host does not exist, an error
187  * will be reported. Else, a new entry will be created in the store. Any
188  * memory required for storing the entry will be allocated an managed by the
189  * store itself.
190  *
191  * Returns:
192  *  - 0 on success
193  *  - a positive value if the new entry is older than the currently stored
194  *    entry (in this case, no update will happen)
195  *  - a negative value on error
196  */
197 int
198 sdb_store_service(const char *hostname, const char *name,
199                 sdb_time_t last_update);
201 /*
202  * sdb_store_service_attr:
203  * Add/update a service's attribute in the store. If the attribute, identified
204  * by its key, already exists for the specified service, it will be updated to
205  * the specified value. If the references service (for the specified host)
206  * does not exist, an error will be reported. Any memory required for storing
207  * the entry will be allocated and managed by the store itself.
208  *
209  * Returns:
210  *  - 0 on success
211  *  - a positive value if the new entry is older than the currently stored
212  *    entry (in this case, no update will happen)
213  *  - a negative value on error
214  */
215 int
216 sdb_store_service_attr(const char *hostname, const char *service,
217                 const char *key, const sdb_data_t *value, sdb_time_t last_update);
219 /*
220  * A metric store describes how to access a metric's data.
221  */
222 typedef struct {
223         const char *type;
224         const char *id;
225 } sdb_metric_store_t;
227 /*
228  * sdb_store_metric:
229  * Add/update a metric in the store. If the metric, identified by its name,
230  * already exists for the specified host, it will be updated according to the
231  * specified 'metric' object. If the referenced host does not exist, an error
232  * will be reported. Else, a new entry will be created in the store. Any
233  * memory required for storing the entry will be allocated an managed by the
234  * store itself.
235  *
236  * If specified, the metric store describes where to access the metric's data.
237  *
238  * Returns:
239  *  - 0 on success
240  *  - a positive value if the new entry is older than the currently stored
241  *    entry (in this case, no update will happen)
242  *  - a negative value on error
243  */
244 int
245 sdb_store_metric(const char *hostname, const char *name,
246                 sdb_metric_store_t *store, sdb_time_t last_update);
248 /*
249  * sdb_store_metric_attr:
250  * Add/update a metric's attribute in the store. If the attribute, identified
251  * by its key, already exists for the specified metric, it will be updated to
252  * the specified value. If the references metric (for the specified host)
253  * does not exist, an error will be reported. Any memory required for storing
254  * the entry will be allocated and managed by the store itself.
255  *
256  * Returns:
257  *  - 0 on success
258  *  - a positive value if the new entry is older than the currently stored
259  *    entry (in this case, no update will happen)
260  *  - a negative value on error
261  */
262 int
263 sdb_store_metric_attr(const char *hostname, const char *metric,
264                 const char *key, const sdb_data_t *value, sdb_time_t last_update);
266 /*
267  * sdb_store_fetch_timeseries:
268  * Fetch the time-series described by the specified host's metric and
269  * serialize it as JSON into the provided string buffer.
270  *
271  * Returns:
272  *  - 0 on success
273  *  - a negative value else
274  */
275 int
276 sdb_store_fetch_timeseries(const char *hostname, const char *metric,
277                 sdb_timeseries_opts_t *opts, sdb_strbuf_t *buf);
279 /*
280  * sdb_store_get_field:
281  * Get the value of a stored object's queryable field. The caller is
282  * responsible for freeing any dynamically allocated memory possibly stored in
283  * the returned value. If 'res' is NULL, the function will return whether the
284  * field exists.
285  *
286  * Note: Retrieving the backend this way is not currently supported.
287  *
288  * Returns:
289  *  - 0 on success
290  *  - a negative value else
291  */
292 int
293 sdb_store_get_field(sdb_store_obj_t *obj, int field, sdb_data_t *res);
295 /*
296  * sdb_store_get_attr:
297  * Get the value of a stored object's attribute. The caller is responsible for
298  * freeing any dynamically allocated memory possibly stored in the returned
299  * value. If 'res' is NULL, the function will return whether the attribute
300  * exists. If specified, only attributes matching the filter will be
301  * considered.
302  *
303  * Returns:
304  *  - 0 if the attribute exists
305  *  - a negative value else
306  */
307 int
308 sdb_store_get_attr(sdb_store_obj_t *obj, const char *name, sdb_data_t *res,
309                 sdb_store_matcher_t *filter);
311 /*
312  * sdb_store_expr_create:
313  * Creates an arithmetic expression implementing the specified operator on the
314  * specified left and right operand.
315  *
316  * Returns:
317  *  - an expression object on success
318  *  - NULL else
319  */
320 sdb_store_expr_t *
321 sdb_store_expr_create(int op, sdb_store_expr_t *left, sdb_store_expr_t *right);
323 /*
324  * sdb_store_expr_fieldvalue:
325  * Creates an expression which evaluates to the value of the specified
326  * queryable field of a stored object.
327  *
328  * Returns:
329  *  - an expression object on success
330  *  - NULL else
331  */
332 sdb_store_expr_t *
333 sdb_store_expr_fieldvalue(int field);
335 /*
336  * sdb_store_expr_attrvalue:
337  * Creates an expression which evaluates to the value of the specified
338  * attribute of a stored object. Evaluates to a NULL value if the attribute
339  * does not exist.
340  *
341  * Returns:
342  *  - an expression object on success
343  *  - NULL else
344  */
345 sdb_store_expr_t *
346 sdb_store_expr_attrvalue(const char *name);
348 /*
349  * sdb_store_expr_constvalue:
350  * Creates an expression which evaluates to the specified constant value.
351  *
352  * Returns:
353  *  - an expression object on success
354  *  - NULL else
355  */
356 sdb_store_expr_t *
357 sdb_store_expr_constvalue(const sdb_data_t *value);
359 /*
360  * sdb_store_expr_eval:
361  * Evaluate an expression for the specified stored object and stores the
362  * result in 'res'. The result's value will be allocated dynamically if
363  * necessary and, thus, should be free'd by the caller (e.g. using
364  * sdb_data_free_datum). The object may be NULL, in which case the expression
365  * needs to evaluate to a constant value. If specified, only objects matching
366  * the filter will be used during the evaluation.
367  *
368  * Returns:
369  *  - 0 on success
370  *  - a negative value else
371  */
372 int
373 sdb_store_expr_eval(sdb_store_expr_t *expr, sdb_store_obj_t *obj,
374                 sdb_data_t *res, sdb_store_matcher_t *filter);
376 /*
377  * sdb_store_isnull_matcher:
378  * Creates a matcher matching NULL values.
379  */
380 sdb_store_matcher_t *
381 sdb_store_isnull_matcher(sdb_store_expr_t *expr);
383 /*
384  * sdb_store_isnnull_matcher:
385  * Creates a matcher matching non-NULL values.
386  */
387 sdb_store_matcher_t *
388 sdb_store_isnnull_matcher(sdb_store_expr_t *expr);
390 /*
391  * sdb_store_any_matcher:
392  * Creates a matcher iterating over objects of the specified type. It matches
393  * if *any* of those objects match 'm'.
394  */
395 sdb_store_matcher_t *
396 sdb_store_any_matcher(int type, sdb_store_matcher_t *m);
398 /*
399  * sdb_store_all_matcher:
400  * Creates a matcher iterating over objects of the specified type. It matches
401  * if *all* of those objects match 'm'.
402  */
403 sdb_store_matcher_t *
404 sdb_store_all_matcher(int type, sdb_store_matcher_t *m);
406 /*
407  * sdb_store_lt_matcher, sdb_store_le_matcher, sdb_store_eq_matcher,
408  * sdb_store_ge_matcher, sdb_store_gt_matcher:
409  * Create conditional matchers comparing the values of two expressions. The
410  * matcher matches if the left expression compres less than, less or equal
411  * than, equal to, not equal to, greater or equal than, or greater than the
412  * right expression.
413  */
414 sdb_store_matcher_t *
415 sdb_store_lt_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
416 sdb_store_matcher_t *
417 sdb_store_le_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
418 sdb_store_matcher_t *
419 sdb_store_eq_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
420 sdb_store_matcher_t *
421 sdb_store_ne_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
422 sdb_store_matcher_t *
423 sdb_store_ge_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
424 sdb_store_matcher_t *
425 sdb_store_gt_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
427 /*
428  * sdb_store_in_matcher:
429  * Creates a matcher which matches if the right value evaluates to an array
430  * value and the left value is included in that array. See sdb_data_inarray
431  * for more details.
432  */
433 sdb_store_matcher_t *
434 sdb_store_in_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
436 /*
437  * sdb_store_regex_matcher:
438  * Creates a matcher which matches the string value the left expression
439  * evaluates to against the regular expression the right expression evaluates
440  * to. The right expression may either be a constant value regular expression
441  * or string or a dynamic value evaluating to a string. In the latter case,
442  * the string is compiled to a regex every time the matcher is executed.
443  */
444 sdb_store_matcher_t *
445 sdb_store_regex_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
447 /*
448  * sdb_store_nregex_matcher:
449  * Creates a regex matcher just like sdb_store_regex_matcher except that it
450  * matches in case the regular expression does not match.
451  */
452 sdb_store_matcher_t *
453 sdb_store_nregex_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
455 /*
456  * sdb_store_matcher_op_cb:
457  * Callback constructing a matcher operator.
458  */
459 typedef sdb_store_matcher_t *(*sdb_store_matcher_op_cb)
460         (sdb_store_expr_t *, sdb_store_expr_t *);
462 /*
463  * sdb_store_parse_matcher_op:
464  * Parse a matcher operator and return a constructor for the respective
465  * matcher.
466  *
467  * Returns:
468  *  - matcher operator constructor on success
469  *  - NULL else
470  */
471 sdb_store_matcher_op_cb
472 sdb_store_parse_matcher_op(const char *op);
474 /*
475  * sdb_store_parse_object_type:
476  * Parse the type name of a stored object.
477  *
478  * Returns:
479  *  - the object type on success
480  *  - a negative value else
481  */
482 int
483 sdb_store_parse_object_type(const char *name);
485 /*
486  * sdb_store_parse_object_type_plural:
487  * Parse the type name (plural) of a stored object.
488  *
489  * Returns:
490  *  - the object type on success
491  *  - a negative value else
492  */
493 int
494 sdb_store_parse_object_type_plural(const char *name);
496 /*
497  * sdb_store_parse_field_name:
498  * Parse the name of a stored object's queryable field.
499  *
500  * Returns:
501  *  - the field id on success
502  *  - a negative value else
503  */
504 int
505 sdb_store_parse_field_name(const char *name);
507 /*
508  * sdb_store_dis_matcher:
509  * Creates a matcher matching the disjunction (logical OR) of two matchers.
510  */
511 sdb_store_matcher_t *
512 sdb_store_dis_matcher(sdb_store_matcher_t *left, sdb_store_matcher_t *right);
514 /*
515  * sdb_store_con_matcher:
516  * Creates a matcher matching the conjunction (logical AND) of two matchers.
517  */
518 sdb_store_matcher_t *
519 sdb_store_con_matcher(sdb_store_matcher_t *left, sdb_store_matcher_t *right);
521 /*
522  * sdb_store_con_matcher::
523  * Creates a matcher matching the inverse (logical NOT) of a matcher.
524  */
525 sdb_store_matcher_t *
526 sdb_store_inv_matcher(sdb_store_matcher_t *m);
528 /*
529  * sdb_store_matcher_matches:
530  * Check whether the specified matcher matches the specified store object. If
531  * specified, the filter will be used to preselect objects for further
532  * evaluation. It is applied to any object that's used during the evaluation
533  * of the matcher. Only those objects matching the filter will be considered.
534  *
535  * Note that the filter is applied to all object types (hosts, service,
536  * metric, attribute). Thus, any object-specific matchers are mostly unsuited
537  * for this purpose and, if used, may result in unexpected behavior.
538  *
539  * Returns:
540  *  - 1 if the object matches
541  *  - 0 else
542  */
543 int
544 sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_obj_t *obj,
545                 sdb_store_matcher_t *filter);
547 /*
548  * sdb_store_lookup_cb:
549  * Lookup callback. It is called for each matching object when looking up data
550  * in the store passing on the lookup filter and the specified user-data. The
551  * lookup aborts early if the callback returns non-zero.
552  */
553 typedef int (*sdb_store_lookup_cb)(sdb_store_obj_t *obj,
554                 sdb_store_matcher_t *filter, void *user_data);
556 /*
557  * sdb_store_scan:
558  * Look up objects of the specified type in the store. The specified callback
559  * function is called for each object in the store matching 'm'. The function
560  * performs a full scan of all objects stored in the database. If specified,
561  * the filter will be used to preselect objects for further evaluation. See
562  * the description of 'sdb_store_matcher_matches' for details.
563  *
564  * Returns:
565  *  - 0 on success
566  *  - a negative value else
567  */
568 int
569 sdb_store_scan(int type, sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
570                 sdb_store_lookup_cb cb, void *user_data);
572 /*
573  * Flags for serialization functions.
574  *
575  * By default, the full host object will be included in the serialized output.
576  * When specifying any of the flags, the respective information will be left
577  * out. The SKIP_EMPTY flags may be used to skip host objects entirely.
578  */
579 enum {
580         SDB_SKIP_ATTRIBUTES         = 1 << 0,
581         SDB_SKIP_SERVICES           = 1 << 1,
582         SDB_SKIP_METRICS            = 1 << 2,
583         SDB_SKIP_SERVICE_ATTRIBUTES = 1 << 3,
585         SDB_SKIP_ALL                = (1 << 8) - 1,
587         /* skip hosts if they do not reference any services/metrics */
588         SDB_SKIP_EMPTY_SERVICES     = 1 << 8,
589         SDB_SKIP_EMPTY_METRICS      = 1 << 9,
590 };
592 /*
593  * sdb_store_tojson:
594  * Serialize the entire store to JSON and append the result to the specified
595  * buffer. If specified, only objects matching the filter will be included in
596  * the result (see sdb_store_host_tojson for details).
597  *
598  * Returns:
599  *  - 0 on success
600  *  - a negative value on error
601  */
602 int
603 sdb_store_tojson(sdb_strbuf_t *buf, sdb_store_matcher_t *filter, int flags);
605 /*
606  * sdb_store_host_tojson:
607  * Serialize a host object to JSON and append the result to the specified
608  * buffer. If specified, only objects matching the filter will be included in
609  * the result. The filter is applied to each object individually and, thus,
610  * should not be of any object-type specific kind. The filter is never applied
611  * to the specified host object; the caller is responsible for this and for
612  * correctly handling skipped hosts.
613  *
614  * Returns:
615  *  - 0 on success
616  *  - a negative value on error
617  */
618 int
619 sdb_store_host_tojson(sdb_store_obj_t *host, sdb_strbuf_t *buf,
620                 sdb_store_matcher_t *filter, int flags);
622 /*
623  * sdb_store_json_formatter:
624  * Create a JSON formatter writing to the specified buffer.
625  */
626 sdb_store_json_formatter_t *
627 sdb_store_json_formatter(sdb_strbuf_t *buf);
629 /*
630  * sdb_store_json_emit:
631  * Serialize a single object to JSON adding it to the string buffer associated
632  * with the formatter object. The serialized object will not include
633  * attributes or any child objects. Instead, call the function again for each
634  * of those objects. All attributes have to be emitted before any other
635  * children types. Use sdb_store_json_emit_full() to emit a full (filtered)
636  * object.
637  *
638  * Note that the output might not be valid JSON before calling
639  * sdb_store_json_finish().
640  *
641  * Returns:
642  *  - 0 on success
643  *  - a negative value else
644  */
645 int
646 sdb_store_json_emit(sdb_store_json_formatter_t *f, sdb_store_obj_t *obj);
648 /*
649  * sdb_store_json_emit_full:
650  * Serialize a single object including it's attributes and all children to
651  * JSON, adding it to the string buffer associated with the formatter object.
652  * The filter, if specified, is applied to each attribute and child object.
653  * Only matching objects will be included in the output.
654  *
655  * Note that the output might not be valid JSON before calling
656  * sdb_store_json_finish().
657  *
658  * Returns:
659  *  - 0 on success
660  *  - a negative value else
661  */
662 int
663 sdb_store_json_emit_full(sdb_store_json_formatter_t *f, sdb_store_obj_t *obj,
664                 sdb_store_matcher_t *filter);
666 /*
667  * sdb_store_json_finish:
668  * Finish the JSON output. This function has to be called once after emiting
669  * all objects.
670  */
671 int
672 sdb_store_json_finish(sdb_store_json_formatter_t *f);
674 #ifdef __cplusplus
675 } /* extern "C" */
676 #endif
678 #endif /* ! SDB_CORE_STORE_H */
680 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */