MCPcopy Create free account
hub / github.com/compozy/agh / withImmediateTransaction

Method withImmediateTransaction

internal/resources/kernel.go:1267–1278  ·  view source on GitHub ↗
(
	ctx context.Context,
	action string,
	run func(exec sqlExecutor) error,
)

Source from the content-addressed store, hash-verified

1265}
1266
1267func (k *Kernel) withImmediateTransaction(
1268 ctx context.Context,
1269 action string,
1270 run func(exec sqlExecutor) error,
1271) error {
1272 if err := store.ExecuteWrite(ctx, k.db, func(_ context.Context, tx *store.WriteTx) error {
1273 return run(tx)
1274 }); err != nil {
1275 return fmt.Errorf("resources: %s transaction: %w", action, err)
1276 }
1277 return nil
1278}
1279
1280func (k *Kernel) lockSource(source ResourceSource) func() {
1281 key := string(source.Kind) + "\x00" + source.ID

Callers 3

ActivateSourceSessionMethod · 0.95
ResetSourceMethod · 0.95

Calls 2

ExecuteWriteFunction · 0.92
runFunction · 0.50

Tested by

no test coverage detected