Class: Haplocheirus::TimelineSegment

Inherits:
Object
  • Object
show all
Includes:
Thrift::Struct, Thrift::Struct_Union
Defined in:
lib/haplocheirus.rb,
lib/haplocheirus/thrift/timeline_store_types.rb

Overview

Nice-to-haves…

Constant Summary collapse

ENTRIES =
1
SIZE =
2
STATE =
3
FIELDS =
{
  ENTRIES => {:type => ::Thrift::Types::LIST, :name => 'entries', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
  SIZE => {:type => ::Thrift::Types::I32, :name => 'size'},
  STATE => {:type => ::Thrift::Types::I32, :name => 'state', :default =>         0, :optional => true, :enum_class => Haplocheirus::TimelineSegmentState}
}

Instance Method Summary collapse

Instance Method Details

#hit?Boolean

:nodoc:

Returns:

  • (Boolean)


26
27
28
# File 'lib/haplocheirus.rb', line 26

def hit?
  state == TimelineSegmentState::HIT
end

#miss?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/haplocheirus.rb', line 30

def miss?
  state == TimelineSegmentState::MISS
end

#struct_fieldsObject



52
# File 'lib/haplocheirus/thrift/timeline_store_types.rb', line 52

def struct_fields; FIELDS; end

#timeout?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/haplocheirus.rb', line 34

def timeout?
  state == TimelineSegmentState::TIMEOUT
end

#validateObject



54
55
56
57
58
# File 'lib/haplocheirus/thrift/timeline_store_types.rb', line 54

def validate
  unless @state.nil? || Haplocheirus::TimelineSegmentState::VALID_VALUES.include?(@state)
    raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field state!')
  end
end