Bit operations on a byte-array bin for Aerospike.operate/4.
Bit operations require an Aerospike blob bin. When seeding a bit bin through
this client, write an explicit blob such as {:blob, <<0>>} because plain
Elixir binaries are encoded as Aerospike strings.
Offsets are read left to right within the bin. Negative bit or byte offsets count backward from the end of the bitmap. Out-of-bounds offsets produce a server parameter error.
Offsets are in bits for set/5, bw_or/5, bw_xor/5, bw_and/5,
bw_not/4, lshift/5, rshift/5, add/5, subtract/5, set_int/5,
get/4, count/4, lscan/5, rscan/5, and get_int/5. resize/4,
insert/4, and remove/4 use byte offsets and sizes.
Pass ctx: for nested bitmaps and flags: for write policy flags.
Summary
Types
Bit operation write policy flags.
Common bit operation options.
Overflow action for bit add/subtract operations.
Resize flags for bit resize operations.
Opaque bit operation for Aerospike.operate/4.
Functions
Adds value to a sub-integer in the bitmap.
Applies bitwise AND of value into [bit_offset, bit_offset + bit_size).
Inverts [bit_offset, bit_offset + bit_size).
Applies bitwise OR of value into [bit_offset, bit_offset + bit_size).
Applies bitwise XOR of value into [bit_offset, bit_offset + bit_size).
Returns the count of bits set to 1 in [bit_offset, bit_offset + bit_size).
Returns bit_size bits starting at bit_offset as a binary.
Reads an integer from [bit_offset, bit_offset + bit_size).
Inserts bytes at byte_offset in the bin.
Returns the offset of the first bit matching value when scanning left to right.
Left shifts [bit_offset, bit_offset + bit_size) by shift bits.
Fail bit add/subtract on overflow or underflow.
Saturate bit add/subtract to min/max on overflow or underflow.
Wrap bit add/subtract on overflow or underflow.
Removes byte_size bytes starting at byte_offset.
Resizes the bin to byte_size bytes using resize_flags.
Returns the offset of the first bit matching value when scanning right to left.
Right shifts [bit_offset, bit_offset + bit_size) by shift bits.
Overwrites the bit region [bit_offset, bit_offset + bit_size) with bits from value.
Writes integer value into [bit_offset, bit_offset + bit_size).
Subtracts value from a sub-integer in the bitmap.
Only create the bit bin when it does not already exist.
Use default bit write behavior.
Do not fail the command when a bit operation is denied by write flags.
Commit other valid operations when this bit operation is denied by write flags.
Only update the bit bin when it already exists.
Types
@type flags() :: atom() | [atom()] | non_neg_integer() | {:raw, non_neg_integer()}
Bit operation write policy flags.
Accepts :default, :create_only, :update_only, :no_fail, :partial,
or a list of those atoms. Compatibility callers may pass a non-negative
integer; use {:raw, integer} when deliberately sending an unnamed server
value.
@type opts() :: [ ctx: Aerospike.Ctx.t(), flags: flags(), overflow_action: overflow_action(), signed: boolean() ]
Common bit operation options.
Supported keys:
:ctx- nested CDT context path fromAerospike.Ctx.:flags- bit-operation write flags. Defaults to:default.:overflow_action- overflow behavior foradd/5andsubtract/5.:signed- when true, adds the signed flag to:overflow_action.
@type overflow_action() :: atom() | non_neg_integer() | {:raw, non_neg_integer()}
Overflow action for bit add/subtract operations.
Accepts :fail, :saturate, or :wrap. Compatibility callers may pass a
non-negative integer; use {:raw, integer} when deliberately sending an
unnamed server value. signed: true adds the signed flag before encoding.
@type resize_flags() :: atom() | [atom()] | non_neg_integer() | {:raw, non_neg_integer()}
Resize flags for bit resize operations.
Accepts :default, :from_front, :grow_only, :shrink_only, or a list
of those atoms. Compatibility callers may pass a non-negative integer; use
{:raw, integer} when deliberately sending an unnamed server value.
@opaque t()
Opaque bit operation for Aerospike.operate/4.
Functions
Adds value to a sub-integer in the bitmap.
Supports flags:, overflow_action:, and signed:. Use signed: true to
OR the signed flag into overflow_action:.
Applies bitwise AND of value into [bit_offset, bit_offset + bit_size).
Inverts [bit_offset, bit_offset + bit_size).
Applies bitwise OR of value into [bit_offset, bit_offset + bit_size).
Applies bitwise XOR of value into [bit_offset, bit_offset + bit_size).
Returns the count of bits set to 1 in [bit_offset, bit_offset + bit_size).
Returns bit_size bits starting at bit_offset as a binary.
Reads an integer from [bit_offset, bit_offset + bit_size).
Pass true for signed to interpret the field as signed.
Inserts bytes at byte_offset in the bin.
Returns the offset of the first bit matching value when scanning left to right.
Left shifts [bit_offset, bit_offset + bit_size) by shift bits.
@spec overflow_fail() :: 0
Fail bit add/subtract on overflow or underflow.
@spec overflow_saturate() :: 2
Saturate bit add/subtract to min/max on overflow or underflow.
@spec overflow_wrap() :: 4
Wrap bit add/subtract on overflow or underflow.
Removes byte_size bytes starting at byte_offset.
@spec resize(String.t(), integer(), resize_flags(), opts()) :: t()
Resizes the bin to byte_size bytes using resize_flags.
Returns the offset of the first bit matching value when scanning right to left.
Right shifts [bit_offset, bit_offset + bit_size) by shift bits.
Overwrites the bit region [bit_offset, bit_offset + bit_size) with bits from value.
Writes integer value into [bit_offset, bit_offset + bit_size).
Subtracts value from a sub-integer in the bitmap.
Supports flags:, overflow_action:, and signed:. Use signed: true to
OR the signed flag into overflow_action:.
@spec write_create_only() :: 1
Only create the bit bin when it does not already exist.
@spec write_default() :: 0
Use default bit write behavior.
@spec write_no_fail() :: 4
Do not fail the command when a bit operation is denied by write flags.
@spec write_partial() :: 8
Commit other valid operations when this bit operation is denied by write flags.
@spec write_update_only() :: 2
Only update the bit bin when it already exists.