Skip to content

Commit

Permalink
refactor: cleanup previous impl
Browse files Browse the repository at this point in the history
  • Loading branch information
lovetodream committed Jul 5, 2024
1 parent a3213b5 commit 403af84
Show file tree
Hide file tree
Showing 14 changed files with 324 additions and 848 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ struct ConnectionStateMachine {
EventLoopPromise<OracleRowStream>,
StatementResult
)
case needMoreData

// Statement streaming
case forwardRows([DataRow])
Expand Down Expand Up @@ -753,29 +752,6 @@ struct ConnectionStateMachine {
}
}

mutating func chunkReceived(
_ buffer: ByteBuffer, capabilities: Capabilities
) -> ConnectionAction {
switch self.state {
case .statement(var statement):
return self.avoidingStateMachineCoW { machine in
let action = statement.chunkReceived(
buffer, capabilities: capabilities
)
machine.state = .statement(statement)
return machine.modify(with: action)
}

case .loggingOff, .closing:
// Might happen if an error is thrown in row decoding and the
// connection is closed immediately after.
return .wait

default:
preconditionFailure("Invalid state: \(self.state)")
}
}

mutating func ioVectorReceived(
_ vector: OracleBackendMessage.InOutVector
) -> ConnectionAction {
Expand Down Expand Up @@ -921,7 +897,6 @@ struct ConnectionStateMachine {
.sendFetch,
.sendFlushOutBinds,
.succeedStatement,
.needMoreData,
.forwardRows,
.forwardStreamComplete,
.forwardCancelComplete,
Expand Down Expand Up @@ -1172,8 +1147,6 @@ extension ConnectionStateMachine {
return .failStatement(promise, with: error, cleanupContext: nil)
case .succeedStatement(let promise, let columns):
return .succeedStatement(promise, columns)
case .needMoreData:
return .needMoreData
case .forwardRows(let rows):
return .forwardRows(rows)
case .forwardStreamComplete(let rows, let cursorID):
Expand Down
Loading

0 comments on commit 403af84

Please sign in to comment.