MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / open

Method open

src/db/index.ts:197–204  ·  view source on GitHub ↗

* Open an existing database. * * `deferIndexRecovery` leaves the secondary indexes an interrupted bulk load * dropped for recoverIndexesOffThread instead of rebuilding them * here. Rebuilding one scans and sorts its whole table: on a large index * that is minutes of synchronou

(dbPath: string, options: { readOnly?: boolean; deferIndexRecovery?: boolean } = {})

Source from the content-addressed store, hash-verified

195 * it starts (#1887). Reads stay correct meanwhile, only slower.
196 */
197 static open(dbPath: string, options: { readOnly?: boolean; deferIndexRecovery?: boolean } = {}): DatabaseConnection {
198 if (!fs.existsSync(dbPath)) {
199 throw new Error(`Database not found: ${dbPath}`);
200 }
201
202 const { db, backend } = createDatabase(dbPath, options);
203 return withOpenFailures(db, dbPath, () => DatabaseConnection.openOn(db, backend, dbPath, options));
204 }
205
206 /** The rest of {@link open}: configure the connection, then migrate and repair a writable one. */
207 private static openOn(

Callers

nothing calls this directly

Calls 3

createDatabaseFunction · 0.90
withOpenFailuresFunction · 0.85
openOnMethod · 0.80

Tested by

no test coverage detected