All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Enumerations | Functions
HyperLogLog Operations

Description

HyperLogLog (HLL) operations.

HyperLogLog operations on HLL items nested in lists/maps are not currently supported by the server. The as_cdt_ctx argument in HLL operations must be set to NULL.

+ Collaboration diagram for HyperLogLog Operations:

Data Structures

struct  as_hll_policy
 

Enumerations

enum  as_hll_write_flags {
  AS_HLL_WRITE_DEFAULT = 0, AS_HLL_WRITE_CREATE_ONLY = 1, AS_HLL_WRITE_UPDATE_ONLY = 2, AS_HLL_WRITE_NO_FAIL = 4,
  AS_HLL_WRITE_ALLOW_FOLD = 8
}
 

Functions

static void as_hll_policy_init (as_hll_policy *policy)
 
static void as_hll_policy_set_write_flags (as_hll_policy *policy, as_hll_write_flags flags)
 
static bool as_operations_hll_add (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, as_list *list, int index_bit_count)
 
AS_EXTERN bool as_operations_hll_add_mh (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, as_list *list, int index_bit_count, int mh_bit_count)
 
static bool as_operations_hll_describe (as_operations *ops, const char *name, as_cdt_ctx *ctx)
 
AS_EXTERN bool as_operations_hll_fold (as_operations *ops, const char *name, as_cdt_ctx *ctx, int index_bit_count)
 
static bool as_operations_hll_get_count (as_operations *ops, const char *name, as_cdt_ctx *ctx)
 
static bool as_operations_hll_get_intersect_count (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_list *list)
 
static bool as_operations_hll_get_similarity (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_list *list)
 
static bool as_operations_hll_get_union (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_list *list)
 
static bool as_operations_hll_get_union_count (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_list *list)
 
static bool as_operations_hll_init (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, int index_bit_count)
 
AS_EXTERN bool as_operations_hll_init_mh (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, int index_bit_count, int mh_bit_count)
 
AS_EXTERN bool as_operations_hll_refresh_count (as_operations *ops, const char *name, as_cdt_ctx *ctx)
 
AS_EXTERN bool as_operations_hll_set_union (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, as_list *list)
 
static bool as_operations_hll_update (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_hll_policy *policy, as_list *list)
 

Enumeration Type Documentation

HyperLogLog write flags.

Enumerator
AS_HLL_WRITE_DEFAULT 

Default. Allow create or update.

AS_HLL_WRITE_CREATE_ONLY 

If the bin already exists, the operation will be denied. If the bin does not exist, a new bin will be created.

AS_HLL_WRITE_UPDATE_ONLY 

If the bin already exists, the bin will be overwritten. If the bin does not exist, the operation will be denied.

AS_HLL_WRITE_NO_FAIL 

Do not raise error if operation is denied.

AS_HLL_WRITE_ALLOW_FOLD 

Allow the resulting set to be the minimum of provided index bits. Also, allow the usage of less precise HLL algorithms when minhash bits of all participating sets do not match.

Definition at line 45 of file as_hll_operations.h.

Function Documentation

static void as_hll_policy_init ( as_hll_policy policy)
inlinestatic

Initialize HLL policy to default.

Definition at line 128 of file as_hll_operations.h.

References AS_HLL_WRITE_DEFAULT, and as_hll_policy::flags.

static void as_hll_policy_set_write_flags ( as_hll_policy policy,
as_hll_write_flags  flags 
)
inlinestatic

Set HLL write flags in HLL policy.

Definition at line 139 of file as_hll_operations.h.

References as_hll_policy::flags.

static bool as_operations_hll_add ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
as_list list,
int  index_bit_count 
)
inlinestatic

Create HLL add operation with index bits. Server adds values to HLL set. If HLL bin does not exist, use bit counts to create HLL bin. Server returns number of entries that caused HLL to update a register.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
listList of values to be added.
index_bit_countNumber of index bits. Must be between 4 and 16 inclusive.

Definition at line 220 of file as_hll_operations.h.

References as_operations_hll_add_mh().

AS_EXTERN bool as_operations_hll_add_mh ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
as_list list,
int  index_bit_count,
int  mh_bit_count 
)

Create HLL add operation with minhash bits. Server adds values to HLL set. If HLL bin does not exist, use bit counts to create HLL bin. Server returns number of entries that caused HLL to update a register.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
listList of values to be added.
index_bit_countNumber of index bits. Must be between 4 and 16 inclusive.
mh_bit_countNumber of min hash bits. Must be between 4 and 51 inclusive. Also, index_bit_count + mh_bit_count must be <= 64.
static bool as_operations_hll_describe ( as_operations ops,
const char *  name,
as_cdt_ctx ctx 
)
inlinestatic

Create HLL describe operation. Server returns index and minhash bit counts used to create HLL bin in a list of integers. The list size is 2.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.

Definition at line 401 of file as_hll_operations.h.

References AS_HLL_OP_DESCRIBE, and as_operations_hll_read().

AS_EXTERN bool as_operations_hll_fold ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
int  index_bit_count 
)

Create HLL fold operation. Servers folds index_bit_count to the specified value. This can only be applied when minhash bit count on the HLL bin is 0. Server does not return a value.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
index_bit_countNumber of index bits. Must be between 4 and 16 inclusive.
static bool as_operations_hll_get_count ( as_operations ops,
const char *  name,
as_cdt_ctx ctx 
)
inlinestatic

Create HLL get count operation. Server returns estimated number of elements in the HLL bin.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.

Definition at line 308 of file as_hll_operations.h.

References AS_HLL_OP_COUNT, and as_operations_hll_read().

static bool as_operations_hll_get_intersect_count ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_list list 
)
inlinestatic

Create HLL get intersect count operation. Server returns estimated number of elements that would be contained by the intersection of these HLL objects.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
listList of HLL as_bytes objects.

Definition at line 365 of file as_hll_operations.h.

References AS_HLL_OP_INTERSECT_COUNT, and as_operations_hll_read_list().

static bool as_operations_hll_get_similarity ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_list list 
)
inlinestatic

Create HLL get similarity operation. Server returns estimated similarity of these HLL objects. Return type is a double.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
listList of HLL as_bytes objects.

Definition at line 383 of file as_hll_operations.h.

References AS_HLL_OP_SIMILARITY, and as_operations_hll_read_list().

static bool as_operations_hll_get_union ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_list list 
)
inlinestatic

Create HLL get union operation. Server returns an HLL object that is the union of all specified HLL objects in the list with the HLL bin.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
listList of HLL as_bytes objects.

Definition at line 327 of file as_hll_operations.h.

References AS_HLL_OP_GET_UNION, and as_operations_hll_read_list().

static bool as_operations_hll_get_union_count ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_list list 
)
inlinestatic

Create HLL get union count operation. Server returns estimated number of elements that would be contained by the union of these HLL objects.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
listList of HLL as_bytes objects.

Definition at line 346 of file as_hll_operations.h.

References AS_HLL_OP_UNION_COUNT, and as_operations_hll_read_list().

static bool as_operations_hll_init ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
int  index_bit_count 
)
inlinestatic

Create HLL init operation. Server creates a new HLL or resets an existing HLL. Server does not return a value.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
index_bit_countNumber of index bits. Must be between 4 and 16 inclusive.

Definition at line 177 of file as_hll_operations.h.

References as_operations_hll_init_mh().

AS_EXTERN bool as_operations_hll_init_mh ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
int  index_bit_count,
int  mh_bit_count 
)

Create HLL init operation with minhash bits. Server creates a new HLL or resets an existing HLL. Server does not return a value.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
index_bit_countNumber of index bits. Must be between 4 and 16 inclusive.
mh_bit_countNumber of min hash bits. Must be between 4 and 51 inclusive. Also, index_bit_count + mh_bit_count must be <= 64.
AS_EXTERN bool as_operations_hll_refresh_count ( as_operations ops,
const char *  name,
as_cdt_ctx ctx 
)

Create HLL refresh operation. Server updates the cached count (if stale) and returns the count.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
AS_EXTERN bool as_operations_hll_set_union ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
as_list list 
)

Create HLL set union operation. Server sets union of specified HLL objects with HLL bin. Server does not return a value.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
listList of HLL as_bytes objects.
static bool as_operations_hll_update ( as_operations ops,
const char *  name,
as_cdt_ctx ctx,
as_hll_policy policy,
as_list list 
)
inlinestatic

Create HLL update operation. This operation assumes HLL bin already exists. Server adds values to HLL set. Server returns number of entries that caused HLL to update a register.

Parameters
opsOperations array.
nameName of bin.
ctxMust set to NULL.
policyWrite policy. Use NULL for default.
listList of values to be added.

Definition at line 241 of file as_hll_operations.h.

References as_operations_hll_add_mh().