Class: Aerospike::CDT::Context

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

Overview

Nested CDT context. Identifies the location of nested list/map to apply the operation. for the current level. An array of CTX identifies location of the list/map on multiple levels on nesting.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, value) ⇒ Context

Returns a new instance of Context.



32
33
34
35
# File 'lib/aerospike/cdt/context.rb', line 32

def initialize(id, value)
  @id = id
  @value = value
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



30
31
32
# File 'lib/aerospike/cdt/context.rb', line 30

def id
  @id
end

#valueObject

Returns the value of attribute value.



30
31
32
# File 'lib/aerospike/cdt/context.rb', line 30

def value
  @value
end

Class Method Details

.list_index(index) ⇒ Object

Lookup list by index offset. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. Examples: 0: First item. 4: Fifth item. -1: Last item. -3: Third to last item.



52
53
54
# File 'lib/aerospike/cdt/context.rb', line 52

def self.list_index(index)
  Context.new(0x10, index)
end

.list_index_create(index, order, pad) ⇒ Object

Create list with given type at index offset, given an order and pad.



39
40
41
# File 'lib/aerospike/cdt/context.rb', line 39

def self.list_index_create(index, order, pad)
Context.new(0x10 | ListOrder.flag(order, pad), index)
end

.list_rank(rank) ⇒ Object

Lookup list by rank. 0 = smallest value N = Nth smallest value -1 = largest value



61
62
63
# File 'lib/aerospike/cdt/context.rb', line 61

def self.list_rank(rank)
  Context.new(0x11, rank)
end

.list_value(key) ⇒ Object

Lookup list by value.



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

def self.list_value(key)
  Context.new(0x13, key)
end

.map_index(index) ⇒ Object

Lookup map by index offset. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. Examples: 0: First item. 4: Fifth item. -1: Last item. -3: Third to last item.



80
81
82
# File 'lib/aerospike/cdt/context.rb', line 80

def self.map_index(index)
  Context.new(0x20, index)
end

.map_key(key) ⇒ Object

Lookup map by key.



95
96
97
# File 'lib/aerospike/cdt/context.rb', line 95

def self.map_key(key)
  Context.new(0x22, key)
end

.map_key_create(key, order) ⇒ Object

Create map with given type at map key.



101
102
103
# File 'lib/aerospike/cdt/context.rb', line 101

def self.map_key_create(key, order)
  Context.new(0x22 | order[:flag], key)
end

.map_rank(rank) ⇒ Object

Lookup map by rank. 0 = smallest value N = Nth smallest value -1 = largest value



89
90
91
# File 'lib/aerospike/cdt/context.rb', line 89

def self.map_rank(rank)
  Context.new(0x21, rank)
end

.map_value(key) ⇒ Object

Lookup map by value.



107
108
109
# File 'lib/aerospike/cdt/context.rb', line 107

def self.map_value(key)
  Context.new(0x23, key)
end