public interface EventStore
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all data from the database!
|
void |
close()
Closes the event store.
|
java.lang.Number[] |
getAggregate(java.lang.String streamName,
java.lang.String attribute,
long startTime,
long endTime)
Returns the aggregates for the given stream and the given attribute within the given time interval.
|
java.util.Iterator<Event> |
getBackwardsHistory(java.lang.String streamName)
Returns the complete history of the given stream, beginning at the last
inserted event and iterating backwards through the history.
|
long |
getEventCount(java.lang.String streamName)
Returns the number of events inserted into the given stream since the last reset.
|
long |
getEventStoreCapacity()
Returns the capacity of the event store.
|
java.util.Iterator<Event> |
getFreshestHistory(java.lang.String streamName,
long startTime)
Returns the complete history of an event stream beginning from a user-defined instant of time
ordered by time.
|
java.util.Iterator<Event> |
getHistory(java.lang.String streamName)
Returns the complete history of an event stream ordered by time(relation scan).
|
java.util.Iterator<Event> |
getHistoryPoint(java.lang.String streamName,
long timestamp)
Returns all historical events of an event stream for a given point in time ordered by time (temporal point query).
|
java.util.Iterator<Event> |
getHistoryRange(java.lang.String streamName,
long startTime,
long endTime)
Returns all historical events of an event stream for a given range of time ordered by time (temporal range query).
|
Attribute[] |
getLastCompiledSchema()
Returns the last compiled schema of the event storem
|
long |
getLastTimestamp(java.lang.String streamName)
Returns the time stamp of the last inserted event.
|
java.util.Set<java.lang.String> |
getRegisteredStreams()
Returns all registered event streams.
|
Attribute[] |
getSchema(java.lang.String streamName)
Returns the schema for the given event stream.
|
long |
getStreamSize(java.lang.String streamName)
Returns the total size of the stream in bytes.
|
long |
getTotalEventCount()
Returns the total number of events inserted, counting from the last reset
|
void |
open()
Opens the event store.
|
void |
pushEvent(java.lang.String streamName,
java.lang.Object[] event)
Pushes a new event into the event store.
|
void |
pushEvent(java.lang.String streamName,
java.lang.Object[] payload,
long timestamp)
Pushes a new event into the event store.
|
java.util.Iterator<Event> |
query(java.lang.String sql)
Queries the event store with the given SQL query.
|
java.util.Iterator<Event> |
queryAttribute(java.lang.String streamName,
java.lang.String attribute,
java.lang.Comparable minKey,
java.lang.Comparable maxKey)
Queries the given attribute of the given stream and returns all events with the given attribute
value between minKey and maxKey in temporal order.
|
java.util.Iterator<Event> |
queryAttribute(java.lang.String streamName,
java.lang.String attribute,
java.lang.Comparable minKey,
java.lang.Comparable maxKey,
long startTime,
long endTime)
Queries the given attribute of the given stream and returns all events with the given attribute
value between minKey and maxKey in the given time range in temporal order.
|
java.util.Iterator<Event> |
queryAttributes(java.lang.String streamName,
long startTime,
long endTime,
java.util.Map<java.lang.String,xxl.core.util.Pair<? extends java.lang.Number,? extends java.lang.Number>> attributeRanges)
Queries the given attribute of the given stream and returns all events with the given attribute
value between the given ranges in temporal order.
|
void |
registerStream(java.lang.String streamName,
Attribute[] schema)
Registers a new event stream.
|
void |
removeStream(java.lang.String streamName)
Removes a stream and all stored events from the event store completely.
|
void |
resumeStream(java.lang.String streamName)
Resumes a stream after being suspended.
|
void |
setEventStoreCapacity(int capacity,
CapacityUnit capacityUnit)
Sets the capacity of the event store.
|
boolean |
supportsAggregates()
Returns if the event store supports (materialized) aggregates, i.e.
|
void |
suspendStream(java.lang.String streamName)
Suspends a stream and frees all handlers on it.
|
void |
unregisterStream(java.lang.String streamName)
Unregisters a event stream.
|
void |
updateEvent(java.lang.String streamName,
java.lang.Object[] payload)
Updates an event in the event store.
|
void open()
void close()
void clear()
void registerStream(java.lang.String streamName, Attribute[] schema)
streamName
- the name of the event stream to registerschema
- the schema of the event stream to registerAttribute[] getSchema(java.lang.String streamName)
streamName
- the name of the event streamvoid unregisterStream(java.lang.String streamName)
removeStream
, this
method preserves old events of a stream within the store.streamName
- the name of the event stream to unregistervoid suspendStream(java.lang.String streamName)
streamName
- The name of the stream to be suspendedvoid resumeStream(java.lang.String streamName)
streamName
- The name of the stream to be resumedvoid removeStream(java.lang.String streamName)
streamName
- the name of the sevent stream to removelong getLastTimestamp(java.lang.String streamName)
streamName
- the name of the event streamlong getTotalEventCount()
long getEventCount(java.lang.String streamName)
streamName
- the name of the stream which event count should be reportedlong getStreamSize(java.lang.String streamName)
streamName
- the name of the streamjava.util.Set<java.lang.String> getRegisteredStreams()
void pushEvent(java.lang.String streamName, java.lang.Object[] event)
streamName
- the corresponding event stream of the new eventevent
- the new event that is pushed into the event storevoid pushEvent(java.lang.String streamName, java.lang.Object[] payload, long timestamp)
streamName
- the corresponding event stream of the new eventpayload
- the new event that is pushed into the event storetimestamp
- the timestamp of the new eventvoid updateEvent(java.lang.String streamName, java.lang.Object[] payload)
streamName
- the name of the event streampayload
- the new payload of the streamjava.util.Iterator<Event> getBackwardsHistory(java.lang.String streamName)
java.util.Iterator<Event> getFreshestHistory(java.lang.String streamName, long startTime)
streamName
- the event streamstartTime
- the start instant of timestartTime
java.util.Iterator<Event> getHistory(java.lang.String streamName)
streamName
- the event streamjava.util.Iterator<Event> getHistoryPoint(java.lang.String streamName, long timestamp)
streamName
- the event streamtimestamp
- the point in timejava.util.Iterator<Event> getHistoryRange(java.lang.String streamName, long startTime, long endTime)
streamName
- the event streamstartTime
- the beginning of the rangeendTime
- the end of the rangejava.util.Iterator<Event> queryAttributes(java.lang.String streamName, long startTime, long endTime, java.util.Map<java.lang.String,xxl.core.util.Pair<? extends java.lang.Number,? extends java.lang.Number>> attributeRanges) throws java.lang.UnsupportedOperationException
streamName
- the event streamstartTime
- the beginning of the rangeendTime
- the end of the rangeattributeRanges
- a map containing the attribute ranges for the attributesjava.lang.UnsupportedOperationException
java.lang.Number[] getAggregate(java.lang.String streamName, java.lang.String attribute, long startTime, long endTime) throws java.lang.UnsupportedOperationException
streamName
- the name of the stream that should be queriedattribute
- the attribute that should be aggregatedstartTime
- the start timeendTime
- the end timejava.lang.UnsupportedOperationException
boolean supportsAggregates()
java.util.Iterator<Event> queryAttribute(java.lang.String streamName, java.lang.String attribute, java.lang.Comparable minKey, java.lang.Comparable maxKey) throws java.lang.UnsupportedOperationException
streamName
- the event streamattribute
- the attribute to query forminKey
- the minimum key value for the given attributemaxKey
- the maximum key value for the given attributejava.lang.UnsupportedOperationException
java.util.Iterator<Event> queryAttribute(java.lang.String streamName, java.lang.String attribute, java.lang.Comparable minKey, java.lang.Comparable maxKey, long startTime, long endTime) throws java.lang.UnsupportedOperationException
streamName
- the event streamattribute
- the attribute to query forminKey
- the minimum key value for the given attributemaxKey
- the maximum key value for the given attributestartTime
- the beginning of the range to queryendTime
- the end of the range to queryjava.lang.UnsupportedOperationException
java.util.Iterator<Event> query(java.lang.String sql)
sql
- the query as SQL query stringvoid setEventStoreCapacity(int capacity, CapacityUnit capacityUnit)
capacity
- the capacity of the event storecapacityUnit
- the unit that specifies how to interpret the capacitylong getEventStoreCapacity()
Attribute[] getLastCompiledSchema()