MCPcopy Create free account
hub / github.com/Azure/Azurite / QueueHandler

Class QueueHandler

src/queue/handlers/QueueHandler.ts:21–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 * @implements {IQueueHandler}
20 */
21export default class QueueHandler extends BaseHandler implements IQueueHandler {
22 /**
23 * Create a queue with queueName.
24 *
25 * @param {Models.QueueCreateOptionalParams} options
26 * @param {Context} context
27 * @returns {Promise<Models.QueueCreateResponse>}
28 * @memberof QueueHandler
29 */
30 public async create(
31 options: Models.QueueCreateOptionalParams,
32 context: Context
33 ): Promise<Models.QueueCreateResponse> {
34 const queueCtx = new QueueStorageContext(context);
35 const accountName = queueCtx.account!;
36 const queueName = queueCtx.queue!;
37
38 const req = context.request! as any;
39 const rawHeaders = req.req.rawHeaders;
40
41 // The same as Azure Storage, should preserve the case of metadata names with them created.
42 const metadata = this.parseMetadata(options.metadata, rawHeaders);
43
44 const queue: QueueModel = {
45 accountName,
46 name: queueName,
47 metadata
48 };
49
50 const statusCode = await this.metadataStore.createQueue(queue, context);
51
52 const response: Models.QueueCreateResponse = {
53 date: context.startTime,
54 requestId: queueCtx.contextID,
55 statusCode,
56 version: QUEUE_API_VERSION,
57 clientRequestId: options.requestId
58 };
59
60 return response;
61 }
62
63 /**
64 * Delete a queue according to its name.
65 *
66 * @param {Models.QueueDeleteMethodOptionalParams} options
67 * @param {Context} context
68 * @returns {Promise<Models.QueueDeleteResponse>}
69 * @memberof QueueHandler
70 */
71 public async delete(
72 options: Models.QueueDeleteMethodOptionalParams,
73 context: Context
74 ): Promise<Models.QueueDeleteResponse> {
75 const queueCtx = new QueueStorageContext(context);
76 const accountName = queueCtx.account!;
77 const queueName = queueCtx.queue!;
78

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…