Class: RecordsSource
- Inherits:
 - 
      Object
      
        
- Object
 - RecordsSource
 
 
- Defined in:
 - service/records.rb
 
Overview
Source of History records class
Direct Known Subclasses
OpenNebula::DiskRecords, OpenNebula::Records, OpenNebula::SnapshotRecords, OpenNebula::TrafficRecords
Instance Attribute Summary collapse
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute id.
 
Class Method Summary collapse
- 
  
    
      .check_source(_vm)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Check if source should be used with given VM.
 - 
  
    
      .tl_filter(records)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Filter records needed for Showback Timeline.
 
Instance Method Summary collapse
- 
  
    
      #find(stime, etime)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Find records for given time period.
 - 
  
    
      #init_state(_stime)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Initial timeline state.
 - 
  
    
      #initialize(cls, id)  ⇒ RecordsSource 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of RecordsSource.
 - 
  
    
      #key  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
VMID field key.
 - 
  
    
      #records  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Return all records for this VM(@id).
 
Constructor Details
#initialize(cls, id) ⇒ RecordsSource
Returns a new instance of RecordsSource.
      11 12 13 14  | 
    
      # File 'service/records.rb', line 11 def initialize cls, id @id = id @records = cls.where(Hash[key, @id]) end  | 
  
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
      3 4 5  | 
    
      # File 'service/records.rb', line 3 def id @id end  | 
  
Class Method Details
.check_source(_vm) ⇒ Object
Check if source should be used with given VM
      37 38 39  | 
    
      # File 'service/records.rb', line 37 def self.check_source _vm true end  | 
  
.tl_filter(records) ⇒ Object
Filter records needed for Showback Timeline
      32 33 34  | 
    
      # File 'service/records.rb', line 32 def self.tl_filter records records end  | 
  
Instance Method Details
#find(stime, etime) ⇒ Object
Find records for given time period
      22 23 24  | 
    
      # File 'service/records.rb', line 22 def find stime, etime @records.where(time: stime..etime) end  | 
  
#init_state(_stime) ⇒ Object
Initial timeline state
      27 28 29  | 
    
      # File 'service/records.rb', line 27 def init_state _stime {} end  | 
  
#key ⇒ Object
VMID field key
      6 7 8  | 
    
      # File 'service/records.rb', line 6 def key :id end  | 
  
#records ⇒ Object
Return all records for this VM(@id)
      17 18 19  | 
    
      # File 'service/records.rb', line 17 def records @records.all end  |