| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Database.Bolty.Connection.Type
Description
Internal module. Not part of the public API.
Core types for Neo4j BOLT connections: configuration, errors, and connection handles.
Synopsis
- data Config = Config {}
- data ValidatedConfig = ValidatedConfig {}
- data ServerState
- data Connection = Connection {
- rawConnection :: !Connection
- timeout_milliseconds :: !Int
- version :: Word32
- server_state :: IORef ServerState
- server_agent :: Text
- connection_id :: Text
- lastActivity :: IORef Word64
- telemetry_enabled :: Bool
- serverIdleTimeout :: Maybe Int
- queryLogger :: Maybe (QueryLog -> QueryMeta -> IO ())
- notificationHandler :: Maybe (Notification -> IO ())
- data Error
- data Scheme
- = None
- | Basic !Principal !Credentials
- | Kerberos
- | Bearer !Credentials
- type Principal = Text
- type Credentials = Text
- data Routing
- data UserAgent = UserAgent {}
- isTransient :: Error -> Bool
- isRoutingError :: Error -> Bool
Documentation
Connection configuration. Use def for sensible defaults and
override the fields you need. Must be validated with validateConfig before use.
Constructors
| Config | |
Fields
| |
data ValidatedConfig Source #
A validated configuration ready for connect. Created via validateConfig.
Constructors
| ValidatedConfig | |
data ServerState Source #
Constructors
| Disconnected | |
| Connected | |
| Defunct | |
| Authentication | |
| Ready | |
| Streaming | |
| TXready | |
| TXstreaming | |
| Failed | |
| Interrupted |
Instances
| Show ServerState Source # | |
Defined in Database.Bolty.Connection.Type Methods showsPrec :: Int -> ServerState -> ShowS # show :: ServerState -> String # showList :: [ServerState] -> ShowS # | |
| Eq ServerState Source # | |
Defined in Database.Bolty.Connection.Type | |
data Connection Source #
An open connection to a Neo4j server. Obtain via connect.
Constructors
| Connection | |
Fields
| |
Errors that can occur during BOLT communication.
Constructors
| TimeOut Text | A network operation timed out. |
| AuthentificationFailed | The server rejected the authentication credentials. |
| UnsupportedServerVersion Word32 | No mutually supported BOLT version could be negotiated. |
| ResetFailed | A RESET message failed (connection is likely defunct). |
| CannotReadResponse Text | Failed to parse a response from the server. |
| NonboltyError SomeException | A non-BOLT exception (e.g. network IO error). |
| ResponseErrorRecords | Received records when a non-record response was expected. |
| WrongMessageFormat Text | The server sent an unexpected message type. |
| ResponseErrorIgnored | The server sent an IGNORED response. |
| ResponseErrorFailure Text Text | A FAILURE response with Neo4j error code and message. |
| InvalidState ServerState Text | Attempted an operation in an invalid server state. |
| RoutingTableError Text | Failed to fetch or parse a routing table. |
Instances
| Exception Error Source # | |
Defined in Database.Bolty.Connection.Type Methods toException :: Error -> SomeException # fromException :: SomeException -> Maybe Error # displayException :: Error -> String # backtraceDesired :: Error -> Bool # | |
| Show Error Source # | |
Authentication scheme for the HELLO handshake.
Constructors
| None | No authentication. |
| Basic !Principal !Credentials | Basic username/password authentication. |
| Kerberos | Kerberos authentication (ticket obtained externally). |
| Bearer !Credentials | Bearer token authentication (e.g. SSO). |
Instances
type Credentials = Text Source #
Password or token for authentication.
Routing mode for cluster-aware connections.
Constructors
| NoRouting | Direct connection (no routing). |
| Routing | Use server-side routing with default settings. |
| RoutingSpec !Text !(HashMap Text Text) | Use server-side routing with explicit address and parameters.
Arguments: advertised address (e.g. |
User-agent identifier sent to the server in the HELLO message.
isTransient :: Error -> Bool Source #
Check if an error is a transient Neo4j failure that can be retried.
isRoutingError :: Error -> Bool Source #
Check if an error indicates stale routing information. These errors mean the driver sent a request to the wrong server (e.g. a write to a read replica). The routing table should be invalidated and the operation retried on a fresh leader.