Class: Euston::EventStore::Snapshot

Inherits:
Object
  • Object
show all
Includes:
Persistence::Mongodb::MongoSnapshot
Defined in:
lib/euston-eventstore/snapshot.rb,
lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb

Overview

Represents a materialized view of a stream at specific revision.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Persistence::Mongodb::MongoSnapshot

from_hash, #to_hash

Constructor Details

#initialize(stream_id, stream_revision, payload, headers = nil) ⇒ Snapshot

Returns a new instance of Snapshot.



5
6
7
8
9
10
# File 'lib/euston-eventstore/snapshot.rb', line 5

def initialize stream_id, stream_revision, payload, headers = nil
  @stream_id = stream_id
  @stream_revision = stream_revision
  @payload = payload
  @headers = headers || {}
end

Instance Attribute Details

#headersObject (readonly)

Gets the metadata which provides additional, unstructured information about this snapshot.



22
23
24
# File 'lib/euston-eventstore/snapshot.rb', line 22

def headers
  @headers
end

#payloadObject (readonly)

Gets the snapshot or materialized view of the stream at the revision indicated.



19
20
21
# File 'lib/euston-eventstore/snapshot.rb', line 19

def payload
  @payload
end

#stream_idObject (readonly)

Gets the value which uniquely identifies the stream to which the snapshot applies.



13
14
15
# File 'lib/euston-eventstore/snapshot.rb', line 13

def stream_id
  @stream_id
end

#stream_revisionObject (readonly)

Gets the position at which the snapshot applies.



16
17
18
# File 'lib/euston-eventstore/snapshot.rb', line 16

def stream_revision
  @stream_revision
end