class DruidConfig::Entities::Segment

Segment class

Attributes

binary_version[R]

Readers

dimensions[R]

Readers

id[R]

Readers

interval[R]

Readers

load_spec[R]

Readers

metrics[R]

Readers

shard_spec[R]

Readers

size[R]

Readers

version[R]

Readers

Public Class Methods

new(metadata) click to toggle source

Initialize it with received info

Parameters:

metadata

Hash with returned metadata from Druid

# File lib/druid_config/entities/segment.rb, line 18
def initialize(metadata)
  @id = metadata['identifier']
  @interval = metadata['interval'].split('/').map { |t| Time.parse t }
  @version = Time.parse metadata['version']
  @load_spec = metadata['loadSpec']
  @dimensions = metadata['dimensions'].split(',').map(&:to_sym)
  @metrics = metadata['metrics'].split(',').map(&:to_sym)
  @shard_spec = metadata['shardSpec']
  @binary_version = metadata['binaryVersion']
  @size = metadata['size']
end

Public Instance Methods

store_type() click to toggle source

Return the store type

Returns:

Store type as symbol

# 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() click to toggle source

Return direct link to the store

Returns:

String with the URI

# 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() click to toggle source

By default, show the identifier in To_s

# File lib/druid_config/entities/segment.rb, line 55
def to_s
  @id
end