Class: Flydata::Source::SourcePos

Inherits:
Component
  • Object
show all
Defined in:
lib/flydata/source/source_pos.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ SourcePos

Returns a new instance of SourcePos.



13
14
15
# File 'lib/flydata/source/source_pos.rb', line 13

def initialize(source)
  super(source)
end

Class Method Details

.inherited(child_class) ⇒ Object



9
10
11
# File 'lib/flydata/source/source_pos.rb', line 9

def self.inherited(child_class)
  Source.register(child_class, self)
end

Instance Method Details

#create_source_pos(source_pos_str) ⇒ Object

Public Interface: Create source pos

Returns a context-dependent position object that has the following methods: (includeng Comparable mixin is preferable)

  • all comparison operators (<=>, <, <=, >=, >, ==, !=)

  • to_s



25
26
27
# File 'lib/flydata/source/source_pos.rb', line 25

def create_source_pos(source_pos_str)
  raise UnsupportedSourceError,  "subclass must implement"
end

#resume_pos(source_pos) ⇒ Object

Public Interface: Back to last known safe source pos

Returns a source position object

A source pos may not be restart-able from the very position because there may be preceding records necessary to restart the source log playback. This method returns such a ‘safe’ position from which the source log can be played back.



38
39
40
# File 'lib/flydata/source/source_pos.rb', line 38

def resume_pos(source_pos)
  raise UnsupportedSourceError,  "subclass must implement"
end