Class: Aerospike::CDT::MapPolicy
- Inherits:
-
Object
- Object
- Aerospike::CDT::MapPolicy
- Defined in:
- lib/aerospike/cdt/map_policy.rb
Constant Summary collapse
- DEFAULT =
MapPolicy.new
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#item_command ⇒ Object
Returns the value of attribute item_command.
-
#items_command ⇒ Object
Returns the value of attribute items_command.
-
#order ⇒ Object
Returns the value of attribute order.
-
#persist_index ⇒ Object
Returns the value of attribute persist_index.
-
#write_mode ⇒ Object
Returns the value of attribute write_mode.
Instance Method Summary collapse
-
#initialize(order: nil, write_mode: nil, persist_index: false, flags: nil) ⇒ MapPolicy
constructor
A new instance of MapPolicy.
Constructor Details
#initialize(order: nil, write_mode: nil, persist_index: false, flags: nil) ⇒ MapPolicy
Returns a new instance of MapPolicy.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/aerospike/cdt/map_policy.rb', line 22 def initialize(order: nil, write_mode: nil, persist_index: false, flags: nil) if write_mode && flags raise ArgumentError, "Use write mode for server versions < 4.3; use write flags for server versions >= 4.3." end @order = order || MapOrder::DEFAULT @write_mode = write_mode || MapWriteMode::DEFAULT @flags = flags || MapWriteFlags::DEFAULT @attributes = order ? order[:attr] : 0 if @persist_index @attributes |= 0x10 end case @write_mode when CDT::MapWriteMode::DEFAULT @item_command = CDT::MapOperation::PUT @items_command = CDT::MapOperation::PUT_ITEMS when CDT::MapWriteMode::UPDATE_ONLY @item_command = CDT::MapOperation::REPLACE @items_command = CDT::MapOperation::REPLACE_ITEMS when CDT::MapWriteMode::CREATE_ONLY @item_command = CDT::MapOperation::ADD @items_command = CDT::MapOperation::ADD_ITEMS else raise Exceptions.new(ResultCode::PARAMETER_ERROR, "invalid value for MapWriteMode #{write_mode}") end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def attributes @attributes end |
#flags ⇒ Object
Returns the value of attribute flags.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def flags @flags end |
#item_command ⇒ Object
Returns the value of attribute item_command.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def item_command @item_command end |
#items_command ⇒ Object
Returns the value of attribute items_command.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def items_command @items_command end |
#order ⇒ Object
Returns the value of attribute order.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def order @order end |
#persist_index ⇒ Object
Returns the value of attribute persist_index.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def persist_index @persist_index end |
#write_mode ⇒ Object
Returns the value of attribute write_mode.
20 21 22 |
# File 'lib/aerospike/cdt/map_policy.rb', line 20 def write_mode @write_mode end |