Class: Aerospike::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/aerospike/operation.rb

Direct Known Subclasses

CDT::ListOperation, CDT::MapOperation

Constant Summary collapse

READ =
1
READ_HEADER =
1
WRITE =
2
CDT_READ =
3
CDT_MODIFY =
4
ADD =
5
APPEND =
9
PREPEND =
10
TOUCH =
11
DELETE =
14

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(op_type, bin_name = nil, bin_value = NullValue.new) ⇒ Operation

Returns a new instance of Operation.



36
37
38
39
40
41
# File 'lib/aerospike/operation.rb', line 36

def initialize(op_type, bin_name=nil, bin_value=NullValue.new)
  @op_type = op_type
  @bin_name = bin_name
  @bin_value = Value.of(bin_value)
  self
end

Instance Attribute Details

#bin_nameObject (readonly)

Returns the value of attribute bin_name.



23
24
25
# File 'lib/aerospike/operation.rb', line 23

def bin_name
  @bin_name
end

#bin_valueObject (readonly)

Returns the value of attribute bin_value.



23
24
25
# File 'lib/aerospike/operation.rb', line 23

def bin_value
  @bin_value
end

#op_typeObject (readonly)

Returns the value of attribute op_type.



23
24
25
# File 'lib/aerospike/operation.rb', line 23

def op_type
  @op_type
end

Class Method Details

.add(bin) ⇒ Object



67
68
69
# File 'lib/aerospike/operation.rb', line 67

def self.add(bin)
  Operation.new(ADD, bin.name, bin.value)
end

.append(bin) ⇒ Object



59
60
61
# File 'lib/aerospike/operation.rb', line 59

def self.append(bin)
  Operation.new(APPEND, bin.name, bin.value)
end

.deleteObject



75
76
77
# File 'lib/aerospike/operation.rb', line 75

def self.delete
  Operation.new(DELETE)
end

.get(bin_name = nil) ⇒ Object



47
48
49
# File 'lib/aerospike/operation.rb', line 47

def self.get(bin_name=nil)
  Operation.new(READ, bin_name)
end

.get_header(bin_name = nil) ⇒ Object



51
52
53
# File 'lib/aerospike/operation.rb', line 51

def self.get_header(bin_name=nil)
  Operation.new(READ_HEADER, bin_name)
end

.prepend(bin) ⇒ Object



63
64
65
# File 'lib/aerospike/operation.rb', line 63

def self.prepend(bin)
  Operation.new(PREPEND, bin.name, bin.value)
end

.put(bin) ⇒ Object



55
56
57
# File 'lib/aerospike/operation.rb', line 55

def self.put(bin)
  Operation.new(WRITE, bin.name, bin.value)
end

.touchObject



71
72
73
# File 'lib/aerospike/operation.rb', line 71

def self.touch
  Operation.new(TOUCH)
end

Instance Method Details

#binObject



43
44
45
# File 'lib/aerospike/operation.rb', line 43

def bin
  Aerospike::Bin.new(bin_name, bin_value) if bin_name && bin_value
end