MCPcopy Create free account
hub / github.com/apache/maka / transaction

Method transaction

packages/storage/src/sqlite-runtime-store.ts:2191–2206  ·  view source on GitHub ↗
(operation: () => T)

Source from the content-addressed store, hash-verified

2189 }
2190
2191 private transaction<T>(operation: () => T): T {
2192 if (this.databaseLease) return this.databaseLease.transaction('write', operation);
2193 this.db.exec('BEGIN IMMEDIATE');
2194 try {
2195 const result = operation();
2196 this.db.exec('COMMIT');
2197 return result;
2198 } catch (error) {
2199 try {
2200 this.db.exec('ROLLBACK');
2201 } catch {
2202 // Preserve the protocol failure that caused rollback.
2203 }
2204 throw error;
2205 }
2206 }
2207
2208 private readTransaction<T>(operation: () => T): T {
2209 if (this.databaseLease) return this.databaseLease.transaction('read', operation);

Calls 2

transactionMethod · 0.65
execMethod · 0.65

Tested by

no test coverage detected