Class: Aerospike::Operation
- Inherits:
-
Object
- Object
- Aerospike::Operation
- Defined in:
- lib/aerospike/operation.rb
Direct Known Subclasses
CDT::BitOperation, CDT::HLLOperation, CDT::ListOperation, CDT::MapOperation
Constant Summary collapse
- READ =
1
- READ_HEADER =
1
- WRITE =
2
- CDT_READ =
3
- CDT_MODIFY =
4
- ADD =
5
- EXP_READ =
7
- EXP_MODIFY =
8
- APPEND =
9
- PREPEND =
10
- TOUCH =
11
- BIT_READ =
12
- BIT_MODIFY =
13
- DELETE =
14
- HLL_READ =
15
- HLL_MODIFY =
16
Instance Attribute Summary collapse
-
#bin_name ⇒ Object
readonly
Returns the value of attribute bin_name.
-
#bin_value ⇒ Object
readonly
Returns the value of attribute bin_value.
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#op_type ⇒ Object
readonly
Returns the value of attribute op_type.
Class Method Summary collapse
- .add(bin) ⇒ Object
- .append(bin) ⇒ Object
- .delete ⇒ Object
- .get(bin_name = nil) ⇒ Object
- .get_header(bin_name = nil) ⇒ Object
- .prepend(bin) ⇒ Object
- .put(bin) ⇒ Object
- .touch ⇒ Object
Instance Method Summary collapse
- #bin ⇒ Object
-
#initialize(op_type, bin_name = nil, bin_value = NullValue.new, ctx = nil) ⇒ Operation
constructor
A new instance of Operation.
-
#is_write? ⇒ Boolean
:nodoc:.
Constructor Details
#initialize(op_type, bin_name = nil, bin_value = NullValue.new, ctx = nil) ⇒ Operation
Returns a new instance of Operation.
40 41 42 43 44 45 46 |
# File 'lib/aerospike/operation.rb', line 40 def initialize(op_type, bin_name = nil, bin_value = NullValue.new, ctx = nil) @op_type = op_type @bin_name = bin_name @bin_value = Value.of(bin_value) @ctx = ctx self end |
Instance Attribute Details
#bin_name ⇒ Object (readonly)
Returns the value of attribute bin_name.
21 22 23 |
# File 'lib/aerospike/operation.rb', line 21 def bin_name @bin_name end |
#bin_value ⇒ Object (readonly)
Returns the value of attribute bin_value.
21 22 23 |
# File 'lib/aerospike/operation.rb', line 21 def bin_value @bin_value end |
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
21 22 23 |
# File 'lib/aerospike/operation.rb', line 21 def ctx @ctx end |
#op_type ⇒ Object (readonly)
Returns the value of attribute op_type.
21 22 23 |
# File 'lib/aerospike/operation.rb', line 21 def op_type @op_type end |
Class Method Details
.add(bin) ⇒ Object
72 73 74 |
# File 'lib/aerospike/operation.rb', line 72 def self.add(bin) Operation.new(ADD, bin.name, bin.value) end |
.append(bin) ⇒ Object
64 65 66 |
# File 'lib/aerospike/operation.rb', line 64 def self.append(bin) Operation.new(APPEND, bin.name, bin.value) end |
.delete ⇒ Object
80 81 82 |
# File 'lib/aerospike/operation.rb', line 80 def self.delete Operation.new(DELETE) end |
.get(bin_name = nil) ⇒ Object
52 53 54 |
# File 'lib/aerospike/operation.rb', line 52 def self.get(bin_name = nil) Operation.new(READ, bin_name) end |
.get_header(bin_name = nil) ⇒ Object
56 57 58 |
# File 'lib/aerospike/operation.rb', line 56 def self.get_header(bin_name = nil) Operation.new(READ_HEADER, bin_name) end |
.prepend(bin) ⇒ Object
68 69 70 |
# File 'lib/aerospike/operation.rb', line 68 def self.prepend(bin) Operation.new(PREPEND, bin.name, bin.value) end |
Instance Method Details
#bin ⇒ Object
48 49 50 |
# File 'lib/aerospike/operation.rb', line 48 def bin Aerospike::Bin.new(bin_name, bin_value) if bin_name && bin_value end |
#is_write? ⇒ Boolean
:nodoc:
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/aerospike/operation.rb', line 85 def is_write? case @op_type when READ false when READ_HEADER false when WRITE true when CDT_READ false when CDT_MODIFY true when ADD true when EXP_READ false when EXP_MODIFY true when APPEND true when PREPEND true when TOUCH true when BIT_READ false when BIT_MODIFY true when DELETE true when HLL_READ false when HLL_MODIFY true end end |