The Flexible Cloud DB is a non-blocking (concurrent), asynchronous NoSQL
(non-relational DB) RESTful API which uses the HTTP protocol verbs (GET,
POST, PUT, DELETE) in order to perform SQL-alike operations (i.e. SELECT,
INSERT, UPDATE, DELETE) on unstructured data stored as JSON objects.
Built for Speed and Reliability
The Flexible Cloud DB is built for speed. It is short (code-wise), not
more than 100 lines of code, super fast, super efficient, allowing for
concurrency and asynchronous operations. Because it is built atop of Node
and the powerful V8 Javascript engine from Google, it is lightning fast,
allowing on a machine with a single core and with 1GB of RAM, up to 1 million
concurrent HTTP connections.
The more cores and memory, higher the number of concurrent connections
it can handle. It just grows exponentially without breaking and without
overwhelming any system resource. Combining 24 of these cores into a single
machine produces an overall level of throughput that exceeds the capacity
of the operating system and TCP/IP stacks, without the API even breaking
a sweat.
The Flexible Cloud DB can be setup to run in the cloud, on popular services
like Heroku, Amazon EC2, Windows Azure, etc and also on in-house Linux
servers.
Currently a fully working hosted version of Flexible Cloud DB is running
on a micro (128 MB) Amazon EC2 instance on an Amazon Web Services (AWS)
data center (US East - Virginia) and it is available here for demo purposes: http://flexiblecloud-node-test.aws.af.cm.
To have Flexible Cloud DB installed on an in-house Linux server this
requires installing and setting up the Node environment, so please contact
us if you are interested.
The Flexible Cloud DB is the perfect choice for storing unstructured and
non relational data, such as Tags, Stats or data for a distributed system,
in a super fast, reliable and efficient manner.
RESTFul API usage:
GET (list all the records of a table - equivalent of a SELECT *):
curl -X GET http://flexiblecloud-node-test.aws.af.cm/db/collections
Where:
'http://flexiblecloud-node-test.aws.af.cm' is the name of the server on Amazon
EC2 where the Flexible Cloud DB instance is running.
'db' is the name of the database.
'collections' is the name of the table where the data is stored.
Example JSON response:
{
"result": [
{
"num": 150,
"_id": "50a345197b2544ad25000003",
"__v": 0
}
]
}
GET (list records filtering by a field name and field value - equivalent
of a SELECT WHERE on one field):
curl -X GET http://localhost:3000/query/dbtest/collecs/name/vito
Where:
'http://localhost:3000' is the name of the server hosting the Flexible
Cloud DB instance.
'query' indicates that this is a filtering GET operation.
'dbtest' is the name of the database.
'collecs' is the name of the table.
'name' is the name of the field within that table that is going to be
used to filter the response.
'vito' is the value of the field named 'name' which is going to be used
to filter the response.
Example JSON response:
{
"result": [
{
"_id": "50a159339aea8f9206bc6b7e",
"name": "vito",
"test": 28
},
{
"_id": "50a16ce79aea8f9206bc6b85",
"name": "vito",
"test": 29
},
{
"name": "vito",
"test": 33,
"_id": "50a21d9dc3ff8b2c39000002",
"__v": 0
},
{
"name": "vito",
"test": 31,
"_id": "50a3a67c9670c58fb6000001",
"__v": 0
}
]
}
POST (equivalent of an INSERT):
curl -X POST http://localhost:3000/row -H "Content-Type: application/json"
-d '{"db": "dbtest", "table": "collecs", "fields": {"name": "vito", "test":
31}}'
Inserts the JSON object {"name": "vito", "test": 31} as a record
on the 'dbtest' database within the 'collecs' table.
Example response:
{
"result": {
"__v": 0,
"name": "vito",
"test": 31,
"_id": "50a3a67c9670c58fb6000001"
}
}
PUT (equivalent of an UPDATE):
curl -X PUT http://localhost:3000/row -H "Content-Type: application/json"
-d '{"db": "dbtest", "table": "collecs", "fields": {"name": "vito", "test":
31}, "update": {"name": "vito", "test": 43}}'
Updates the record {"name": "vito", "test": 31} with this data {"name":
"vito", "test": 43} on the 'dbtest' database on the 'collecs' table.
Example response:
{
"result": {
"updatedExisting": true,
"n": 1,
"connectionId": 203,
"err": null,
"ok": 1
}
}
DELETE (delete all the table data):
curl -X DELETE http://flexiblecloud-node-test.aws.af.cm/table -H "Content-Type:
application/json" -d '{"db": "testing", "table": "collections"}'
Deletes all the table data (records) from 'collections' on the 'testing'
database.
Example response:
DELETE (delete a record within a table):
curl -X DELETE http://flexiblecloud-node-test.aws.af.cm/row -H "Content-Type:
application/json" -d '{"db": "dbtest", "table": "collecs", "fields": {"num":
600}}'
Deletes the record that matches {"num": 600} from the 'collecs' table
on the 'dbtest' database.
Example response: