-
Notifications
You must be signed in to change notification settings - Fork 0
API reference
Client should sends its requests to the 7000 port of the FS.
GET /chunks/<chunkID>
Query parameters: token
Required: FS expect READ request for that chunkID and token.
Effect: The response body will contain the binary data of the chunk.
POST /chunks/<chunkID>
Query parameters: token
Required: FS should expect WRITE request for that chunkID and token. The chunk should not exists on the FS.
Effects: FS will store the chunk with the data from the request's body. It will send receivedChunk
confirmation to NS.
POST /expect/<token>
Query parameters: action
(=read
or =write
)
Required: Request body should contain a plain JSON array of strings -- chunkIDs for which to expect action.
Effects: FS starts to expect specified action for token and the listed chunks. If the token is already associated with an expect action, the request is ignored and StatusForbidden is returned.
POST /replicate
Query parameters: token
and ip
Required: Body should contain a JSON array of strings (chunk ids). The provided IP should correspond to an FS. This server should also expect a WRITE action for the provided token and chunks.
Effects: The chunks are sent to the peer FS on the client port. From its point of view, there is no difference in behavior between client and FS sending chunks scenarios.
POST /cancelToken
Query parameters: token
Effects: All expected actions associated with the token are removed. For WRITE expectations, if some chunks were completed, they will be removed from DB.
POST /purge
Required: body should contain a JSON array of strings -- chunks to purge.
Effects: The specified chunks are marked as obsolete and are not deleted immediately. Only when all expect actions associated with the chunks complete, the chunks are removed. The chunks are removed asynchronously, instead of one-shot.
GET /probe
Effects: The address of the first caller is registered as the address of NS. On the first request to this address, the server will send back information about its hardware characteristics. Any consequent requests from the same address will exhibit the exact same behavior. The requests from other IPs, however, are ignored and StatusForbidden is returned. The information about NS' address is stored on a permanent storage and is loaded back on FS startup. This way, FS stays connected to the pool even after crashes.
Response JSON: A JSON object with fields:
-
available
-- the number of bytes free on the FS' storage.
A lot of methods....
POST /confirm/receivedChunk
Query parameters: chunkID
Effects: NS server is notified that the chunk with the ID was received by the sender FS.