enum lfds711_hash_a_query

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_hash_addonly.h

Enum

enum lfds711_hash_a_query
{
  LFDS711_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT,
  LFDS711_HASH_A_QUERY_SINGLETHREADED_VALIDATE
};

Values

LFDS711_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT

Performs a single-threaded count of the number of elements in the hash. The count will only be guaranteed to be accurate if no other threads are adding elements to the hash during the count. If other threads are adding elements, they will only be counted if the hash iteration which is counting elements has not yet reached those new elements.

LFDS711_HASH_A_QUERY_SINGLETHREADED_VALIDATE

Validates the hash, by issuing a validation query on every btree in the hash. Additionally, if given an expected range of the number of elements in the hash, counts the number of elements in the hash and checks they fall within the expected range. The validation queries to the btrees are thread-safe, but the count is not and if other threads are adding elements to the hash, they will not necessarily be counted, and so this could then lead to the count being improperly outside the count range specified by the caller.

Notes

By singlethreaded, it is meant to say that the action performed will only be accurate if there are no threads performing write operations (i.e. linking new elements) for the duration of the operation.

See Also