You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest design for Multi-Tenancy outlines a new service called the "Database Connection Manager" that handles per-request connections to tenanted databases on the Rafiki instance.
It should maintain an in-memory data structure that maps tenant ids to active database connections, as well as methods to get those connections given a tenant id. If the connection doesn't exist, create it.
For this version of multi-tenancy, the Database Connection Manager should also extend the capability to create a new (logical) database on the Rafiki instance's postgres instance for use during tenant creation so that a databaseConnectionUrl can be provided during that process.
The basic interface for DatabaseConnectionsService is as follows:
DatabaseConnectionsService {
connections: Record<string, Knex> // key is tenant id, value is Knex instance
getOrCreateConnection: (tenantId: string) => Knex
createDatabase: () => string // returns database URL
destroyDatabase: (url: string) => void // in case tenant creation fails after the database is created
closeConnections: () => void // close all active connections
}
In the interest of keeping changes small, the PR for this issue should stub out the major methods like getOrCreateConnection, createDatabase or destroyDatabase. Other issues will capture the scope of these implementations.
Create DatabaseConnectionsService & add it to the IoC container
Describe interface for other services DatabaseConnectionsService depends on
Implement closeConnections & call it during app shutdown
Define connections data structure in interface
The text was updated successfully, but these errors were encountered:
Parent Issue: #2893
The latest design for Multi-Tenancy outlines a new service called the "Database Connection Manager" that handles per-request connections to tenanted databases on the Rafiki instance.
It should maintain an in-memory data structure that maps tenant ids to active database connections, as well as methods to get those connections given a tenant id. If the connection doesn't exist, create it.
For this version of multi-tenancy, the Database Connection Manager should also extend the capability to create a new (logical) database on the Rafiki instance's postgres instance for use during tenant creation so that a
databaseConnectionUrl
can be provided during that process.The basic interface for
DatabaseConnectionsService
is as follows:In the interest of keeping changes small, the PR for this issue should stub out the major methods like
getOrCreateConnection
,createDatabase
ordestroyDatabase
. Other issues will capture the scope of these implementations.closeConnections
& call it during app shutdownconnections
data structure in interfaceThe text was updated successfully, but these errors were encountered: