kv_lob_get_for_write()

#include <kvstore.h>

kv_error_t 
kv_lob_get_for_write(kv_store_t *store,
                     const kv_key_t *key,
                     kv_lob_handle_t **handle,
                     kv_presence_enum if_presence,
                     kv_durability_t durability,
                     kv_timeout_t timeout_ms); 

Allocates and configures a LOB handle for writing a Large Object to the store. If the handle is successfully created, KV_SUCCESS is returned; otherwise, KV_NO_MEMORY.

Upon opening this handle, you perform the actual write operation using kv_lob_put_from_file(). Note that no method currently exists for writing a large object directly from memory.

The LOB handle allocated by this function must be released using kv_lob_release_handle().

Parameters

  • store

    The store parameter is the handle to the store where you want to write the Large Object.

  • key

    The key parameter is the LOB record's key. Note that the final path component used here must specify the LOB suffix configured for the store, or the write operation will fail. The LOB suffix is configured for your store using kv_config_set_lob_suffix().

  • handle

    The handle parameter references memory into which a pointer to the allocated LOB handle (structure) is copied.

  • if_presence

    The if_presence parameter describes the conditions under which the record can be written to the store, based on the presence or absence of the record in the store. For example, KV_IF_PRESENT means that the record can only be written to the store if a version of the record already exists there.

    For a list of all the available presence options, see kv_presence_enum.

  • durability

    The durability parameter provides the durability guarantee to be used with this write operation. Durability guarantees are created using kv_create_durability().

  • timeout_ms

    The timeout_ms parameter provides an upper bound on the time interval for writing each chunk of the LOB. (Large Objects are written to the store in multiple chunks.) A best effort is made not to exceed the specified limit. If zero, the default LOB timeout value defined for the store is used. This value is set usingkv_config_set_lob_timeout().