eventric storage definition
Definition of the eventric storage interface and feature specs which can be executed for storage implementations.
API
eventric storage implementations must conform to the following interface:
saveDomainEvent(domainEvent)
Saves a domain event into the stores and returns a promise which resolves after saving
findDomainEvents({aggregateId, startingAtTimestamp})
Searches for domain events in the storage and returns a promise which resolves with the found domain events. If an aggregate id is specified, only domain events with matching property aggregate.id must be returned. If a timestamp is specified, only domain events with property timestamp equal of greater must be returned.
getProjectionStore(projectionName)
Returns a promise which resolves with a unique store for a given projection name.
Note: This is storage implementation specific.
clearProjectionStore(projectionName)
Clears the unique store for a given projection name and returns a promise which resolves after clearing
Note: This is storage implementation specific.
Running feature specs inside storage implementations
The feature specs can be executed to verify a storage implementation is conforming to the above defined interface:
eventricStorage = require 'eventric-storage'eventricStoragerunFeatureSpecs
Note: The specs require mocha.