Class: Couchbase::Protostellar::Collection Private
- Inherits:
-
Object
- Object
- Couchbase::Protostellar::Collection
- 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
- #bucket_name ⇒ Object readonly private
- #name ⇒ Object readonly private
- #scope_name ⇒ Object readonly private
Instance Method Summary collapse
- #binary ⇒ Object private
- #exists(id, options = Couchbase::Options::Exists::DEFAULT) ⇒ Object private
- #get(id, options = Couchbase::Options::Get::DEFAULT) ⇒ Object private
- #get_all_replicas(id, options = Couchbase::Options::GetAllReplicas::DEFAULT) ⇒ Object private
- #get_and_lock(id, lock_time, options = Couchbase::Options::GetAndLock::DEFAULT) ⇒ Object private
- #get_and_touch(id, expiry, options = Couchbase::Options::GetAndTouch::DEFAULT) ⇒ Object private
- #get_any_replica(id, options = Couchbase::Options::GetAnyReplica::DEFAULT) ⇒ Object private
-
#initialize(client, bucket_name, scope_name, name) ⇒ Collection
constructor
private
A new instance of Collection.
- #insert(id, content, options = Couchbase::Options::Insert::DEFAULT) ⇒ Object private
- #lookup_in(id, specs, options = Couchbase::Options::LookupIn::DEFAULT) ⇒ Object private
- #lookup_in_all_replicas(_id, _specs, _options = Couchbase::Options::LookupInAllReplicas::DEFAULT) ⇒ Object private
- #lookup_in_any_replica(_id, _specs, _options = Couchbase::Options::LookupInAnyReplica::DEFAULT) ⇒ Object private
- #mutate_in(id, specs, options = Couchbase::Options::MutateIn::DEFAULT) ⇒ Object private
- #query_indexes ⇒ Object private
- #remove(id, options = Couchbase::Options::Remove::DEFAULT) ⇒ Object private
- #replace(id, content, options = Couchbase::Options::Replace::DEFAULT) ⇒ Object private
- #scan(_scan_type, _options = Options::Scan::DEFAULT) ⇒ Object private
- #touch(id, expiry, options = Couchbase::Options::Touch::DEFAULT) ⇒ Object private
- #unlock(id, cas, options = Couchbase::Options::Unlock::DEFAULT) ⇒ Object private
- #upsert(id, content, options = Couchbase::Options::Upsert::DEFAULT) ⇒ Object private
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_name ⇒ Object (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 |
#name ⇒ Object (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_name ⇒ Object (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
#binary ⇒ 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.
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, = Couchbase::Options::Exists::DEFAULT) req = @kv_request_generator.exists_request(id, ) 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, = Couchbase::Options::Get::DEFAULT) req = @kv_request_generator.get_request(id, ) resp = @client.send_request(req) ResponseConverter::KV.to_get_result(resp, ) 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, = Couchbase::Options::GetAllReplicas::DEFAULT) req = @kv_request_generator.get_all_replicas_request(id, ) resp = @client.send_request(req) ResponseConverter::KV.to_get_all_replicas_result(resp, ) 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, = Couchbase::Options::GetAndLock::DEFAULT) req = @kv_request_generator.get_and_lock_request(id, lock_time, ) resp = @client.send_request(req) ResponseConverter::KV.to_get_result(resp, ) 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, = Couchbase::Options::GetAndTouch::DEFAULT) req = @kv_request_generator.get_and_touch_request(id, expiry, ) resp = @client.send_request(req) ResponseConverter::KV.to_get_result(resp, ) 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, = Couchbase::Options::GetAnyReplica::DEFAULT) req = @kv_request_generator.get_any_replica_request(id, ) resp = @client.send_request(req) ResponseConverter::KV.to_get_any_replica_result(resp, ) 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, = Couchbase::Options::Insert::DEFAULT) req = @kv_request_generator.insert_request(id, content, ) 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, = Couchbase::Options::LookupIn::DEFAULT) req = @kv_request_generator.lookup_in_request(id, specs, ) resp = @client.send_request(req) ResponseConverter::KV.to_lookup_in_result(resp, specs, , 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, = 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, = 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, = Couchbase::Options::MutateIn::DEFAULT) req = @kv_request_generator.mutate_in_request(id, specs, ) resp = @client.send_request(req) ResponseConverter::KV.to_mutate_in_result(resp, specs, ) end |
#query_indexes ⇒ 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.
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, = Couchbase::Options::Remove::DEFAULT) req = @kv_request_generator.remove_request(id, ) 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, = Couchbase::Options::Replace::DEFAULT) req = @kv_request_generator.replace_request(id, content, ) 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::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, = Couchbase::Options::Touch::DEFAULT) req = @kv_request_generator.touch_request(id, expiry, ) 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, = Couchbase::Options::Unlock::DEFAULT) req = @kv_request_generator.unlock_request(id, cas, ) @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, = Couchbase::Options::Upsert::DEFAULT) req = @kv_request_generator.upsert_request(id, content, ) resp = @client.send_request(req) ResponseConverter::KV.to_mutation_result(resp) end |