Class: Couchbase::Protostellar::Collection Private

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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, bucket_name, scope_name, name) ⇒ Collection

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.

Returns a new instance of Collection.



35
36
37
38
39
40
41
# File 'lib/couchbase/protostellar/collection.rb', line 35

def initialize(client, bucket_name, scope_name, name)
  @client = client
  @bucket_name = bucket_name
  @scope_name = scope_name
  @name = name
  @kv_request_generator = RequestGenerator::KV.new(@bucket_name, @scope_name, @name)
end

Instance Attribute Details

#bucket_nameObject (readonly)

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.



31
32
33
# File 'lib/couchbase/protostellar/collection.rb', line 31

def bucket_name
  @bucket_name
end

#nameObject (readonly)

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.



33
34
35
# File 'lib/couchbase/protostellar/collection.rb', line 33

def name
  @name
end

#scope_nameObject (readonly)

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.



32
33
34
# File 'lib/couchbase/protostellar/collection.rb', line 32

def scope_name
  @scope_name
end

Instance Method Details

#binaryObject

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.



43
44
45
# File 'lib/couchbase/protostellar/collection.rb', line 43

def binary
  BinaryCollection.new(self)
end

#exists(id, options = Couchbase::Options::Exists::DEFAULT) ⇒ Object

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.



109
110
111
112
113
# File 'lib/couchbase/protostellar/collection.rb', line 109

def exists(id, options = Couchbase::Options::Exists::DEFAULT)
  req = @kv_request_generator.exists_request(id, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_exists_result(resp)
end

#get(id, options = Couchbase::Options::Get::DEFAULT) ⇒ Object

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.



56
57
58
59
60
# File 'lib/couchbase/protostellar/collection.rb', line 56

def get(id, options = Couchbase::Options::Get::DEFAULT)
  req = @kv_request_generator.get_request(id, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_get_result(resp, options)
end

#get_all_replicas(id, options = Couchbase::Options::GetAllReplicas::DEFAULT) ⇒ Object

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.



141
142
143
144
145
# File 'lib/couchbase/protostellar/collection.rb', line 141

def get_all_replicas(id, options = Couchbase::Options::GetAllReplicas::DEFAULT)
  req = @kv_request_generator.get_all_replicas_request(id, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_get_all_replicas_result(resp, options)
end

#get_and_lock(id, lock_time, options = Couchbase::Options::GetAndLock::DEFAULT) ⇒ Object

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.



68
69
70
71
72
# File 'lib/couchbase/protostellar/collection.rb', line 68

def get_and_lock(id, lock_time, options = Couchbase::Options::GetAndLock::DEFAULT)
  req = @kv_request_generator.get_and_lock_request(id, lock_time, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_get_result(resp, options)
end

#get_and_touch(id, expiry, options = Couchbase::Options::GetAndTouch::DEFAULT) ⇒ Object

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.



62
63
64
65
66
# File 'lib/couchbase/protostellar/collection.rb', line 62

def get_and_touch(id, expiry, options = Couchbase::Options::GetAndTouch::DEFAULT)
  req = @kv_request_generator.get_and_touch_request(id, expiry, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_get_result(resp, options)
end

#get_any_replica(id, options = Couchbase::Options::GetAnyReplica::DEFAULT) ⇒ Object

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.



135
136
137
138
139
# File 'lib/couchbase/protostellar/collection.rb', line 135

def get_any_replica(id, options = Couchbase::Options::GetAnyReplica::DEFAULT)
  req = @kv_request_generator.get_any_replica_request(id, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_get_any_replica_result(resp, options)
end

#insert(id, content, options = Couchbase::Options::Insert::DEFAULT) ⇒ Object

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.



97
98
99
100
101
# File 'lib/couchbase/protostellar/collection.rb', line 97

def insert(id, content, options = Couchbase::Options::Insert::DEFAULT)
  req = @kv_request_generator.insert_request(id, content, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutation_result(resp)
end

#lookup_in(id, specs, options = Couchbase::Options::LookupIn::DEFAULT) ⇒ Object

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.



115
116
117
118
119
# File 'lib/couchbase/protostellar/collection.rb', line 115

def lookup_in(id, specs, options = Couchbase::Options::LookupIn::DEFAULT)
  req = @kv_request_generator.lookup_in_request(id, specs, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_lookup_in_result(resp, specs, options, req)
end

#lookup_in_all_replicas(_id, _specs, _options = Couchbase::Options::LookupInAllReplicas::DEFAULT) ⇒ Object

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.



125
126
127
# File 'lib/couchbase/protostellar/collection.rb', line 125

def lookup_in_all_replicas(_id, _specs, _options = Couchbase::Options::LookupInAllReplicas::DEFAULT)
  raise Couchbase::Error::FeatureNotAvailable, "The #{Protostellar::NAME} protocol does not support lookup in all replicas"
end

#lookup_in_any_replica(_id, _specs, _options = Couchbase::Options::LookupInAnyReplica::DEFAULT) ⇒ Object

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.



121
122
123
# File 'lib/couchbase/protostellar/collection.rb', line 121

def lookup_in_any_replica(_id, _specs, _options = Couchbase::Options::LookupInAnyReplica::DEFAULT)
  raise Couchbase::Error::FeatureNotAvailable, "The #{Protostellar::NAME} protocol does not support lookup in any replica"
end

#mutate_in(id, specs, options = Couchbase::Options::MutateIn::DEFAULT) ⇒ Object

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.



129
130
131
132
133
# File 'lib/couchbase/protostellar/collection.rb', line 129

def mutate_in(id, specs, options = Couchbase::Options::MutateIn::DEFAULT)
  req = @kv_request_generator.mutate_in_request(id, specs, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutate_in_result(resp, specs, options)
end

#query_indexesObject

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.



47
48
49
50
51
52
53
54
# File 'lib/couchbase/protostellar/collection.rb', line 47

def query_indexes
  Management::CollectionQueryIndexManager.new(
    client: @client,
    bucket_name: @bucket_name,
    scope_name: @scope_name,
    collection_name: @name
  )
end

#remove(id, options = Couchbase::Options::Remove::DEFAULT) ⇒ Object

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.



91
92
93
94
95
# File 'lib/couchbase/protostellar/collection.rb', line 91

def remove(id, options = Couchbase::Options::Remove::DEFAULT)
  req = @kv_request_generator.remove_request(id, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutation_result(resp)
end

#replace(id, content, options = Couchbase::Options::Replace::DEFAULT) ⇒ Object

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.



103
104
105
106
107
# File 'lib/couchbase/protostellar/collection.rb', line 103

def replace(id, content, options = Couchbase::Options::Replace::DEFAULT)
  req = @kv_request_generator.replace_request(id, content, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutation_result(resp)
end

#scan(_scan_type, _options = Options::Scan::DEFAULT) ⇒ Object

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.



147
148
149
# File 'lib/couchbase/protostellar/collection.rb', line 147

def scan(_scan_type, _options = Options::Scan::DEFAULT)
  raise Couchbase::Error::FeatureNotAvailable, "The #{Protostellar::NAME} protocol does not support KV scans"
end

#touch(id, expiry, options = Couchbase::Options::Touch::DEFAULT) ⇒ Object

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.



79
80
81
82
83
# File 'lib/couchbase/protostellar/collection.rb', line 79

def touch(id, expiry, options = Couchbase::Options::Touch::DEFAULT)
  req = @kv_request_generator.touch_request(id, expiry, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutation_result(resp)
end

#unlock(id, cas, options = Couchbase::Options::Unlock::DEFAULT) ⇒ Object

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.



74
75
76
77
# File 'lib/couchbase/protostellar/collection.rb', line 74

def unlock(id, cas, options = Couchbase::Options::Unlock::DEFAULT)
  req = @kv_request_generator.unlock_request(id, cas, options)
  @client.send_request(req)
end

#upsert(id, content, options = Couchbase::Options::Upsert::DEFAULT) ⇒ Object

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.



85
86
87
88
89
# File 'lib/couchbase/protostellar/collection.rb', line 85

def upsert(id, content, options = Couchbase::Options::Upsert::DEFAULT)
  req = @kv_request_generator.upsert_request(id, content, options)
  resp = @client.send_request(req)
  ResponseConverter::KV.to_mutation_result(resp)
end