The connection in the driver is exposing the protocol object, which is not great. Improve this part of the code can be done by make the connection object have methods to do high level requests to the server.
List of calls the core driver does using the protocol, by passing the connection:
version
run
beginTransaction
commitTransaction
rollbackTransaction
Methods is present in the Connection interface (used by core in bold):
id
database
server
authToken
address
version
supportsReAuth
isOpen
protocol
connect
write
resetAndFlush
hasOngoingObservableRequests
_release
So, isOpen, resetAndFlush and hasOngoingObservableRequests are the methods which will stay in the connection along with the new methods. The method release will move the a Releasable interface, which will be composed with Connection when returning the connection from the provider.
The Releasable interface is also defined to enable the ConnectionProvider returns a connection which can be released back to the pool.
Internally, bolt-connection can keep exposing the internal of the connection outside the connection in a first moment. The full encapsulation of the protocol should be done in the next phase of refactoring.
The connection in the driver is exposing the protocol object, which is not great. Improve this part of the code can be done by make the connection object have methods to do high level requests to the server.
List of calls the core driver does using the protocol, by passing the connection:
version
run
beginTransaction
commitTransaction
rollbackTransaction
Methods is present in the
Connection
interface (used by core in bold):id
database
server
authToken
address
version
supportsReAuth
isOpen
protocol
connect
write
resetAndFlush
hasOngoingObservableRequests
_release
So,
isOpen
,resetAndFlush
andhasOngoingObservableRequests
are the methods which will stay in the connection along with the new methods. The methodrelease
will move the aReleasable
interface, which will be composed withConnection
when returning the connection from the provider.The
Releasable
interface is also defined to enable theConnectionProvider
returns a connection which can be released back to the pool.Internally,
bolt-connection
can keep exposing the internal of the connection outside the connection in a first moment. The full encapsulation of theprotocol
should be done in the next phase of refactoring.