Class: Couchbase::Result
- Inherits:
-
Object
- Object
- Couchbase::Result
- Defined in:
- ext/couchbase_ext/couchbase_ext.c,
lib/couchbase/result.rb,
ext/couchbase_ext/couchbase_ext.c
Overview
The object which yielded to asynchronous callbacks
Instance Attribute Summary (collapse)
- - (Fixnum) cas readonly
-
- (Boolean) completed
(also: #completed?)
readonly
In Bucket::CouchRequest operations used to mark the final call.
- - (Couchbase::Error::Base) error readonly
- - (Fixnum) flags readonly
-
- (Boolean) from_master
(also: #from_master?)
readonly
True if key stored on master.
-
- (Hash) headers
readonly
HTTP headers.
- - (String) key readonly
- - (String) node readonly
- - (Symbol) operation readonly
-
- (Symbol) status
readonly
Status of the key.
-
- (Fixnum) time_to_persist
(also: #ttp)
readonly
Average time needed to persist key on the disk (zero if unavailable).
-
- (Fixnum) time_to_replicate
(also: #ttr)
readonly
Average time needed to replicate key on the disk (zero if unavailable).
- - (String) value readonly
Instance Method Summary (collapse)
-
- (Result) initialize(attrs = {})
constructor
A new instance of Result.
-
- (String) inspect
Returns a string containing a human-readable representation of the Result.
-
- (true, ...) success?
Check if result of operation was successful.
Constructor Details
- (Result) initialize(attrs = {})
A new instance of Result
20 21 22 23 24 |
# File 'lib/couchbase/result.rb', line 20 def initialize(attrs = {}) attrs.each do |k, v| instance_variable_set("@#{k}", v) if respond_to?(k) end end |
Instance Attribute Details
- (Fixnum) cas (readonly)
- (Boolean) completed (readonly) Also known as: completed?
In Bucket::CouchRequest operations used to mark the final call
- (Couchbase::Error::Base) error (readonly)
- (Fixnum) flags (readonly)
- (Boolean) from_master (readonly) Also known as: from_master?
True if key stored on master
- (Hash) headers (readonly)
HTTP headers
- (String) key (readonly)
- (String) node (readonly)
- (Symbol) operation (readonly)
- (Symbol) status (readonly)
Status of the key. Possible values:
| :found : | Key found in cache, but not yet persisted |
| :persisted : | Key found and persisted |
| :not_found : | Key not found |
- (Fixnum) time_to_persist (readonly) Also known as: ttp
Average time needed to persist key on the disk (zero if unavailable)
- (Fixnum) time_to_replicate (readonly) Also known as: ttr
Average time needed to replicate key on the disk (zero if unavailable)
- (String) value (readonly)
Instance Method Details
- (String) inspect
Returns a string containing a human-readable representation of the Result.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'ext/couchbase_ext/result.c', line 41 VALUE cb_result_inspect(VALUE self) { VALUE str, attr; char buf[100]; str = rb_str_buf_new2("#<"); rb_str_buf_cat2(str, rb_obj_classname(self)); snprintf(buf, 100, ":%p", (void *)self); rb_str_buf_cat2(str, buf); attr = rb_ivar_get(self, cb_id_iv_operation); if (RTEST(attr)) { rb_str_buf_cat2(str, " operation="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_error); if (RTEST(attr)) { rb_str_buf_cat2(str, " error="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_key); if (RTEST(attr)) { rb_str_buf_cat2(str, " key="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_status); if (RTEST(attr)) { rb_str_buf_cat2(str, " status="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_cas); if (RTEST(attr)) { rb_str_buf_cat2(str, " cas="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_flags); if (RTEST(attr)) { rb_str_buf_cat2(str, " flags=0x"); rb_str_append(str, rb_funcall(attr, cb_id_to_s, 1, INT2FIX(16))); } attr = rb_ivar_get(self, cb_id_iv_node); if (RTEST(attr)) { rb_str_buf_cat2(str, " node="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_from_master); if (attr != Qnil) { rb_str_buf_cat2(str, " from_master="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_time_to_persist); if (RTEST(attr)) { rb_str_buf_cat2(str, " time_to_persist="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_time_to_replicate); if (RTEST(attr)) { rb_str_buf_cat2(str, " time_to_replicate="); rb_str_append(str, rb_inspect(attr)); } attr = rb_ivar_get(self, cb_id_iv_headers); if (RTEST(attr)) { rb_str_buf_cat2(str, " headers="); rb_str_append(str, rb_inspect(attr)); } rb_str_buf_cat2(str, ">"); return str; } |
- (true, ...) success?
Check if result of operation was successful.
28 29 30 31 32 |
# File 'ext/couchbase_ext/result.c', line 28 VALUE cb_result_success_p(VALUE self) { return RTEST(rb_ivar_get(self, cb_id_iv_error)) ? Qfalse : Qtrue; } |