( ctx context.Context, action string, run func(exec sqlExecutor) error, )
| 1265 | } |
| 1266 | |
| 1267 | func (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 | |
| 1280 | func (k *Kernel) lockSource(source ResourceSource) func() { |
| 1281 | key := string(source.Kind) + "\x00" + source.ID |
no test coverage detected