Skip to content

Commit

Permalink
Inline the apply_set_${op}_${type} functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Apr 10, 2012
1 parent 329e768 commit cbed1c9
Showing 1 changed file with 24 additions and 80 deletions.
104 changes: 24 additions & 80 deletions hyperdaemon/datatypes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -907,43 +907,6 @@ validate_set_int64(const e::slice& set)
return validate_set(validate_int64, compare_int64, set);
}

static uint8_t*
apply_set_add_remove_string(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_add_remove(validate_string, compare_string_micro_arg1,
copy_string_from_serialized,
copy_string_from_micro_arg1,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_intersect_string(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_intersect(validate_set_string, validate_string,
compare_string, copy_string_from_serialized,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_union_string(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_union(validate_set_string, validate_string,
compare_string, copy_string_from_serialized,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_string(const e::slice& old_value,
const hyperdex::microop* ops,
Expand All @@ -956,15 +919,24 @@ apply_set_string(const e::slice& old_value,
if (ops[0].action == hyperdex::OP_SET_ADD ||
ops[0].action == hyperdex::OP_SET_REMOVE)
{
return apply_set_add_remove_string(old_value, ops, num_ops, writeto, error);
return apply_set_add_remove(validate_string,
compare_string_micros_arg1,
compare_string_micro_arg1,
copy_string_from_serialized,
copy_string_from_micro_arg1,
old_value, ops, num_ops, writeto, error);
}
else if (ops[0].action == hyperdex::OP_SET_INTERSECT)
{
return apply_set_intersect_string(old_value, ops, num_ops, writeto, error);
return apply_set_intersect(validate_set_string, validate_string,
compare_string, copy_string_from_serialized,
old_value, ops, num_ops, writeto, error);
}
else if (ops[0].action == hyperdex::OP_SET_UNION)
{
return apply_set_union_string(old_value, ops, num_ops, writeto, error);
return apply_set_union(validate_set_string, validate_string,
compare_string, copy_string_from_serialized,
old_value, ops, num_ops, writeto, error);
}
else
{
Expand All @@ -973,43 +945,6 @@ apply_set_string(const e::slice& old_value,
}
}

static uint8_t*
apply_set_add_remove_int64(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_add_remove(validate_int64, compare_int64_micro_arg1,
copy_int64_from_serialized,
copy_int64_from_micro_arg1,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_intersect_int64(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_intersect(validate_set_int64, validate_int64,
compare_int64, copy_int64_from_serialized,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_union_int64(const e::slice& old_value,
const hyperdex::microop* ops,
size_t num_ops,
uint8_t* writeto,
hyperdex::network_returncode* error)
{
return apply_set_union(validate_set_int64, validate_int64,
compare_int64, copy_int64_from_serialized,
old_value, ops, num_ops, writeto, error);
}

static uint8_t*
apply_set_int64(const e::slice& old_value,
const hyperdex::microop* ops,
Expand All @@ -1022,15 +957,24 @@ apply_set_int64(const e::slice& old_value,
if (ops[0].action == hyperdex::OP_SET_ADD ||
ops[0].action == hyperdex::OP_SET_REMOVE)
{
return apply_set_add_remove_int64(old_value, ops, num_ops, writeto, error);
return apply_set_add_remove(validate_int64,
compare_int64_micros_arg1,
compare_int64_micro_arg1,
copy_int64_from_serialized,
copy_int64_from_micro_arg1,
old_value, ops, num_ops, writeto, error);
}
else if (ops[0].action == hyperdex::OP_SET_INTERSECT)
{
return apply_set_intersect_int64(old_value, ops, num_ops, writeto, error);
return apply_set_intersect(validate_set_int64, validate_int64,
compare_int64, copy_int64_from_serialized,
old_value, ops, num_ops, writeto, error);
}
else if (ops[0].action == hyperdex::OP_SET_UNION)
{
return apply_set_union_int64(old_value, ops, num_ops, writeto, error);
return apply_set_union(validate_set_int64, validate_int64,
compare_int64, copy_int64_from_serialized,
old_value, ops, num_ops, writeto, error);
}
else
{
Expand Down

0 comments on commit cbed1c9

Please sign in to comment.