Class: DruidConfig::Entities::DataSource
- Inherits:
-
Object
- Object
- DruidConfig::Entities::DataSource
- Includes:
- HTTParty
- Defined in:
- lib/druid_config/entities/data_source.rb
Overview
Init a DataSource
Instance Attribute Summary collapse
-
#load_status ⇒ Object
readonly
Returns the value of attribute load_status.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #history_rules(interval) ⇒ Object
-
#info(params = '') ⇒ Object
The following methods are referenced to Druid API.
-
#initialize(metadata, load_status) ⇒ DataSource
constructor
Initialize a DataSource.
- #interval(interval, params = '') ⇒ Object
-
#intervals(params = '') ⇒ Object
Intervals —————–.
-
#rules(params = '') ⇒ Object
Rules —————–.
- #segment(segment) ⇒ Object
-
#segments ⇒ Object
Segments and Tiers —————–.
- #tiers ⇒ Object
Constructor Details
#initialize(metadata, load_status) ⇒ DataSource
Initialize a DataSource
17 18 19 20 21 22 23 24 25 |
# File 'lib/druid_config/entities/data_source.rb', line 17 def initialize(, load_status) @name = ['name'] @properties = ['properties'] @load_status = load_status # Set end point for HTTParty self.class.base_uri( "#{DruidConfig.client.coordinator}"\ "druid/coordinator/#{DruidConfig::Version::API_VERSION}") end |
Instance Attribute Details
#load_status ⇒ Object (readonly)
Returns the value of attribute load_status.
12 13 14 |
# File 'lib/druid_config/entities/data_source.rb', line 12 def load_status @load_status end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/druid_config/entities/data_source.rb', line 12 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
12 13 14 |
# File 'lib/druid_config/entities/data_source.rb', line 12 def properties @properties end |
Instance Method Details
#history_rules(interval) ⇒ Object
72 73 74 75 |
# File 'lib/druid_config/entities/data_source.rb', line 72 def history_rules(interval) self.class.get("/rules/#{@name}/history"\ "?interval=#{interval}") end |
#info(params = '') ⇒ Object
The following methods are referenced to Druid API. To check the funcionality about it, please go to Druid documentation:
34 35 36 |
# File 'lib/druid_config/entities/data_source.rb', line 34 def info(params = '') @info ||= self.class.get("/datasources/#{@name}?#{params}") end |
#interval(interval, params = '') ⇒ Object
44 45 46 47 |
# File 'lib/druid_config/entities/data_source.rb', line 44 def interval(interval, params = '') self.class.get("/datasources/#{@name}/intervals/#{interval}"\ "?#{params}") end |
#intervals(params = '') ⇒ Object
Intervals
40 41 42 |
# File 'lib/druid_config/entities/data_source.rb', line 40 def intervals(params = '') self.class.get("/datasources/#{@name}/intervals?#{params}") end |
#rules(params = '') ⇒ Object
Rules
68 69 70 |
# File 'lib/druid_config/entities/data_source.rb', line 68 def rules(params = '') self.class.get("/rules/#{@name}?#{params}") end |
#segment(segment) ⇒ Object
58 59 60 |
# File 'lib/druid_config/entities/data_source.rb', line 58 def segment(segment) segments.select { |s| s.id == segment } end |
#segments ⇒ Object
Segments and Tiers
51 52 53 54 55 56 |
# File 'lib/druid_config/entities/data_source.rb', line 51 def segments @segments ||= self.class.get("/datasources/#{@name}/segments?full").map do |s| DruidConfig::Entities::Segment.new(s) end end |
#tiers ⇒ Object
62 63 64 |
# File 'lib/druid_config/entities/data_source.rb', line 62 def tiers info['tiers'] end |