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

Method Dequeue

src/bccore/queueapi.go:26–40  ·  view source on GitHub ↗

Dequeue implements blobcache.QueueAPI.Dequeue

(ctx context.Context, qh blobcache.Handle, buf []blobcache.Message, opts blobcache.DequeueOpts)

Source from the content-addressed store, hash-verified

24
25// Dequeue implements blobcache.QueueAPI.Dequeue
26func (sys *System) Dequeue(ctx context.Context, qh blobcache.Handle, buf []blobcache.Message, opts blobcache.DequeueOpts) (int, error) {
27 logctx.Debug(ctx, "begin", zap.String("method", "Dequeue"), zap.Stringer("oid", qh.OID))
28 defer logctx.Debug(ctx, "done", zap.String("method", "Dequeue"), zap.Stringer("oid", qh.OID))
29 if err := opts.Validate(); err != nil {
30 return 0, err
31 }
32 if len(buf) == 0 {
33 return 0, fmt.Errorf("dequeue buffer must be non-empty")
34 }
35 q, _, err := sys.resolveQueue(qh, blobcache.Action_QUEUE_DEQUEUE)
36 if err != nil {
37 return 0, err
38 }
39 return q.backend.Dequeue(ctx, buf, opts)
40}
41
42// Enqueue implements blobcache.QueueAPI.Enqueue
43func (sys *System) Enqueue(ctx context.Context, qh blobcache.Handle, msgs []blobcache.Message) (*blobcache.InsertResp, error) {

Callers

nothing calls this directly

Calls 4

resolveQueueMethod · 0.95
StringMethod · 0.65
DequeueMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected