Reference Guide C API www.spreadconcepts.com


C API
Replicated Hash Table
Version 2.0


rht_get
  rht_code rht_get(rht r, rht_blob k, rht_pair **p, int flags);


Parameters
  r replica handle of replica being queried
  k key of key-value pair being searched for
  p constant reference to key-value pair corresponding to given k if found, else NULL
  flags RHT_DIRTY_READ (default) or RHT_CLEAN_READ
    RHT_GET_DELETES (optional)


Return Values
  0 on success
  non-zero for error


Description
 

rht_get performs a lookup of a key on a specified replica.

If an equivalent key exists in the replica, then a reference (a rht_pair pointer) to the corresponding key-value pair will be returned.

This reference allows you to inspect the key, value and LTS of a key-value pair entry. Such a reference to a constant key-value pair will remain valid, and therefore in memory, until rht_pair_fini is called on it.

Use RHT_GET_DELETES to include deleted entries in the search.

Use of the default RHT_DIRTY_READ flag will cause rht_get search immediately without waiting for any locally generated updates to be applied. Whereas, specifying the RHT_CLEAN_READ will first apply all locally generated updates, and then perform the search.

***Note that the data a key-value pair entry (rht_pair) references will never change, even if the entry is changed in the dictionary. A rht_pair references constant data. If no matching entry is found, success is returned but p will be set to NULL.****



Requirements
  Header: Declared in rht.h
Library: Use rht.lib
Version: 2.0


Also See
  RHT reference guide


Copyright © 2004, Spread Concepts LLC, All rights reserved