-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathIBackend.ts
More file actions
34 lines (31 loc) · 1.36 KB
/
Copy pathIBackend.ts
File metadata and controls
34 lines (31 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { ConnectionOptions, OpenSessionRequest } from './IDBSQLClient';
import ISessionBackend from './ISessionBackend';
/**
* Top-level backend dispatch handle. One instance per `DBSQLClient`,
* chosen at `connect()` time based on the `useKernel` flag and never
* re-selected per-call.
*/
export default interface IBackend {
/**
* Establish backend-level state before any session is opened. Implementations
* consume `options` to build backend-specific connection parameters (e.g. the
* SEA backend derives napi-binding `KernelNativeConnectionOptions` from the auth
* + host fields here). Transport-layer connection providers are owned by
* `DBSQLClient` (via `IClientContext`) and exposed to backends through
* constructor injection.
*/
connect(options: ConnectionOptions): Promise<void>;
/**
* Open a session. Returned `ISessionBackend` is owned by the caller
* and torn down via its own `close()`.
*/
openSession(request: OpenSessionRequest): Promise<ISessionBackend>;
/**
* Backend-level teardown. Transport-layer cleanup (connection provider,
* thrift client, auth provider) is owned by `DBSQLClient` and runs
* after this returns. Implementations release backend-internal resources
* here, and MUST be safe to call on a partially-initialized backend
* (i.e. after a failed `connect()`).
*/
close(): Promise<void>;
}