Class: DruidConfig::Entities::Segment
- Inherits:
-
Object
- Object
- DruidConfig::Entities::Segment
- Defined in:
- lib/druid_config/entities/segment.rb
Overview
Segment class
Instance Attribute Summary collapse
-
#binary_version ⇒ Object
readonly
Readers.
-
#dimensions ⇒ Object
readonly
Readers.
-
#id ⇒ Object
readonly
Readers.
-
#interval ⇒ Object
readonly
Readers.
-
#load_spec ⇒ Object
readonly
Readers.
-
#metrics ⇒ Object
readonly
Readers.
-
#shard_spec ⇒ Object
readonly
Readers.
-
#size ⇒ Object
readonly
Readers.
-
#version ⇒ Object
readonly
Readers.
Instance Method Summary collapse
-
#initialize(metadata) ⇒ Segment
constructor
Initialize it with received info.
-
#store_type ⇒ Object
Return the store type.
-
#store_uri ⇒ Object
Return direct link to the store.
-
#to_s ⇒ Object
By default, show the identifier in To_s.
Constructor Details
#initialize(metadata) ⇒ Segment
Initialize it with received info
Parameters:
- metadata
-
Hash with returned metadata from Druid
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/druid_config/entities/segment.rb', line 18 def initialize() @id = ['identifier'] @interval = ['interval'].split('/').map { |t| Time.parse t } @version = Time.parse ['version'] @load_spec = ['loadSpec'] @dimensions = ['dimensions'].split(',').map(&:to_sym) @metrics = ['metrics'].split(',').map(&:to_sym) @shard_spec = ['shardSpec'] @binary_version = ['binaryVersion'] @size = ['size'] end |
Instance Attribute Details
#binary_version ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def binary_version @binary_version end |
#dimensions ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def dimensions @dimensions end |
#id ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def id @id end |
#interval ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def interval @interval end |
#load_spec ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def load_spec @load_spec end |
#metrics ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def metrics @metrics end |
#shard_spec ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def shard_spec @shard_spec end |
#size ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def size @size end |
#version ⇒ Object (readonly)
Readers
8 9 10 |
# File 'lib/druid_config/entities/segment.rb', line 8 def version @version end |
Instance Method Details
#store_type ⇒ Object
Return the store type
Returns:
Store type as symbol
47 48 49 50 |
# File 'lib/druid_config/entities/segment.rb', line 47 def store_type return nil if load_spec.empty? load_spec['type'].to_sym end |
#store_uri ⇒ Object
Return direct link to the store
Returns:
String with the URI
36 37 38 39 |
# File 'lib/druid_config/entities/segment.rb', line 36 def store_uri return '' if load_spec.empty? "s3://#{load_spec['bucket']}/#{load_spec['key']}" end |
#to_s ⇒ Object
By default, show the identifier in To_s
55 56 57 |
# File 'lib/druid_config/entities/segment.rb', line 55 def to_s @id end |