Class ArrowResultChunkStateMachine
- java.lang.Object
-
- com.databricks.jdbc.api.impl.arrow.ArrowResultChunkStateMachine
-
public class ArrowResultChunkStateMachine extends Object
Manages state transitions for ArrowResultChunk. Enforces valid state transitions and provides clear error messages for invalid transitions.
-
-
Constructor Summary
Constructors Constructor Description ArrowResultChunkStateMachine(ChunkStatus initialStatus, long chunkIndex, StatementId statementId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChunkStatusgetCurrentStatus()Returns the current state of the chunk.Set<ChunkStatus>getValidTargetStates()Returns a set of valid target states from the current state.booleanisValidTransition(ChunkStatus targetStatus)Checks if a transition to the target state is valid from the current state.voidtransition(ChunkStatus targetStatus)Attempts to transition to the target state.
-
-
-
Constructor Detail
-
ArrowResultChunkStateMachine
public ArrowResultChunkStateMachine(ChunkStatus initialStatus, long chunkIndex, StatementId statementId)
-
-
Method Detail
-
transition
public void transition(ChunkStatus targetStatus) throws DatabricksParsingException
Attempts to transition to the target state.- Parameters:
targetStatus- The desired target state- Throws:
DatabricksParsingException- if the transition is invalid
-
isValidTransition
public boolean isValidTransition(ChunkStatus targetStatus)
Checks if a transition to the target state is valid from the current state.- Parameters:
targetStatus- The target state to check- Returns:
- true if the transition is valid, false otherwise
-
getValidTargetStates
public Set<ChunkStatus> getValidTargetStates()
Returns a set of valid target states from the current state.- Returns:
- Set of valid target states
-
getCurrentStatus
public ChunkStatus getCurrentStatus()
Returns the current state of the chunk.- Returns:
- current ChunkStatus
-
-