ZenithDatabasePool class
Owns one connection per tenant. Supply a real driver factory explicitly. Use InMemoryDatabasePool for simulated connections in tests.
- Implementers
Constructors
-
ZenithDatabasePool({required String baseDir, required Future<
ZenithDatabaseHandle> openHandle(String path)}) -
openHandleopens the supplied physical path using the application's driver.
Properties
- baseDir → String
-
Root directory for tenant databases.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
openHandle
→ Future<
ZenithDatabaseHandle> Function(String path) -
Application driver factory for physical database handles.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
acquireConnection(
String tenantId, {ZenithTenantScope? scope}) → Future< ZenithDatabaseHandle> - Shares in-flight opens and rejects acquisitions for closing scopes.
-
bindScope(
ZenithTenantScope scope) → void - Binds the currently open handle, once, to this scope's async cleanup.
-
disposeAll(
) → Future< void> - Permanently closes the pool, including acquisitions already in flight.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
releaseConnection(
String tenantId) → Future< void> - Closes the cached handle and cancels any in-flight acquisition for this ID.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited