Exemple #1
0
/**
 * Store the per-transaction data for use with the operator.
 *
 * @param[in] m This module.
 * @param[in,out] tx Transaction to store the data in.
 * @param[in] instance_data Pointer to the operator instance data.
 * @param[in] tx_data Data to be stored.
 *
 * @returns
 *   - IB_OK on success.
 *   - IB_ENOENT if the structure does not exist.
 */
static
ib_status_t set_ee_tx_data(
    const ib_module_t  *m,
    ib_tx_t            *tx,
    ee_operator_data_t *instance_data,
    ee_tx_data_t       *tx_data
)
{
    assert(tx != NULL);
    assert(instance_data != NULL);
    assert(tx_data != NULL);

    ib_hash_t *hash;
    ib_status_t rc;

    rc = get_or_create_operator_data_hash(m, tx, &hash);
    if (rc != IB_OK) {
        return rc;
    }

    rc = ib_hash_set_ex(hash,
                        instance_data->id,
                        IB_UUID_LENGTH - 1,
                        tx_data);

    return rc;
}
Exemple #2
0
/**
 * Store the per-transaction data for use with the operator.
 *
 * @param[in] m This module.
 * @param[in,out] tx Transaction to store the data in.
 * @param[in] instance_data Pointer to the operator instance data.
 * @param[in] eudoxus_state State to be stored.
 *
 * @returns
 *   - IB_OK on success.
 *   - IB_ENOENT if the structure does not exist.
 */
static
ib_status_t set_ee_tx_data(
    const ib_module_t  *m,
    ib_tx_t            *tx,
    ee_operator_data_t *instance_data,
    ia_eudoxus_state_t *eudoxus_state
)
{
    assert(tx != NULL);
    assert(tx->mp != NULL);
    assert(instance_data != NULL);
    assert(eudoxus_state != NULL);

    ib_hash_t *hash;
    ib_status_t rc;

    rc = get_or_create_operator_data_hash(m, tx, &hash);
    if (rc != IB_OK) {
        return rc;
    }

    rc = ib_hash_set_ex(hash,
                        (const char *)&instance_data,
                        sizeof(ee_operator_data_t *),
                        eudoxus_state);

    return rc;
}
Exemple #3
0
 /**
  * Set a value in hash.
  *
  * @param[in] key        Key.
  * @param[in] key_length Length of @a key.
  * @param[in] value      Value.
  **/
 void set(const char* key, size_t key_length, T value) const
 {
     throw_if_error(ib_hash_set_ex(
         ib(),
         key, key_length,
         Internal::value_as_void(value)
     ));
 }