Package io.siddhi.core.table
Class Table
- java.lang.Object
-
- io.siddhi.core.table.Table
-
- All Implemented Interfaces:
FindableProcessor,MemoryCalculable
- Direct Known Subclasses:
AbstractRecordTable,InMemoryTable
public abstract class Table extends Object implements FindableProcessor, MemoryCalculable
Interface class to represent Tables in Siddhi. There are multiple implementations. Ex:InMemoryTable. Table will support basic operations of add, delete, update, update or add and contains. *
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTable.OnErrorActionDifferent Type of On Error Actions
-
Field Summary
Fields Modifier and Type Field Description protected SiddhiAppContextsiddhiAppContextprotected io.siddhi.query.api.definition.TableDefinitiontableDefinitionMap<String,Table>tableMap
-
Constructor Summary
Constructors Constructor Description Table()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidadd(ComplexEventChunk<StreamEvent> addingEventChunk)voidaddEvents(ComplexEventChunk<StreamEvent> addingEventChunk, int noOfEvents)abstract CompiledUpdateSetcompileUpdateSet(io.siddhi.query.api.execution.query.output.stream.UpdateSet updateSet, MatchingMetaInfoHolder matchingMetaInfoHolder, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String,Table> tableMap, SiddhiQueryContext siddhiQueryContext)Builds the "compiled" set clause of an update query.protected abstract voidconnectAndLoadCache()voidconnectWithRetry()protected abstract booleancontains(StateEvent matchingEvent, CompiledCondition compiledCondition)booleancontainsEvent(StateEvent matchingEvent, CompiledCondition compiledCondition)abstract voiddelete(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition)voiddeleteEvents(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition, int noOfEvents)protected abstract voiddestroy()protected abstract voiddisconnect()StreamEventfind(StateEvent matchingEvent, CompiledCondition compiledCondition)To find events from the processor event pool, that the matches the matchingEvent based on finder logic.protected abstract StreamEventfind(CompiledCondition compiledCondition, StateEvent matchingEvent)RecordTableHandlergetHandler()booleangetIsConnected()booleangetIsTryingToConnect()io.siddhi.query.api.definition.TableDefinitiongetTableDefinition()protected abstract voidinit(io.siddhi.query.api.definition.TableDefinition tableDefinition, StreamEventFactory storeEventPool, StreamEventCloner storeEventCloner, ConfigReader configReader, SiddhiAppContext siddhiAppContext, RecordTableHandler recordTableHandler)voidinitTable(io.siddhi.query.api.definition.TableDefinition tableDefinition, StreamEventFactory storeEventPool, StreamEventCloner storeEventCloner, ConfigReader configReader, SiddhiAppContext siddhiAppContext, RecordTableHandler recordTableHandler)abstract booleanisStateful()protected voidonAddError(ComplexEventChunk<StreamEvent> addingEventChunk, Exception e)protected voidonDeleteError(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition, Exception e)protected voidonUpdateError(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, Exception e)protected voidonUpdateOrAddError(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor, Exception e)voidsetIsConnectedToFalse()voidshutdown()abstract voidupdate(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet)voidupdateEvents(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, int noOfEvents)abstract voidupdateOrAdd(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor)voidupdateOrAddEvents(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor, int noOfEvents)voidwaitWhileConnect()Busy wait the threads which bind to this object and control the execution flow until table connection recovered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.siddhi.core.query.processor.stream.window.FindableProcessor
compileCondition
-
-
-
-
Field Detail
-
tableDefinition
protected io.siddhi.query.api.definition.TableDefinition tableDefinition
-
siddhiAppContext
protected SiddhiAppContext siddhiAppContext
-
-
Method Detail
-
initTable
public void initTable(io.siddhi.query.api.definition.TableDefinition tableDefinition, StreamEventFactory storeEventPool, StreamEventCloner storeEventCloner, ConfigReader configReader, SiddhiAppContext siddhiAppContext, RecordTableHandler recordTableHandler)
-
init
protected abstract void init(io.siddhi.query.api.definition.TableDefinition tableDefinition, StreamEventFactory storeEventPool, StreamEventCloner storeEventCloner, ConfigReader configReader, SiddhiAppContext siddhiAppContext, RecordTableHandler recordTableHandler)
-
getTableDefinition
public io.siddhi.query.api.definition.TableDefinition getTableDefinition()
-
onAddError
protected void onAddError(ComplexEventChunk<StreamEvent> addingEventChunk, Exception e)
-
addEvents
public void addEvents(ComplexEventChunk<StreamEvent> addingEventChunk, int noOfEvents)
-
add
public abstract void add(ComplexEventChunk<StreamEvent> addingEventChunk)
-
find
public StreamEvent find(StateEvent matchingEvent, CompiledCondition compiledCondition)
Description copied from interface:FindableProcessorTo find events from the processor event pool, that the matches the matchingEvent based on finder logic.- Specified by:
findin interfaceFindableProcessor- Parameters:
matchingEvent- the event to be matched with the events at the processorcompiledCondition- the execution element responsible for matching the corresponding events that matches the matchingEvent based on pool of events at Processor- Returns:
- the matched events
-
find
protected abstract StreamEvent find(CompiledCondition compiledCondition, StateEvent matchingEvent) throws ConnectionUnavailableException
- Throws:
ConnectionUnavailableException
-
onDeleteError
protected void onDeleteError(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition, Exception e)
-
deleteEvents
public void deleteEvents(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition, int noOfEvents)
-
delete
public abstract void delete(ComplexEventChunk<StateEvent> deletingEventChunk, CompiledCondition compiledCondition)
-
onUpdateError
protected void onUpdateError(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, Exception e)
-
updateEvents
public void updateEvents(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, int noOfEvents)
-
update
public abstract void update(ComplexEventChunk<StateEvent> updatingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet)
-
onUpdateOrAddError
protected void onUpdateOrAddError(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor, Exception e)
-
updateOrAddEvents
public void updateOrAddEvents(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor, int noOfEvents)
-
updateOrAdd
public abstract void updateOrAdd(ComplexEventChunk<StateEvent> updateOrAddingEventChunk, CompiledCondition compiledCondition, CompiledUpdateSet compiledUpdateSet, AddingStreamEventExtractor addingStreamEventExtractor)
-
containsEvent
public boolean containsEvent(StateEvent matchingEvent, CompiledCondition compiledCondition)
-
contains
protected abstract boolean contains(StateEvent matchingEvent, CompiledCondition compiledCondition) throws ConnectionUnavailableException
- Throws:
ConnectionUnavailableException
-
connectWithRetry
public void connectWithRetry()
-
setIsConnectedToFalse
public void setIsConnectedToFalse()
-
getIsTryingToConnect
public boolean getIsTryingToConnect()
-
getIsConnected
public boolean getIsConnected()
-
waitWhileConnect
public void waitWhileConnect()
Busy wait the threads which bind to this object and control the execution flow until table connection recovered.
-
compileUpdateSet
public abstract CompiledUpdateSet compileUpdateSet(io.siddhi.query.api.execution.query.output.stream.UpdateSet updateSet, MatchingMetaInfoHolder matchingMetaInfoHolder, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String,Table> tableMap, SiddhiQueryContext siddhiQueryContext)
Builds the "compiled" set clause of an update query. Here, all the pre-processing that can be done prior to receiving the update event is done, so that such pre-processing work will not be done at each update-event-arrival.- Parameters:
updateSet- the set of assignment expressions, each containing the table column to be updated and the expression to be assigned.matchingMetaInfoHolder- the meta structure of the incoming matchingEventvariableExpressionExecutors- the list of variable ExpressionExecutors already createdtableMap- map of event tablessiddhiQueryContext- current siddhi query context- Returns:
- CompiledUpdateSet
-
connectAndLoadCache
protected abstract void connectAndLoadCache() throws ConnectionUnavailableException- Throws:
ConnectionUnavailableException
-
disconnect
protected abstract void disconnect()
-
destroy
protected abstract void destroy()
-
getHandler
public RecordTableHandler getHandler()
-
shutdown
public void shutdown()
-
isStateful
public abstract boolean isStateful()
-
-