Dequeue implements blobcache.QueueAPI.Dequeue
(ctx context.Context, qh blobcache.Handle, buf []blobcache.Message, opts blobcache.DequeueOpts)
| 24 | |
| 25 | // Dequeue implements blobcache.QueueAPI.Dequeue |
| 26 | func (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 |
| 43 | func (sys *System) Enqueue(ctx context.Context, qh blobcache.Handle, msgs []blobcache.Message) (*blobcache.InsertResp, error) { |
nothing calls this directly
no test coverage detected