Class: Synapse::EventStore::Mongo::Template

Inherits:
Common::Mongo::BaseTemplate show all
Defined in:
lib/synapse/event_store/mongo/template.rb

Overview

Template for accessing collections needed by the event store

Instance Attribute Summary collapse

Attributes inherited from Common::Mongo::BaseTemplate

#database_name, #password, #username

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ undefined

Parameters:

  • client (Mongo::MongoClient)


14
15
16
17
18
19
# File 'lib/synapse/event_store/mongo/template.rb', line 14

def initialize(client)
  super

  @event_collection_name = 'domain_events'
  @snapshot_collection_name = 'snapshot_events'
end

Instance Attribute Details

#event_collection_nameString

Returns Name of the collection containing domain events.

Returns:

  • (String)

    Name of the collection containing domain events



7
8
9
# File 'lib/synapse/event_store/mongo/template.rb', line 7

def event_collection_name
  @event_collection_name
end

#snapshot_collection_nameString

Returns Name of the collection containing snapshot events.

Returns:

  • (String)

    Name of the collection containing snapshot events



10
11
12
# File 'lib/synapse/event_store/mongo/template.rb', line 10

def snapshot_collection_name
  @snapshot_collection_name
end

Instance Method Details

#event_collectionMongo::Collection

Returns:

  • (Mongo::Collection)


22
23
24
# File 'lib/synapse/event_store/mongo/template.rb', line 22

def event_collection
  database.collection @event_collection_name
end

#snapshot_collectionMongo::Collection

Returns:

  • (Mongo::Collection)


27
28
29
# File 'lib/synapse/event_store/mongo/template.rb', line 27

def snapshot_collection
  database.collection @snapshot_collection_name
end