--- /dev/null
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Create a database with the following configuration '...'
+2. Do the following action '....'
+3. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Machine/OS (please complete the following information):**
+ - OS: [e.g. Debian]
+ - Version [e.g. Buster, AMD64]
+
+**Additional context**
+Add any other context about the problem here.
--- /dev/null
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
--- /dev/null
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity
+and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+info@siridb.net.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series
+of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or
+permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within
+the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0, available at
+https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct
+enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at
+https://www.contributor-covenant.org/translations.
+siridb-server (2.0.45-0~tt1) unstable; urgency=medium
+
+ * New upstream release
+ - Compatibility with libcleri v1.x
+ - Prioritize replication
+
+ -- Jeroen van der Heijden <jeroen@cesbit.com> Thu, 13 Jan 2022 11:37:26 +0100
+
siridb-server (2.0.44-0~tt1) unstable; urgency=medium
* New upstream release
typedef struct siridb_access_repr_s siridb_access_repr_t;
#include <cleri/cleri.h>
+#include <siri/grammar/gramp.h>
uint32_t siridb_access_from_strn(const char * str, size_t n);
#define HELP_OFFSET CLERI_GID_HELP_ACCESS
#define HELP_COUNT CLERI_GID_HELP_TIMEZONES + 1 - HELP_OFFSET
+#if CLERI_VERSION_MAJOR >= 1
+typedef struct cleri_node_s cleri_children_t;
+#define cleri_gn(__child) (__child)
+
+#else
+#define cleri_gn(__child) (__child)->node
+#endif
+
-#if CLERI_VERSION_MINOR >= 12
+#if CLERI_VERSION_MAJOR >= 1 || CLERI_VERSION_MINOR >= 12
#if SIRIDB_IS64BIT
#define CLERI_NODE_DATA(__node) ((int64_t)(__node)->data)
#define CLERI_NODE_DATA_ADDR(__node) ((int64_t *) &(__node)->data)
#define SIRIDB_VERSION_MAJOR 2
#define SIRIDB_VERSION_MINOR 0
-#define SIRIDB_VERSION_PATCH 44
+#define SIRIDB_VERSION_PATCH 45
/*
* Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions.
cleri_children_t * current = node->children;
- while (current != NULL && current->node != NULL)
+ while (current != NULL && cleri_gn(current) != NULL)
{
cexpr = CEXPR_walk_node(
- current->node,
+ cleri_gn(current),
cexpr,
list,
condition,
* access.c - Access constants and functions.
*/
#include <siri/db/access.h>
+#include <siri/grammar/gramp.h>
#include <stdio.h>
#include <string.h>
while (children != NULL)
{
access_bit |= siridb_access_from_strn(
- children->node->str,
- children->node->len);
+ cleri_gn(children)->str,
+ cleri_gn(children)->len);
if (children->next == NULL)
break;
children = children->next->next;
#include <siri/db/median.h>
#include <siri/db/variance.h>
#include <siri/grammar/grammar.h>
+#include <siri/grammar/gramp.h>
#include <siri/db/re.h>
#include <vec/vec.h>
#include <stddef.h>
/* Loop over all aggregations */
while (1)
{
- gid = children->node->children->node->cl_obj->gid;
+ gid = cleri_gn(cleri_gn(children)->children)->cl_obj->gid;
switch (gid)
{
case CLERI_GID_F_LIMIT:
AGGR_NEW
{
- int64_t limit = CLERI_NODE_DATA(children->node->children->node->
- children->next->next->node);
+ int64_t limit = CLERI_NODE_DATA(
+ cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next));
if (limit <= 0)
{
aggr->limit = limit;
- gid = children->node->children->node->children->next->
- next->next->next->node->children->node->
- cl_obj->gid;
+ gid = cleri_gn(cleri_gn(cleri_gn(
+ cleri_gn(children)->children)->children->next->
+ next->next->next)->children)->cl_obj->gid;
switch (gid)
{
AGGR_NEW
{
cleri_node_t * onode;
- if ( children->node->children->node->children->
+ if ( cleri_gn(cleri_gn(children)->children)->children->
next->next->next->next == NULL)
{
aggr->filter_opr = CEXPR_EQ;
- onode = children->node->children->node->
- children->next->next->node->
- children->node;
+ onode = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next)->children);
}
else
{
aggr->filter_opr = cexpr_operator_fn(
- children->node->children->node->
- children->next->next->node->
- children->node);
- onode = children->node->children->node->
- children->next->next->next->node->
- children->node;
+ cleri_gn(cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next)->children));
+ onode = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next->next)->
+ children);
}
if (AGGREGATE_init_filter(aggr, onode, err_msg))
{
case CLERI_GID_F_DERIVATIVE:
AGGR_NEW
{
- cleri_node_t * dlist = children->node->children->
- node->children->next->next->node;
+ cleri_node_t * dlist = cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next);
- if (dlist->children != NULL && dlist->children->node != NULL)
+ if (dlist->children != NULL && cleri_gn(dlist->children) != NULL)
{
/* result is at least positive, checked earlier */
aggr->timespan =
- (double) CLERI_NODE_DATA(dlist->children->node);
+ (double) CLERI_NODE_DATA(cleri_gn(dlist->children));
if (!aggr->timespan)
{
{
/* result is always positive */
aggr->group_by = CLERI_NODE_DATA(
- dlist->children->next->next->node);
+ cleri_gn(dlist->children->next->next));
if (!aggr->group_by)
{
case CLERI_GID_F_FIRST:
case CLERI_GID_F_LAST:
AGGR_NEW
- if (children->node->children->node->children->
- next->next->next != NULL)
+ if (cleri_gn(cleri_gn(children)->children)
+ ->children->next->next->next != NULL)
{
/* result is always positive, checked earlier */
aggr->group_by = CLERI_NODE_DATA(
- children->node->children->node->
- children->next->next->node->children->
- node);
+ cleri_gn(cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children->next->next)->children));
if (!aggr->group_by)
{
*/
int siridb_aggregate_can_skip(cleri_children_t * children)
{
- cleri_node_t * nd = \
- children->node->children->node->children->node->children->node;
+ cleri_node_t * nd = cleri_gn(cleri_gn(cleri_gn(cleri_gn(children)
+ ->children)->children)->children);
switch (nd->cl_obj->gid)
{
MASTER_CHECK_ACCESSIBLE(siridb)
- cleri_node_t * group_node =
- query->nodes->node->children->next->node;
+ cleri_node_t * group_node = \
+ cleri_gn(query->nodes->node->children->next);
siridb_group_t * group;
char name[group_node->len - 1];
MASTER_CHECK_ACCESSIBLE(siridb)
- cleri_node_t * tag_node = query->nodes->node->children->next->node;
+ cleri_node_t * tag_node = cleri_gn(query->nodes->node->children->next);
siridb_tag_t * tag;
char name[tag_node->len - 1];
query_alter_t * q_alter = (query_alter_t *) query->data;
siridb_server_t * server = siridb_server_from_node(
siridb,
- query->nodes->node->children->next->node->children->node,
+ cleri_gn(cleri_gn(query->nodes->node->children->next)->children),
query->err_msg);
if (server == NULL)
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * user_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
query_alter_t * q_alter = (query_alter_t *) query->data;
siridb_user_t * user;
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * user_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
siridb_user_t * user;
char username[user_node->len - 1];
xstr_extract_string(username, user_node->str, user_node->len);
siridb_query_t * query = handle->data;
siridb_t * siridb = query->client->siridb;
query_list_t * qlist = (query_list_t *) query->data;
- int64_t limit = CLERI_NODE_DATA(query->nodes->node->children->next->node);
+ int64_t limit = CLERI_NODE_DATA(cleri_gn(query->nodes->node->children->next));
if (limit <= 0 || limit > siridb->list_limit)
{
{
siridb_query_t * query = handle->data;
query_select_t * q_select = query->data;
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
q_select->merge_as = malloc(node->len - 1);
if (q_select->merge_as == NULL)
if (IS_MASTER && query->nodes->node->children->next->next->next != NULL)
{
q_select->mlist = siridb_aggregate_list(
- query->nodes->node->children->next->next->next->node->
- children->node->children->next->node->children,
+ cleri_gn(cleri_gn(cleri_gn(
+ query->nodes->node->children->next->next->next)->
+ children)->children->next)->children,
query->err_msg);
if (q_select->mlist == NULL)
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * user_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
siridb_user_t * user;
char username[user_node->len - 1];
xstr_extract_string(username, user_node->str, user_node->len);
NULL : imap_new();
/* child is always the ',' and child->next the node */
- child = query->nodes->node->children->next->node->children;
+ child = cleri_gn(query->nodes->node->children->next)->children;
skip_get_points = siridb_aggregate_can_skip(child);
child = child->next;
{
siridb_query_t * query = handle->data;
siridb_t * siridb = query->client->siridb;
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
query_alter_t * q_alter = (query_alter_t *) query->data;
if (siridb_group_update_expression(
siridb_query_t * query = handle->data;
query_wrapper_t * q_wrapper = (query_wrapper_t *) query->data;
- if ( query->nodes->node->children->next->next->node->children->node->
+ if ( cleri_gn(cleri_gn(
+ query->nodes->node->children->next->next)->children)->
cl_obj->gid == CLERI_GID_K_TRUE)
{
q_wrapper->flags |= QUERIES_IGNORE_DROP_THRESHOLD;
siridb_query_t * query = handle->data;
siridb_t * siridb = query->client->siridb;
cleri_node_t * name_node =
- query->nodes->node->children->next->next->node;
+ cleri_gn(query->nodes->node->children->next->next);
char name[name_node->len - 1];
xstr_extract_string(name, name_node->str, name_node->len);
siridb_user_t * user = ((query_alter_t *) query->data)->via.user;
cleri_node_t * pw_node =
- query->nodes->node->children->next->next->node;
+ cleri_gn(query->nodes->node->children->next->next);
char password[pw_node->len - 1];
xstr_extract_string(password, pw_node->str, pw_node->len);
siridb_query_t * query = handle->data;
query_wrapper_t * q_wrapper = query->data;
- switch (query->nodes->node->children->node->cl_obj->gid)
+ switch (cleri_gn(query->nodes->node->children)->cl_obj->gid)
{
case CLERI_GID_K_UNION:
q_wrapper->update_cb = &imap_union_ref;
MASTER_CHECK_VERSION(siridb, "2.0.38")
cleri_node_t * tag_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
siridb_tag_t * tag;
char name[tag_node->len - 1];
xstr_extract_string(name, tag_node->str, tag_node->len);
MASTER_CHECK_VERSION(siridb, "2.0.38")
cleri_node_t * tag_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
siridb_tag_t * tag;
char name[tag_node->len - 1];
{
siridb_query_t * query = handle->data;
cexpr_t * cexpr =
- cexpr_from_node(query->nodes->node->children->next->node);
+ cexpr_from_node(cleri_gn(query->nodes->node->children->next));
if (cexpr == NULL)
{
{
qp_add_raw(
query->packer,
- (const unsigned char *) columns->node->str,
- columns->node->len);
+ (const unsigned char *) cleri_gn(columns)->str,
+ cleri_gn(columns)->len);
if (vec_append_safe(
&qlist->props,
- &columns->node->children->node->cl_obj->gid))
+ &cleri_gn(cleri_gn(columns)->children)->cl_obj->gid))
{
MEM_ERR_RET
}
siridb_query_t * query = handle->data;
((query_select_t *) query->data)->start_ts =
(uint64_t *) CLERI_NODE_DATA_ADDR(
- query->nodes->node->children->next->node);
+ cleri_gn(query->nodes->node->children->next));
SIRIPARSER_NEXT_NODE
}
((query_select_t *) query->data)->end_ts =
(uint64_t *) CLERI_NODE_DATA_ADDR(
- query->nodes->node->children->next->node);
+ cleri_gn(query->nodes->node->children->next));
SIRIPARSER_NEXT_NODE
}
query_select_t * q_select = query->data;
q_select->start_ts = (uint64_t *) CLERI_NODE_DATA_ADDR(
- query->nodes->node->children->next->node);
+ cleri_gn(query->nodes->node->children->next));
q_select->end_ts = (uint64_t *) CLERI_NODE_DATA_ADDR(
- query->nodes->node->children->next->next->next->node);
+ cleri_gn(query->nodes->node->children->next->next->next));
if (*q_select->start_ts > *q_select->end_ts)
{
siridb_query_t * query = handle->data;
siridb_t * siridb = query->client->siridb;
cleri_node_t * name_nd =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
cleri_node_t * for_nd =
- query->nodes->node->children->next->next->next->node;
+ cleri_gn(query->nodes->node->children->next->next->next);
MASTER_CHECK_ACCESSIBLE(siridb)
siridb_t * siridb = query->client->siridb;
siridb_user_t * user = ((query_alter_t *) query->data)->via.user;
cleri_node_t * user_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
/* both name and packer should be NULL at this point */
assert(user->name == NULL);
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * group_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
char name[group_node->len - 1];
siridb_t * siridb = query->client->siridb;
siridb_server_t * server = siridb_server_from_node(
siridb,
- query->nodes->node->children->next->node->children->node,
+ cleri_gn(cleri_gn(query->nodes->node->children->next)->children),
query->err_msg);
MASTER_CHECK_REINDEXING(siridb)
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * tag_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
char name[tag_node->len - 1];
MASTER_CHECK_ACCESSIBLE(siridb)
cleri_node_t * user_node =
- query->nodes->node->children->next->node;
+ cleri_gn(query->nodes->node->children->next);
char username[user_node->len - 1];
xstr_extract_string(username, user_node->str, user_node->len);
if (q_select->series_map->len)
{
q_select->alist = siridb_aggregate_list(
- query->nodes->node->children->node->children,
+ cleri_gn(query->nodes->node->children)->children,
query->err_msg);
if (q_select->alist == NULL)
{
{
siridb_query_t * query = handle->data;
siridb_server_t * server = ((query_alter_t *) query->data)->via.server;
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
siridb_t * siridb = query->client->siridb;
if (siridb->server == server || server->client != NULL)
siridb_server_t * server = ((query_alter_t *) query->data)->via.server;
- int backup_mode = query->nodes->node->children->next->next->node->
- children->node->cl_obj->gid == CLERI_GID_K_TRUE;
+ int backup_mode = cleri_gn(cleri_gn(
+ query->nodes->node->children->next->next)->
+ children)->cl_obj->gid == CLERI_GID_K_TRUE;
if (backup_mode ^ ((server->flags & SERVER_FLAG_BACKUP_MODE) != 0))
{
MASTER_CHECK_ACCESSIBLE(siridb)
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
double drop_threshold = xstr_to_double(node->str);
MASTER_CHECK_ACCESSIBLE(siridb)
MASTER_CHECK_VERSION(siridb, "2.0.35")
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
uint64_t expiration = (uint64_t) CLERI_NODE_DATA(node);
if (IS_MASTER && expiration)
MASTER_CHECK_ACCESSIBLE(siridb)
MASTER_CHECK_VERSION(siridb, "2.0.17")
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
uint64_t limit = xstr_to_uint64(node->str, node->len);
assert (query->data != NULL);
- cleri_node_t * node =
- query->nodes->node->children->next->next->node->children->node;
+ cleri_node_t * node = cleri_gn(cleri_gn(
+ query->nodes->node->children->next->next)->children);
int log_level;
{
siridb_query_t * query = handle->data;
siridb_server_t * server = ((query_alter_t *) query->data)->via.server;
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
siridb_t * siridb = query->client->siridb;
if (siridb->server == server || server->client != NULL)
MASTER_CHECK_ACCESSIBLE(siridb)
MASTER_CHECK_VERSION(siridb, "2.0.17")
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
uint64_t limit = xstr_to_uint64(node->str, node->len);
assert (query->data != NULL);
- cleri_node_t * node =
- query->nodes->node->children->next->next->node->children->node;
+ cleri_node_t * node = cleri_gn(cleri_gn(
+ query->nodes->node->children->next->next)->children);
char pipe_name[node->len - 1];
char * p_pipe_name = NULL;
static void exit_set_timezone(uv_async_t * handle)
{
siridb_query_t * query = handle->data;
- cleri_node_t * node = query->nodes->node->children->next->next->node;
+ cleri_node_t * node = cleri_gn(query->nodes->node->children->next->next);
siridb_t * siridb = query->client->siridb;
MASTER_CHECK_ACCESSIBLE(siridb)
siridb_user_t * db_user = query->client->origin;
SIRIPARSER_MASTER_CHECK_ACCESS(db_user, SIRIDB_ACCESS_SHOW)
- cleri_children_t * children =
- query->nodes->node->children->next->node->children;
+ cleri_children_t * children = cleri_gn(
+ query->nodes->node->children->next)->children;
siridb_props_cb prop_cb;
assert (query->packer == NULL);
/* set props.h (who_am_i) to current db_name */
props_set_who_am_i(db_user->name);
- if (children == NULL || children->node == NULL)
+ if (children == NULL || cleri_gn(children) == NULL)
{
/* show all properties */
int i;
while (1)
{
/* get the callback */
- prop_cb = props_get_cb(children->node->children->node->
+ prop_cb = props_get_cb(cleri_gn(cleri_gn(children)->children)->
cl_obj->gid - KW_OFFSET);
assert (prop_cb != NULL); /* all props are implemented */
prop_cb(siridb, query->packer, 1);
#include <siri/db/presuf.h>
#include <siri/err.h>
#include <siri/grammar/grammar.h>
+#include <siri/grammar/gramp.h>
#include <stdio.h>
#include <stdlib.h>
#include <xstr/xstr.h>
{
while (children != NULL)
{
- ps_children = children->node->children->node->children;
- switch (ps_children->node->cl_obj->gid)
+ ps_children = cleri_gn(cleri_gn(children)->children)->children;
+ switch (cleri_gn(ps_children)->cl_obj->gid)
{
case CLERI_GID_K_PREFIX:
- nps->prefix = malloc(ps_children->next->node->len + 1);
+ nps->prefix = malloc(cleri_gn(ps_children->next)->len + 1);
if (nps->prefix != NULL)
{
/* not critical if suffix is still NULL */
nps->len += xstr_extract_string(
nps->prefix,
- ps_children->next->node->str,
- ps_children->next->node->len);
+ cleri_gn(ps_children->next)->str,
+ cleri_gn(ps_children->next)->len);
}
break;
case CLERI_GID_K_SUFFIX:
- nps->suffix = malloc(ps_children->next->node->len + 1);
+ nps->suffix = malloc(cleri_gn(ps_children->next)->len + 1);
if (nps->suffix != NULL)
{
/* not critical if suffix is still NULL */
nps->len += xstr_extract_string(
nps->suffix,
- ps_children->next->node->str,
- ps_children->next->node->len);
+ cleri_gn(ps_children->next)->str,
+ cleri_gn(ps_children->next)->len);
}
break;
default:
#if SIRIDB_EXPR_ALLOC
query,
#endif
- query->pr->tree->children->node,
+ cleri_gn(query->pr->tree->children),
walker)))
{
switch (rc)
rc = QUERY_rebuild(
siridb,
- query->pr->tree->children->node,
+ cleri_gn(query->pr->tree->children),
buffer,
&size,
packer->alloc_size);
/* we can have nested integer and time expressions */
if ((rc = QUERY_time_expr(
- node->children->node,
+ cleri_gn(node->children),
walker,
buffer,
&size)))
size_t size = EXPR_MAX_SIZE;
if ((rc = QUERY_int_expr(
- node->children->node,
+ cleri_gn(node->children),
buffer,
&size)))
{
else
{
current = node->children;
- while (current != NULL && current->node != NULL)
+ while (current != NULL && cleri_gn(current) != NULL)
{
/*
* We should not simple walk because THIS has no
* cl_obj->cl_obj and THIS is save to skip.
*/
- while (current->node->cl_obj->tp == CLERI_TP_THIS)
+ while (cleri_gn(current)->cl_obj->tp == CLERI_TP_THIS)
{
- current = current->node->children;
+ current = cleri_gn(current)->children;
}
if ((rc = QUERY_walk(
#if SIRIDB_EXPR_ALLOC
query,
#endif
- current->node,
+ cleri_gn(current),
walker)))
{
return rc;
cleri_children_t * current;
current = node->children;
- while (current != NULL && current->node != NULL)
+ while (current != NULL && cleri_gn(current) != NULL)
{
if ((rc = QUERY_time_expr(
- current->node,
+ cleri_gn(current),
walker,
buf,
size)))
cleri_children_t * current;
current = node->children;
- while (current != NULL && current->node != NULL)
+ while (current != NULL && cleri_gn(current) != NULL)
{
if ((rc = QUERY_int_expr(
- current->node,
+ cleri_gn(current),
buf,
size)))
{
{
siridb_server_t * server = siridb_server_from_node(
siridb,
- node->children->node,
+ cleri_gn(node->children),
NULL);
if (server != NULL)
{
cleri_children_t * current;
current = node->children;
- while (current != NULL && current->node != NULL)
+ while (current != NULL && cleri_gn(current) != NULL)
{
if ((rc = QUERY_rebuild(
siridb,
- current->node,
+ cleri_gn(current),
buf,
size,
max_size)))
#include <siri/siri.h>
#include <stddef.h>
-#define REPLICATE_SLEEP 10 /* 10 milliseconds * active tasks */
+/* Changed in v2.0.45: from 10 -> 0 milliseconds to prioritize replication */
+#define REPLICATE_SLEEP 0 /* 0 milliseconds * active tasks */
#define REPLICATE_TIMEOUT 300000 /* 5 minutes */
static void REPLICATE_work(uv_timer_t * handle);
uv_timer_start(
replicate->timer,
REPLICATE_work,
- REPLICATE_SLEEP,
+ 10, /* initial sleep */
0);
}
else