Class: OpenNebula::SnapshotRecords
- Inherits:
-
RecordsSource
- Object
- RecordsSource
- OpenNebula::SnapshotRecords
- Defined in:
- service/records/records.rb
Overview
(Snapshot)Records source class for fullfilling Timeline
Instance Attribute Summary
Attributes inherited from RecordsSource
Instance Method Summary collapse
-
#find(stime, etime) ⇒ Object
Returns all needed records for given timerange.
-
#init_state(stime) ⇒ Object
Gets All of the SnapshotRecords before stime and with deletion time greater than stime or nil and counts(which is initial quantity of snaps).
-
#initialize(id) ⇒ SnapshotRecords
constructor
inits RecordsSource class with SnapshotRecord class as base.
-
#key ⇒ Object
Overrides key for db queries.
Methods inherited from RecordsSource
check_source, #records, tl_filter
Constructor Details
#initialize(id) ⇒ SnapshotRecords
inits RecordsSource class with SnapshotRecord class as base
122 123 124 |
# File 'service/records/records.rb', line 122 def initialize id super(SnapshotRecord, id) end |
Instance Method Details
#find(stime, etime) ⇒ Object
Returns all needed records for given timerange
127 128 129 |
# File 'service/records/records.rb', line 127 def find stime, etime @records.where(crt: stime..etime).or(del: stime..etime) end |
#init_state(stime) ⇒ Object
Gets All of the SnapshotRecords before stime and with deletion time greater than stime or nil and counts(which is initial quantity of snaps)
132 133 134 135 136 137 |
# File 'service/records/records.rb', line 132 def init_state stime # SELECT * FROM "snapshot_records" WHERE (("del" >= 15) OR ("del" IS NULL)) { snaps: @records.where { crt < stime }.where { (del >= stime) | Sequel[del: nil] }.count } end |
#key ⇒ Object
Overrides key for db queries
117 118 119 |
# File 'service/records/records.rb', line 117 def key :vm end |