MCPcopy Create free account
hub / github.com/blobcache/blobcache / Commit

Method Commit

src/bccore/txapi.go:33–51  ·  view source on GitHub ↗
(ctx context.Context, txh blobcache.Handle)

Source from the content-addressed store, hash-verified

31}
32
33func (sys *System) Commit(ctx context.Context, txh blobcache.Handle) error {
34 logctx.Info(ctx, "begin", zap.String("method", "Commit"), zap.Stringer("oid", txh.OID))
35 defer logctx.Info(ctx, "done", zap.String("method", "Commit"), zap.Stringer("oid", txh.OID))
36 tx, err := sys.resolveTx(txh, true, 0)
37 if err != nil {
38 return err
39 }
40 if p := tx.backend.Params(); !p.Modify {
41 return blobcache.ErrTxReadOnly{Tx: txh.OID, Op: "COMMIT"}
42 }
43 if err := tx.backend.Commit(ctx); err != nil {
44 return setErrTxOID(err, txh.OID)
45 }
46 sys.mu.Lock()
47 sys.handles.Drop(txh)
48 sys.mu.Unlock()
49 sys.hub.Publish(ctx, tx.volume.info.ID, tx.volume)
50 return nil
51}
52
53func (sys *System) Abort(ctx context.Context, txh blobcache.Handle) error {
54 logctx.Info(ctx, "begin", zap.String("method", "Abort"), zap.Stringer("oid", txh.OID))

Callers

nothing calls this directly

Calls 10

resolveTxMethod · 0.95
setErrTxOIDFunction · 0.85
InfoMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
PublishMethod · 0.80
StringMethod · 0.65
ParamsMethod · 0.65
CommitMethod · 0.65
DropMethod · 0.65

Tested by

no test coverage detected