Class InMemoryEventLog
java.lang.Object
es.urjc.etsii.grafo.events.InMemoryEventLog
Append-only in-memory event replay log.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(EventEnvelope envelope) Store a published event envelope.getEvent(int id) Get a single event by id.getEvents(int from, int to) Get events in range [from, to).Get the last published event.intsize()Count stored events.
-
Constructor Details
-
InMemoryEventLog
public InMemoryEventLog()
-
-
Method Details
-
append
Store a published event envelope.- Parameters:
envelope- event envelope
-
getEvents
Get events in range [from, to).- Parameters:
from- inclusive start indexto- exclusive end index- Returns:
- event envelopes in the requested range
-
getEvent
Get a single event by id.- Parameters:
id- event id- Returns:
- event envelope
-
getLastEvent
-
size
public int size()Count stored events.- Returns:
- event count
-