Reference Guide C API www.spreadconcepts.com


C API
Replicated Hash Table
Version 2.0


rht_fini
  rht_code rht_fini(rht r, int flags);


Parameters
  r replica handle
  flags RHT_DIRTY_READ (default) or RHT_CLEAN_READ


Return Values
  0 on success
  non-zero for error


Description
 

rht_fini is used to "shut down" a replica, reclaim some of its resources and mark its handle as invalid when you are done with it.

rht_fini forces the replica r to disconnect from Spread (if it has not already due to permanent errors) and causes any threads in RHT functions on this replica to return quickly -- some of these threads may return a RHT_INVALID_HANLDE error.

At about the time the caller enters rht_fini, all subsequent RHT calls on this replica handle will fail with a RHT_INVALID_HANDLE error.

You may call rht_fini on a replicant handle at any time and as many times as you wish! Only the first such call will have any effect. This can reduce the thread synchronization headache caused when multiple threads share a single replica: any/all of these threads can call rht_fini at any time and the other threads will "safely" receive RHT_INVALID_HANDLE errors, indicating that this replica is no longer valid.

To reclaim ALL of the resources associated with a given replica you need to call rht_fini on the replicant handle AND rht_snap_fini on any existing valid snapshots taken of the replica. Once these conditions are met and all threads have left RHT procedures on the replica, its on_trash_cb will fire.

Use of the default RHT_DIRTY_READ flag will cause the shut down to occur 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 shut down the replica.

Note, that key-value pair entries from a replica will continue to persist until you call rht_pair_fini on any rht_pair you still have from that replica. As you perform each of these operations the amount of resources consumed is reduced.



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