RAIDA API Standards

From CloudCoin Wiki
Revision as of 06:20, 16 November 2017 by Alang (talk | contribs) (Created page with "== Directory Services: V 5.5.2017 == === Purpose: === The purpose of the Directory Service API is to provide a backup system for a program (or user) to learn the names or IP a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Directory Services: V 5.5.2017

Purpose:

The purpose of the Directory Service API is to provide a backup system for a program (or user) to learn the names or IP addresses of the RAIDA servers so they can be contacted. The Directory Service may provide the RAIDA contact information in a different (and yet uninvented) format if convenient to the application. In other words, a separate, non-JSON service could easily be created. A dynamic RAIDA Directory is planned for the future but may not be necessary for years. THE DIRECTORY SERVICE HAS YET TO BE IMPLEMENTED.

For network 1, the default locations that can be tried first, before accessing the directory. The names are case insensitive. are:

https://RAIDA0.CloudCoin.Global
 https://RAIDA1.CloudCoin.Global
 ...
 https://RAIDA23.CloudCoin.Global 
 https://RAIDA24.CloudCoin.Global

For future networks (should network multiplication occur) the names of the servers will have a network extension such as RAIDA0Net2 through RAIDA24Net2 where Net2 means they are on network 2.

Default Names:

https://RAIDA0net2.CloudCoin.Global
 https://RAIDA1net2.CloudCoin.Global
 ...
 https://RAIDA23net2.CloudCoin.Global
 https://RAIDA24net2.CloudCoin.Global

Directory Request:

Client uses HTTPS to GET the directory page located on different marketing servers. Note that directory uses extension-less urls.

Example of a Directory Request:

//www.cloudcoin.ch/service/directory  (This is not yet implemented as of 5/5/2017)

A test directgory can be found at:

//www.cloudcoin.co/servers.html

Directory Response:

Server returns a JSON string that describes the URLs of the RAIDAs, the status, the milliseconds required to contact, and a port to use.

Example of a Directory Response:

 {
   "server": [
     {
      "name": "RAIDA0",
       "url": "RAIDA0.CloudCoin.Global",
       "bkurl": "RAIDA0.CloudCoin.ch",
       "status": "unknown",
       "ms": "0",
       "location":"USA",
       "img":"cloudcoin.global\/flags\/usa1.png",
       "protocol":"https",
       "port": "443"
     },
     {
       "name": "RAIDA1",
       "url": "212.120.69.50",
       "bkurl": "RAIDA1.CloudCoin.ch",
       "status": "ready",
       "ms": "230",
       "location":"Macedonia",
       "img":"cloudcoin.global\/flags\/macedonia.png",
       "protocol":"http",
       "port": "80"
     },
      //NOTE: RAIDA3 through RAIDA22 have been left out to save space
   {
       "name": "RAIDA23",
       "url": "RAIDA23.CloudCoin.Global",
       "bkurl": "RAIDA23.CloudCoin.ch",
       "status": "unknown",
       "ms": "0",
       "location":"USA",
       "img":"cloudcoin.global\/flags\/usa1.png",
       "protocol":"https",
       "port": "443"
     },
     {
       "name": "RAIDA24",
       "url": "RAIDA24.CloudCoin.Global",
       "bkurl": "RAIDA24.CloudCoin.ch",
       "status": "down",
       "ms": "0",
       "location":"Taiwan",
       "img":"cloudcoin.global\/flags\/twain.png",
       "protocol":"https",
       "port": "443"
     }
   ]
 }

KEY url: The Fully Qualified Domain name of the Server bkurl: a backup URL in case the DNS of one goes down. name: The name of the Server status: When we have a dynamic system, this might tell the people that the server is down and why. ms: Milliseconds. Time to echo (This could be used if have mirrors of the same server up in the future) location: Where or who runs the RAIDA img: An image file that can be associated with the RAIDA protocol: http, or https. Could be something different in the future such as smtp, TFTP, FTP, sms port: Port number. Usually 80 or 443

Rules: The Directory Service may not respond if it is unavailable. It is possible to add backup - or secondary - RAIDA by adding items with the same "name" to the directory. Then, RAIDA with the smallest ms could be contacted first. The Directory may be cached in case it becomes unavailable or even hard-coded in an application as a backup for fault tolerance. The values are case-insensitive and should be compared accordingly. bkurl is the Backup URL in case name resolution fails for the url. All the services use extension less urls. Typically, the ms (milliseconds required to contact) and the status are to be determined by the client using the Echo Service. The possible statuses are: "unknown" because no attempt has been made to contact the RAIDA. "ready" because an echo request was sent to the RAIDA and it came back "ready." "error" because an echo request was sent to the RAIDA but there was an error. "no_contact" because an echo request was sent to the RAIDA and it did not return any response. "down" because the server is off-line for some reason.