function lfds711_btree_au_query

From liblfds.org
Revision as of 18:11, 16 February 2017 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

└───liblfds711
    ├───inc
    │   └───liblfds711
    │           lfds711_btree_addonly_unbalanced.h
    └───src
        └───lfds711_btree_addonly_unbalanced
                lfds711_btree_addonly_unbalanced_query.c

Opaque Structures

struct lfds711_btree_au_state;

Enums

enum lfds711_btree_au_query
{
  LFDS711_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT,
  LFDS711_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE
};

Prototype

void lfds711_btree_au_query( struct lfds711_btree_au_state *baus,
                             enum lfds711_btree_au_query query_type,
                             void *query_input,
                             void *query_output );

Parameters

struct lfds711_btree_au_state *baus

A pointer to an initialized struct lfds711_btree_au_state.

enum lfds711_btree_au_query query_type

Indicates which query to perform.

void *query_input

A pointer to input data for the query, where the data varies by query;
LFDS711_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT
query_input is NULL.
LFDS711_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE
This argument can be NULL, or can be a pointer to a struct lfds711_liblfds_validation_info, which specifies an expected min/max count, in which case validation also counts the number of elements and check they fall within the specified range. The walk is thread-safe, the count is not. See Notes.

void *query_output

A pointer to output store for the query, where the output varies by query;
LFDS711_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT
Points to a lfds711_pal_uint_t, which is set to the number of elements in the tree.
LFDS711_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE
Points to an enum lfds711_misc_validity, which is set to indicate the result of the validation operation.

Notes

All SINGLETHREADED queries can only be safely performed if no insert operations occur while the operation runs. If insert operations do occur during the execution of a SINGLETHREADED query, it is theoretically possible for the query to enter an infinite loop or to access random memory. Do not do this.

The LFDS711_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT query is non-atomic and walks the tree, counting elements; if new element are added during the count walk, they may not be seen. As such, the count is potentially inaccurate.

See Also