Reference Guide C API www.spreadconcepts.com


Programmer's Reference Guide
Replicated Hash Table
Version 2.0


Return Codes & Error Codes

All of the functions that can fail when legally called return an integer error code, a rht_code. On success these functions return zero (RHT_SUCCESS), on failure they return a non-zero error code describing the failure.

The following error codes can be generated by almost any RHT function call. Some error codes (marked in red with an X) are permanent and any subsequent calls (other than rht_fini) on the replica handle in question will consistently fail with the same error code.

Permanent Error
Error
Description
 
RHT_SUCCESS Success
X
RHT_UNKNOWN_ERROR An unexpected error occurred. This condition represents either a bug in RHT or that it is not configured properly. This could occur, for example, if the Spread daemon returned an error code that RHT does not recognize due to extensions to the Spread library
 
RHT_LIB_INIT_FAILURE The call to rht_lib_init failed and the RHT library cannot be used.
X
RHT_INVALID_HANDLE The caller passed an invalid RHT handle. This can occur if the caller is using an un-initialized handle or if rht_fini has already been called on the handle in question
X
RHT_COMMUNICATION_FAILURE The connection with the Spread daemon has been lost for this replica.
X
RHT_SPAWN_THREAD_FAILURE RHT was unable to spawn a thread due to a system failure.
X
RHT_ALLOC_FAILURE RHT was unable to allocate needed memory space due to a system failure.
X
RHT_INIT_FAILURE RHT was unable to perform a necessary initialization (e.g. - mutex initialization) due to a system failure.
X
RHT_TOO_MANY_OPS Too many update operations have been performed on the RHT in question. Currently, RHT only allows for approximately 2^64 update operations to be performed on a particular rht.
 
RHT_ILLEGAL_PARAMETER The caller passed an illegal parameter, such as a negative buffer size, to a RHT function.
 
RHT_KEYVAL_TOO_LARGE The caller passed a key-val pair to rht_put that was too large. Default RHT configurations only allow for key-val pairs smaller than approximately 100KB. Please see the RHT user guide on how to increase this compile time limit.
 
RHT_NOT_OWNER This function requires the caller to own the lock on the replica (via rht_grab) before calling and the caller did not.
 
RHT_WOULD_DEADLOCK Certain very rare conditions can cause a deadlock to occur. For example, initiating many update operations while holding a replica lock or in a callback function could eventually cause a deadlock. All such situations are detected and this error is returned.
 
RHT_DIRTY_READ_ONLY While in either in a callback function or holding the replica lock you can only have dirty read access to the replica. Forcing clean read semantics can cause a deadlock if there are outstanding updates to be applied, because the caller is blocking any updates from being made. For example, specifying the RHT_CLEAN_READ flag in a call to rht_get while holding the lock or in a callback can cause this error if there are outstanding operations to be applied initiated at this replica. This is because no updates can be applied while the lock is being held.
 


Copyright © 2004, Spread Concepts LLC, All rights reserved