Function tskit::bindings::kastore_put
source · pub unsafe extern "C" fn kastore_put(
self_: *mut kastore_t,
key: *const c_char,
key_len: usize,
array: *const c_void,
array_len: usize,
type_: c_int,
flags: c_int
) -> c_int
Expand description
@brief Insert the specified key-array pair into the store.
@rst
A key with the specified length is inserted into the store and associated with
an array of the specified type and number of elements. The contents of the
specified key and array are copied unless the KAS_BORROWS_ARRAY flag is specified.
If KAS_BORROWS_ARRAY is specified the array buffer must persist until the
kastore is closed.
Keys can be any sequence of bytes but must be at least one byte long and be
unique. There is no restriction on the contents of arrays. This is the most
general form of put
operation in kastore; when the type of the array
is known and the keys are standard C strings, it is usually more convenient
to use the :ref:typed variants <sec_c_api_typed_put>
of this function.
@endrst
@param self A pointer to a kastore object. @param key The key. @param key_len The length of the key. @param array The array. @param array_len The number of elements in the array. @param type The type of the array. @param flags The insertion flags, only KAS_BORROWS_ARRAY or 0 is a valid. @return Return 0 on success or a negative value on failure.