Class: ElasticGraph::Indexer::EventID

Inherits:
Data
  • Object
show all
Defined in:
lib/elastic_graph/indexer/event_id.rb

Overview

A unique identifier for an event ingested by the indexer. As a string, takes the form of “[type]:@v”, such as “Widget:123abc@v7”. This format was designed to make it easy to put these ids in a comma-seperated list.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



16
17
18
# File 'lib/elastic_graph/indexer/event_id.rb', line 16

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



16
17
18
# File 'lib/elastic_graph/indexer/event_id.rb', line 16

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



16
17
18
# File 'lib/elastic_graph/indexer/event_id.rb', line 16

def version
  @version
end

Class Method Details

.from_event(event) ⇒ Object



18
19
20
# File 'lib/elastic_graph/indexer/event_id.rb', line 18

def self.from_event(event)
  new(type: event["type"], id: event["id"], version: event["version"])
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/elastic_graph/indexer/event_id.rb', line 22

def to_s
  "#{type}:#{id}@v#{version}"
end