Difference between revisions of "Zaqar/specs/proxy/v1"
(Added API synopsis) |
(Add partitions section.) |
||
Line 55: | Line 55: | ||
GET /queues/{queue}/stats | GET /queues/{queue}/stats | ||
</nowiki></pre> | </nowiki></pre> | ||
+ | |||
+ | == Handling Partitions == | ||
+ | |||
+ | A partition maps a name to a list of nodes associated with that partition and a weight. The weight is used to determine how likely a partition is to be selected as the storage location for a particular queue. | ||
+ | |||
+ | === Register a Partition === | ||
+ | |||
+ | '''Template''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | PUT /v1/partitions/{partition_name} | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Request''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | PUT /v1/partitions/wat HTTP/1.1 | ||
+ | Host: marconi.proxy.example.com | ||
+ | |||
+ | { | ||
+ | "hosts": ["http://marconi1.example.com", "http://marconi2.example.com"], | ||
+ | "weight": 100 | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Response''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | HTTP/1.1 201 Created | ||
+ | Location: /v1/partitions/wat | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Discussion''' | ||
+ | |||
+ | Registers a partition. | ||
+ | |||
+ | <code><nowiki>partition_name</nowiki></code> is the name to give the queue. The name MUST NOT exceed 64 bytes in length, and is limited to US-ASCII letters, digits, underscores and hyphens. | ||
+ | |||
+ | |||
+ | === Read a Partition === | ||
+ | |||
+ | '''Template''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /v1/partitions/{partition_name} | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Request''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /v1/partitions/wat HTTP/1.1 | ||
+ | Host: marconi.proxy.example.com | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Response''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | HTTP/1.1 200 OK | ||
+ | Location: /v1/partitions/wat | ||
+ | |||
+ | { | ||
+ | "hosts": ["http://marconi1.example.com", "http://marconi2.example.com"], | ||
+ | "weight": 100 | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Discussion''' | ||
+ | |||
+ | Returns information on a registered partition. | ||
+ | |||
+ | === Delete a Partition === | ||
+ | |||
+ | '''Template''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | DELETE /v1/partitions/{partition_name} | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Request''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | DELETE /v1/partitions/wat HTTP/1.1 | ||
+ | Host: marconi.proxy.example.com | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Response''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | HTTP/1.1 204 No Content | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Discussion''' | ||
+ | |||
+ | Removes a partition from the registry. | ||
+ | |||
+ | === List Partitions === | ||
+ | |||
+ | '''Template''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /v1/partitions | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Request''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /v1/partitions HTTP/1.1 | ||
+ | Host: marconi.proxy.example.com | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''Response''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | HTTP/1.1 200 OK | ||
+ | Location: /v1/partitions | ||
+ | |||
+ | { | ||
+ | "wat": { | ||
+ | "hosts": [ | ||
+ | "http://marconi1.example.com", | ||
+ | "http://marconi2.example.com" | ||
+ | ], | ||
+ | "weight": 256 | ||
+ | }, | ||
+ | "wat2": { | ||
+ | "hosts": [ | ||
+ | "http://marconi3.example.com", | ||
+ | "http://marconi4.example.com" | ||
+ | "http://marconi5.example.com", | ||
+ | "http://marconi6.example.com" | ||
+ | ], | ||
+ | "weight": 500 | ||
+ | }, | ||
+ | "wat3": { | ||
+ | "hosts": [ | ||
+ | ], | ||
+ | "http://marconi7.example.com" | ||
+ | "weight": 25 | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | '''Discussion''' | ||
+ | |||
+ | Removes a partition from the registry. |
Revision as of 15:39, 23 September 2013
Contents
Marconi Proxy: v1 Blueprint
Overview
Marconi's proxy service was written to enable scaling out a Marconi deployment at the partition level. It is controlled through an HTTP API.
Reference
For authoritative header/general details, please refer to the Marconi Queues API v1 Spec.
Endpoints Synopsis
# Proxy-specific endpoints ## Partition operations GET /partitions GET /partitions/{partition} PUT /partitions/{partition} DELETE /partitions/{partition} ## Catalogue operations GET /catalogue GET /catalogue/{queue} GET /health # Queues API intercepting endpoints ## Implicitly modify catalogue GET /queues GET /queues/{queue} PUT /queues/{queue} DELETE /queues/{queue} # Operations forwarded to Queues API ## Informative GET /v1 ## Claims-forwarding POST /queues/{queue}/claims GET /queues/{queue}/claims/{claim_id} PATCH /queues/{queue}/claims/{claim_id} DELETE /queues/{queue}/claims/{claim_id} ## Messages forwarding GET /queues/{queue}/messages POST /queues/{queue}/messages DELETE /queues/{queue}/messages GET /queues/{queue}/messages/{message_id} DELETE /queues/{queue}/messages/{message_id} ## Metadata handling - also implicitly modifies catalogue GET /queues/{queue}/metadata PUT /queues/{queue}/metadata ## Queue stats GET /queues/{queue}/stats
Handling Partitions
A partition maps a name to a list of nodes associated with that partition and a weight. The weight is used to determine how likely a partition is to be selected as the storage location for a particular queue.
Register a Partition
Template
PUT /v1/partitions/{partition_name}
Request
PUT /v1/partitions/wat HTTP/1.1 Host: marconi.proxy.example.com { "hosts": ["http://marconi1.example.com", "http://marconi2.example.com"], "weight": 100 }
Response
HTTP/1.1 201 Created Location: /v1/partitions/wat
Discussion
Registers a partition.
partition_name
is the name to give the queue. The name MUST NOT exceed 64 bytes in length, and is limited to US-ASCII letters, digits, underscores and hyphens.
Read a Partition
Template
GET /v1/partitions/{partition_name}
Request
GET /v1/partitions/wat HTTP/1.1 Host: marconi.proxy.example.com
Response
HTTP/1.1 200 OK Location: /v1/partitions/wat { "hosts": ["http://marconi1.example.com", "http://marconi2.example.com"], "weight": 100 }
Discussion
Returns information on a registered partition.
Delete a Partition
Template
DELETE /v1/partitions/{partition_name}
Request
DELETE /v1/partitions/wat HTTP/1.1 Host: marconi.proxy.example.com
Response
HTTP/1.1 204 No Content
Discussion
Removes a partition from the registry.
List Partitions
Template
GET /v1/partitions
Request
GET /v1/partitions HTTP/1.1 Host: marconi.proxy.example.com
Response
HTTP/1.1 200 OK Location: /v1/partitions { "wat": { "hosts": [ "http://marconi1.example.com", "http://marconi2.example.com" ], "weight": 256 }, "wat2": { "hosts": [ "http://marconi3.example.com", "http://marconi4.example.com" "http://marconi5.example.com", "http://marconi6.example.com" ], "weight": 500 }, "wat3": { "hosts": [ ], "http://marconi7.example.com" "weight": 25 } }
Discussion
Removes a partition from the registry.