canmove, Confirmed users
1,173
edits
(8 intermediate revisions by the same user not shown) | |||
Line 21: | Line 21: | ||
All API responses return json. | All API responses return json. | ||
====GET==== | ====GET==== | ||
/{product} - returns a list of all clusters in the product | /{product} - returns a list of all clusters in the product | ||
/{product}/{cluster} - returns a hash keyed by nodes in the cluster. Values are hashes of the data for each node. | <br>/{product}/{cluster} - returns a hash keyed by nodes in the cluster. Values are hashes of the data for each node. | ||
/{product}/{cluster}/{node} - Returns the hash of the data for a single | <br>/{product}/{cluster}/{node} - Returns the hash of the data for a single node. | ||
====PUT==== | ====PUT==== | ||
/{product}/{cluster}/{node}/{key} | /{product}/{cluster}/{node}/{key} | ||
/{product}/{cluster}/{key} | <br>/{product}/{cluster}/{key} | ||
/{product}/{key} | <br>/{product}/{key} | ||
Sets the {key} field to the value specified in the PUT body. The scope of this change depends on whether {cluster} (and {node}) are specified in the URL. | Sets the {key} field to the value specified in the PUT body. The scope of this change depends on whether {cluster} (and {node}) are specified in the URL. | ||
Valid keys are: weight, current_in_period, down, backoff. Attempts to set any other keys will get a 400 error. Those should be set using a script or directly into the DB. | Valid keys are: weight, current_in_period, down, backoff. Attempts to set any other keys will get a 400 error. Those should be set using a script or directly into the DB. | ||
A successful PUT will receive a 0 as the response | |||
===External=== | ===External=== | ||
Line 51: | Line 51: | ||
503: internal error | 503: internal error | ||
<br>401: <username> fails to auth | <br>401: <username> fails to auth | ||
<br>404: <product> does not exist | <br>404: <product> does not exist (or URL doesn't exist entirely. Clients should generally interpret this to mean use the same server to which this query was issued. | ||
<br>200 ( | <br>200 ('null'): no node for the product is available for assignment | ||
<br>200 (other text): the name of the node, including protocol, that has been assigned to the user | <br>200 (other text): the name of the node, including protocol, that has been assigned to the user | ||
==Design== | ==Design== | ||
The user's nodes will be stored in the authentication LDAP, in an array under the primaryNode attribute. The storage format will be | The user's nodes will be stored in the authentication LDAP, in an array under the primaryNode attribute. The storage format will be node<internal information. Internal information consists of arbitrary data, as defined by the product. | ||
In a situation where the user already has an assignment corresponding to the product, authenticating the user will be sufficient, as the data from that will be sufficient to fulfill the response. | In a situation where the user already has an assignment corresponding to the product, authenticating the user will be sufficient, as the data from that will be sufficient to fulfill the response. | ||
If there is no record for the product in the primaryNode field, the application will request an assignment from the assignment table. This is a mysql table that will evaluate the available nodes for a product, and produce the one with the best current availability, returning the data to be written into LDAP. | If there is no record for the product in the primaryNode field, the application will request an assignment from the assignment table. This is a mysql table that will evaluate the available nodes for a product, and produce the one with the best current availability, returning the data to be written into LDAP. | ||
==DB Fields== | ==DB Fields== | ||
Line 70: | Line 69: | ||
<br>'''Node''' - The specific node in the cluster that a user is assigned to | <br>'''Node''' - The specific node in the cluster that a user is assigned to | ||
<br>'''LDAP''' - The value to be written into the LDAP if this node is selected | <br>'''LDAP''' - The value to be written into the LDAP if this node is selected | ||
<br>''' | <br>'''Available''' - A count of remaining assignments available in this period. This value is not defined by nodeassigment and is simply set by the service at whatever period is desired. | ||
<br>'''Current | <br>'''Current Load''' - Although it is not a direct reflection of users, it will be incremented by 1 for each user added. Services should set their weights according to how much impact they want each additional user to have to the algorithm | ||
<br>'''Capacity''' - The theoretical maximum weight to be associated with the node | <br>'''Capacity''' - The theoretical maximum weight to be associated with the node | ||
<br>'''Down''' - a binary value indicating whether a node is down. The node service makes this available via api, but it is expected that the service itself will be regularly checking the value. Users will not be assigned to a node that has been marked as down. | <br>'''Down''' - a binary value indicating whether a node is down. The node service makes this available via api, but it is expected that the service itself will be regularly checking the value. Users will not be assigned to a node that has been marked as down. |