Class: Google::Cloud::Bigtable::GcRule
- Inherits:
-
Object
- Object
- Google::Cloud::Bigtable::GcRule
- Defined in:
- lib/google/cloud/bigtable/gc_rule.rb
Overview
GcRule
Rule for determining which cells to delete during garbage collection. Garbage collection executes opportunistically in the background, and so it's possible for reads to return a cell even if it matches the active GC expression for its family.
NOTE: GC Rule can hold only one type at a time. GC Rule types:
max_num_versions
- Delete all cells in a column except the most recent Nmax_age
- Delete cells in a column older than the given age.union
- Delete cells that would be deleted by every nested rule. It can have mutiple chainable GC Rules.intersection
- Delete cells that would be deleted by any nested rule. It can have mutiple chainable GC Rules.
Class Method Summary collapse
-
.intersection(*rules) ⇒ Google::Bigtable::Admin::V2::GcRule
Create intersection GCRule instance.
-
.max_age(age) ⇒ Google::Bigtable::Admin::V2::GcRule
Create GcRule instance with max age.
-
.max_versions(versions) ⇒ Google::Bigtable::Admin::V2::GcRule
Create GcRule instance with max number of versions.
-
.union(*rules) ⇒ Google::Bigtable::Admin::V2::GcRule
Create union GcRule instance.
Instance Method Summary collapse
-
#intersection ⇒ Google::Bigtable::Admin::V2::GcRule::Intersection?
Get intersection GC rules.
-
#intersection=(rules) ⇒ Object
Delete cells that would be deleted by every nested rule.
-
#max_age ⇒ Integer?
Max age in seconds, if max age is set.
-
#max_age=(age) ⇒ Object
Delete cells in a column older than the given age.
-
#max_versions ⇒ Integer?
Get max versions.
-
#max_versions=(versions) ⇒ Object
Delete all cells in a column except the most recent N.
-
#union ⇒ Google::Bigtable::Admin::V2::GcRule::Union?
Get union GC rules.
-
#union=(rules) ⇒ Object
Delete cells that would be deleted by any nested rule.
Class Method Details
.intersection(*rules) ⇒ Google::Bigtable::Admin::V2::GcRule
Create intersection GCRule instance.
190 191 192 193 194 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 190 def self.intersection *rules new.tap do |gc_rule| gc_rule.intersection = rules end end |
.max_age(age) ⇒ Google::Bigtable::Admin::V2::GcRule
Create GcRule instance with max age.
166 167 168 169 170 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 166 def self.max_age age new.tap do |gc_rule| gc_rule.max_age = age end end |
.max_versions(versions) ⇒ Google::Bigtable::Admin::V2::GcRule
Create GcRule instance with max number of versions.
155 156 157 158 159 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 155 def self.max_versions versions new.tap do |gc_rule| gc_rule.max_versions = versions end end |
.union(*rules) ⇒ Google::Bigtable::Admin::V2::GcRule
Create union GcRule instance.
178 179 180 181 182 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 178 def self.union *rules new.tap do |gc_rule| gc_rule.union = rules end end |
Instance Method Details
#intersection ⇒ Google::Bigtable::Admin::V2::GcRule::Intersection?
Get intersection GC rules
127 128 129 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 127 def intersection @grpc.intersection end |
#intersection=(rules) ⇒ Object
Delete cells that would be deleted by every nested rule.
116 117 118 119 120 121 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 116 def intersection= rules @grpc.intersection = \ Google::Bigtable::Admin::V2::GcRule::Intersection.new( rules: rules.map(&:to_grpc) ) end |
#max_age ⇒ Integer?
Max age in seconds, if max age is set.
107 108 109 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 107 def max_age @grpc.max_age.seconds if @grpc.max_age end |
#max_age=(age) ⇒ Object
Delete cells in a column older than the given age. Values must be at least one millisecond, and will be truncated to microsecond granularity.
99 100 101 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 99 def max_age= age @grpc.max_age = Convert.number_to_duration(age) end |
#max_versions ⇒ Integer?
Get max versions.
89 90 91 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 89 def max_versions @grpc.max_num_versions end |
#max_versions=(versions) ⇒ Object
Delete all cells in a column except the most recent N.
81 82 83 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 81 def max_versions= versions @grpc.max_num_versions = versions end |
#union ⇒ Google::Bigtable::Admin::V2::GcRule::Union?
Get union GC rules
146 147 148 |
# File 'lib/google/cloud/bigtable/gc_rule.rb', line 146 def union @grpc.union end |