Class: HbaseAdapter::BatchMutation
- Inherits:
-
Object
- Object
- HbaseAdapter::BatchMutation
- Defined in:
- lib/hbase_adapter/mutation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#mutations ⇒ Object
readonly
Returns the value of attribute mutations.
Instance Method Summary collapse
- #delete(column) ⇒ Object
-
#initialize(key, &blk) ⇒ BatchMutation
constructor
A new instance of BatchMutation.
- #to_thrift ⇒ Object
- #update(column, value) ⇒ Object
Constructor Details
#initialize(key, &blk) ⇒ BatchMutation
Returns a new instance of BatchMutation.
63 64 65 66 67 68 |
# File 'lib/hbase_adapter/mutation.rb', line 63 def initialize(key, &blk) @key = key @mutations = [] self.instance_eval(&blk) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
61 62 63 |
# File 'lib/hbase_adapter/mutation.rb', line 61 def key @key end |
#mutations ⇒ Object (readonly)
Returns the value of attribute mutations.
61 62 63 |
# File 'lib/hbase_adapter/mutation.rb', line 61 def mutations @mutations end |
Instance Method Details
#delete(column) ⇒ Object
74 75 76 |
# File 'lib/hbase_adapter/mutation.rb', line 74 def delete(column) @mutations << DeleteMutation.new(column) end |
#to_thrift ⇒ Object
78 79 80 81 82 83 |
# File 'lib/hbase_adapter/mutation.rb', line 78 def to_thrift Apache::Hadoop::Hbase::Thrift::BatchMutation.new( :row => key, :mutations => mutations.map {|m| m.to_thrift} ) end |
#update(column, value) ⇒ Object
70 71 72 |
# File 'lib/hbase_adapter/mutation.rb', line 70 def update(column, value) @mutations << UpdateMutation.new(column, value) end |