![]() |
Go to the source code of this file.
Data Structures | |
struct | as_predexp_base |
Typedefs | |
typedef void(* | as_predexp_base_dtor_fn )(struct as_predexp_base_s *) |
typedef size_t(* | as_predexp_base_size_fn )(struct as_predexp_base_s *) |
typedef uint8_t *(* | as_predexp_base_write_fn )(struct as_predexp_base_s *, uint8_t *p) |
typedef void(* as_predexp_base_dtor_fn)(struct as_predexp_base_s *) |
Definition at line 25 of file as_predexp.h.
typedef size_t(* as_predexp_base_size_fn)(struct as_predexp_base_s *) |
Definition at line 26 of file as_predexp.h.
typedef uint8_t*(* as_predexp_base_write_fn)(struct as_predexp_base_s *, uint8_t *p) |
Definition at line 27 of file as_predexp.h.
as_predexp_base* as_predexp_and | ( | uint16_t | nexpr | ) |
Create an AND logical predicate expression.
The AND predicate expression returns true if all of its children are true.
The nexpr parameter specifies how many children to pop off the expression stack. These children must be "logical" expressions and not "value" expressions.
For example, the following sequence of predicate expressions selects records where the value of bin "c" is between 11 and 20 inclusive:
nexpr | The number of child expressions to AND. |
as_predexp_base* as_predexp_geojson_bin | ( | char const * | binname | ) |
Create an GeoJSON bin value predicate expression.
The GeoJSON bin predicate expression pushes a single GeoJSON bin value extractor onto the expression stack.
For example, the following sequence of predicate expressions selects records where a point in bin "loc" is inside the specified polygon:
binname | The name of the bin. |
as_predexp_base* as_predexp_geojson_contains | ( | ) |
Create an GeoJSON Regions-Containing-Point logical predicate expression.
The Regions-Containing-Point (contains) expression pops two children off the expression stack and checks to see if a child GeoJSON region contains a specified GeoJSON point. The left child (pushed earlier) must contain a GeoJSON value specifying a possibly enclosing region. The right child (pushed later) must be a GeoJSON value containing a point.
If the value of the left child is unknown because a specified bin does not exist or contains a value of the wrong type the result of the contains expression is false.
For example, the following sequence of predicate expressions selects records where a region in bin "rgn" contains the specified query point:
as_predexp_base* as_predexp_geojson_value | ( | char const * | value | ) |
Create a constant GeoJSON value predicate expression.
The GeoJSON value predicate expression pushes a single constant GeoJSON value onto the expression stack.
For example, the following sequence of predicate expressions selects records where a point in bin "loc" is inside the specified polygon:
value | The GeoJSON string value. |
as_predexp_base* as_predexp_geojson_var | ( | char const * | varname | ) |
Create an GeoJSON iteration variable (value) predicate expression.
The GeoJSON iteration variable is used in the subexpression child of a list or map iterator and takes the value of each element in the collection as it is traversed.
varname | The name of the iteration variable. |
as_predexp_base* as_predexp_geojson_within | ( | ) |
Create an GeoJSON Points-in-Region logical predicate expression.
The Points-in-Region (within) expression pops two children off the expression stack and checks to see if a child GeoJSON point is inside a specified GeoJSON region. The left child (pushed earlier) must contain a GeoJSON value specifying a point. The right child (pushed later) must be a GeoJSON value containing a region.
If the value of the left child is unknown because a specified bin does not exist or contains a value of the wrong type the result of the within expression is false.
For example, the following sequence of predicate expressions selects records where a point in bin "loc" is inside the specified polygon:
as_predexp_base* as_predexp_integer_bin | ( | char const * | binname | ) |
Create an integer bin value predicate expression.
The integer bin predicate expression pushes a single integer bin value extractor onto the expression stack.
For example, the following sequence of predicate expressions selects records where the value of bin "c" is between 11 and 20 inclusive:
binname | The name of the bin. |
as_predexp_base* as_predexp_integer_equal | ( | ) |
Create an integer comparison logical predicate expression.
The integer comparison expressions pop a pair of value expressions off the expression stack and compare them. The deeper of the two child expressions (pushed earlier) is considered the left side of the expression and the shallower (pushed later) is considered the right side.
If the value of either of the child expressions is unknown because a specified bin does not exist or contains a value of the wrong type the result of the comparison is false. If a true outcome is desirable in this situation use the complimentary comparison and enclose in a logical NOT.
For example, the following sequence of predicate expressions selects records that have bin "foo" greater than 42:
as_predexp_base* as_predexp_integer_greater | ( | ) |
as_predexp_base* as_predexp_integer_greatereq | ( | ) |
as_predexp_base* as_predexp_integer_less | ( | ) |
as_predexp_base* as_predexp_integer_lesseq | ( | ) |
as_predexp_base* as_predexp_integer_unequal | ( | ) |
as_predexp_base* as_predexp_integer_value | ( | int64_t | value | ) |
Create a constant integer value predicate expression.
The integer value predicate expression pushes a single constant integer value onto the expression stack.
For example, the following sequence of predicate expressions selects records where the value of bin "c" is between 11 and 20 inclusive:
value | The integer value. |
as_predexp_base* as_predexp_integer_var | ( | char const * | varname | ) |
Create an integer iteration variable (value) predicate expression.
The integer iteration variable is used in the subexpression child of a list or map iterator and takes the value of each element in the collection as it is traversed.
For example, the following sequence of predicate expressions selects records where the list contains a value of 42:
varname | The name of the iteration variable. |
as_predexp_base* as_predexp_list_bin | ( | char const * | binname | ) |
Create a list bin value predicate expression.
The list bin predicate expression pushes a single list bin value extractor onto the expression stack. List bin values may be used with list iteration expressions to evaluate a subexpression for each of the elements of the list.
For example, the following sequence of predicate expressions selects records where one of the list items is "cat":
binname | The name of the bin. |
as_predexp_base* as_predexp_list_iterate_and | ( | char const * | varname | ) |
Create an list iteration AND logical predicate expression.
The list iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a list bin. The list iteration traverses the list and repeatedly evaluates the subexpression substituting each list element's value into the matching iteration variable. The result of the iteration expression is a logical AND of all of the individual element evaluations.
If the list bin contains zero elements as_predexp_list_iterate_and will return true. This is useful when testing for exclusion (see example).
For example, the following sequence of predicate expressions selects records where none of the list items is "cat":
varname | The name of the list item iteration variable. |
as_predexp_base* as_predexp_list_iterate_or | ( | char const * | varname | ) |
Create an list iteration OR logical predicate expression.
The list iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a list bin. The list iteration traverses the list and repeatedly evaluates the subexpression substituting each list element's value into the matching iteration variable. The result of the iteration expression is a logical OR of all of the individual element evaluations.
If the list bin contains zero elements as_predexp_list_iterate_or will return false.
For example, the following sequence of predicate expressions selects records where one of the list items is "cat":
varname | The name of the list item iteration variable. |
as_predexp_base* as_predexp_map_bin | ( | char const * | binname | ) |
Create a map bin value predicate expression.
The map bin predicate expression pushes a single map bin value extractor onto the expression stack. Map bin values may be used with map iteration expressions to evaluate a subexpression for each of the elements of the map.
For example, the following sequence of predicate expressions selects records where the map contains a key of "cat":
binname | The name of the bin. |
as_predexp_base* as_predexp_mapkey_iterate_and | ( | char const * | varname | ) |
Create an map key iteration AND logical predicate expression.
The mapkey iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a map bin. The mapkey iteration traverses the map and repeatedly evaluates the subexpression substituting each map key value into the matching iteration variable. The result of the iteration expression is a logical AND of all of the individual element evaluations.
If the map bin contains zero elements as_predexp_mapkey_iterate_and will return true. This is useful when testing for exclusion (see example).
For example, the following sequence of predicate expressions selects records where none of the map keys is "cat":
varname | The name of the map key iteration variable. |
as_predexp_base* as_predexp_mapkey_iterate_or | ( | char const * | varname | ) |
Create an map key iteration OR logical predicate expression.
The mapkey iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a map bin. The mapkey iteration traverses the map and repeatedly evaluates the subexpression substituting each map key value into the matching iteration variable. The result of the iteration expression is a logical OR of all of the individual element evaluations.
If the map bin contains zero elements as_predexp_mapkey_iterate_or will return false.
For example, the following sequence of predicate expressions selects records where one of the map keys is "cat":
varname | The name of the map key iteration variable. |
as_predexp_base* as_predexp_mapval_iterate_and | ( | char const * | varname | ) |
Create an map value iteration AND logical predicate expression.
The mapval iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a map bin. The mapval iteration traverses the map and repeatedly evaluates the subexpression substituting each map value into the matching iteration variable. The result of the iteration expression is a logical AND of all of the individual element evaluations.
If the map bin contains zero elements as_predexp_mapval_iterate_and will return true. This is useful when testing for exclusion (see example).
For example, the following sequence of predicate expressions selects records where none of the map values is 0:
varname | The name of the map value iteration variable. |
as_predexp_base* as_predexp_mapval_iterate_or | ( | char const * | varname | ) |
Create an map value iteration OR logical predicate expression.
The mapval iteration expression pops two children off the expression stack. The left child (pushed earlier) must contain a logical subexpression containing one or more matching iteration variable expressions. The right child (pushed later) must specify a map bin. The mapval iteration traverses the map and repeatedly evaluates the subexpression substituting each map value into the matching iteration variable. The result of the iteration expression is a logical OR of all of the individual element evaluations.
If the map bin contains zero elements as_predexp_mapval_iterate_or will return false.
For example, the following sequence of predicate expressions selects records where one of the map values is 0:
varname | The name of the map value iteration variable. |
as_predexp_base* as_predexp_not | ( | ) |
Create a NOT logical predicate expression.
The NOT predicate expression returns true if its child is false.
The NOT expression pops a single child off the expression stack. This child must be a "logical" expression and not a "value" expression.
For example, the following sequence of predicate expressions selects records where the value of bin "pet" is not "dog".
as_predexp_base* as_predexp_or | ( | uint16_t | nexpr | ) |
Create an OR logical predicate expression.
The OR predicate expression returns true if any of its children are true.
The nexpr parameter specifies how many children to pop off the expression stack. These children must be "logical" expressions and not "value" expressions.
For example, the following sequence of predicate expressions selects records where the value of bin "pet" is "cat" or "dog".
nexpr | The number of child expressions to OR. |
as_predexp_base* as_predexp_rec_device_size | ( | ) |
Create a record device size metadata value predicate expression.
The record device size expression assumes the value of the size in bytes that the record occupies on device storage. For non-persisted records, this value is 0.
For example, the following sequence of predicate expressions selects records whose device storage size is larger than 65K:
as_predexp_base* as_predexp_rec_digest_modulo | ( | ) |
Create a digest modulo record metadata value predicate expression.
The digest modulo expression assumes the value of 4 bytes of the record's key digest modulo it's argument.
For example, the following sequence of predicate expressions selects records that have digest(key) % 3 == 1):
as_predexp_base* as_predexp_rec_last_update | ( | ) |
Create a last update record metadata value predicate expression.
The record last update expression assumes the value of the number of nanoseconds since the unix epoch that the record was last updated.
For example, the following sequence of predicate expressions selects records that have been updated after an timestamp:
as_predexp_base* as_predexp_rec_void_time | ( | ) |
Create a void time record metadata value predicate expression.
The record void time expression assumes the value of the number of nanoseconds since the unix epoch when the record will expire. The special value of 0 means the record will not expire.
For example, the following sequence of predicate expressions selects records that have void time set to 0 (no expiration):
as_predexp_base* as_predexp_string_bin | ( | char const * | binname | ) |
Create an string bin value predicate expression.
The string bin predicate expression pushes a single string bin value extractor onto the expression stack.
For example, the following sequence of predicate expressions selects records where the value of bin "pet" is "cat" or "dog":
binname | The name of the bin. |
as_predexp_base* as_predexp_string_equal | ( | ) |
Create an string comparison logical predicate expression.
The string comparison expressions pop a pair of value expressions off the expression stack and compare them. The deeper of the two child expressions (pushed earlier) is considered the left side of the expression and the shallower (pushed later) is considered the right side.
If the value of either of the child expressions is unknown because a specified bin does not exist or contains a value of the wrong type the result of the comparison is false. If a true outcome is desirable in this situation use the complimentary comparison and enclose in a logical NOT.
For example, the following sequence of predicate expressions selects records that have bin "pet" equal to "cat":
as_predexp_base* as_predexp_string_regex | ( | uint32_t | cflags | ) |
Create an string regular expression logical predicate expression.
The string regex expression pops two children off the expression stack and compares a child value expression to a regular expression. The left child (pushed earlier) must contain the string value to be matched. The right child (pushed later) must be a string value containing a valid regular expression..
If the value of the left child is unknown because a specified bin does not exist or contains a value of the wrong type the result of the regex match is false.
The cflags argument is passed to the regcomp library routine on the server. Useful values include REG_EXTENDED, REG_ICASE and REG_NEWLINE.
For example, the following sequence of predicate expressions selects records that have bin "hex" value ending in '1' or '2':
cflags | POSIX regex cflags value. |
as_predexp_base* as_predexp_string_unequal | ( | ) |
as_predexp_base* as_predexp_string_value | ( | char const * | value | ) |
Create a constant string value predicate expression.
The string value predicate expression pushes a single constant string value onto the expression stack.
For example, the following sequence of predicate expressions selects records where the value of bin "pet" is "cat" or "dog":
value | The string value. |
as_predexp_base* as_predexp_string_var | ( | char const * | varname | ) |
Create an string iteration variable (value) predicate expression.
The string iteration variable is used in the subexpression child of a list or map iterator and takes the value of each element in the collection as it is traversed.
For example, the following sequence of predicate expressions selects records where one of the list items is "cat":
varname | The name of the iteration variable. |