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

Method Inspect

src/bccore/bccore.go:406–444  ·  view source on GitHub ↗
(ctx context.Context, h blobcache.Handle)

Source from the content-addressed store, hash-verified

404}
405
406func (sys *System) Inspect(ctx context.Context, h blobcache.Handle) (blobcache.Info, error) {
407 hi, err := sys.InspectHandle(ctx, h)
408 if err != nil {
409 return blobcache.Info{}, err
410 }
411 ret := blobcache.Info{Handle: *hi}
412
413 sys.mu.RLock()
414 _, isTx := sys.txns[h.OID]
415 _, isQueue := sys.queues[h.OID]
416 _, isVol := sys.volumes[h.OID]
417 sys.mu.RUnlock()
418
419 if isTx {
420 tx, err := sys.InspectTx(ctx, h)
421 if err != nil {
422 return blobcache.Info{}, err
423 }
424 ret.Tx = tx
425 return ret, nil
426 }
427 if isQueue {
428 q, err := sys.InspectQueue(ctx, h)
429 if err != nil {
430 return blobcache.Info{}, err
431 }
432 ret.Queue = &q
433 return ret, nil
434 }
435 if h.OID == (blobcache.OID{}) || isVol {
436 vi, err := sys.InspectVolume(ctx, h)
437 if err != nil {
438 return blobcache.Info{}, err
439 }
440 ret.Volume = vi
441 return ret, nil
442 }
443 return blobcache.Info{}, fmt.Errorf("handle refers to unknown object type: %v", h.OID)
444}

Callers

nothing calls this directly

Calls 4

InspectHandleMethod · 0.95
InspectTxMethod · 0.95
InspectQueueMethod · 0.95
InspectVolumeMethod · 0.95

Tested by

no test coverage detected