Class: Couchbase::MutationState

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/mutation_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*mutation_tokens) ⇒ MutationState

Create a mutation state from one or more MutationTokens

Parameters:



39
40
41
42
# File 'lib/couchbase/mutation_state.rb', line 39

def initialize(*mutation_tokens)
  @tokens = []
  add(*mutation_tokens)
end

Instance Attribute Details

#tokensArray<MutationToken>

Returns:



34
35
36
# File 'lib/couchbase/mutation_state.rb', line 34

def tokens
  @tokens
end

Instance Method Details

#add(*mutation_tokens) ⇒ Object

Add one or more Mutation tokens to this state

Parameters:



47
48
49
# File 'lib/couchbase/mutation_state.rb', line 47

def add(*mutation_tokens)
  @tokens |= mutation_tokens
end

#to_aObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
55
56
57
58
59
60
61
# File 'lib/couchbase/mutation_state.rb', line 52

def to_a
  @tokens.map do |t|
    {
      bucket_name: t.bucket_name,
      partition_id: t.partition_id,
      partition_uuid: t.partition_uuid,
      sequence_number: t.sequence_number,
    }
  end
end