Commit Graph

16 Commits

Author SHA1 Message Date
Avi Kivity
7a14bcd66e Merge "API: add get estimated row size histogram to column family" from Amnon
"This series cleans the streaming_histogram and the estimated histogram that
were importad from origin, it then uses it to get the estimated min and max row
estimation in the API."
2015-08-16 17:31:23 +03:00
Amnon Heiman
ba5b1db618 API: Add a wrapper function for min and max
This helper function wraps the std min and max template for int64_t, it
makes it easier to pass them as a value in need.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-12 13:10:18 +03:00
Amnon Heiman
17ebebf268 API: When combining histogram, return zeroed histogram on empty
This change make sure that when there are no results (ie. all the
histogram that are summed are empty) the return result will be a zerroed
histogram and not an empty object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-08-11 10:21:22 +03:00
Amnon Heiman
130d8a7cc6 API: generalize the sum helper functions and add histogram support
This patch generalizd the sum helper function to accept any field as
long as it support the + operator and that it can be parrsed as json.

It adds a sum function to sum histograms it does so by:
adding the totatl, adding the sum, set the min and max
setting the avrage and variance and combining the samples.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-26 11:03:24 +03:00
Pekka Enberg
dcbbafd41c api: Switch to "#pragma once" as include guard
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 18:03:42 +03:00
Amnon Heiman
dfc7121fd8 API: Add a helper function to sum stat values of a distributed objec
A common scenario in the API is to get a sigle value from a distributed
object that has a get_stats method.

The helper function would get the object and a function that return a
single value from the stat object and would perform the map_reduce.

It would return a future that can be used as a return value from the
API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Amnon Heiman
d0ce45efbb API: Add a reference to storage_proxy into API context
The API needs to call the storage_proxy, for that a reference to the
distribute storage_proxy is added to the context and is set in main.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Avi Kivity
b27f93af97 Merge "Adding implementation to the storage_service" from Amnon
"The storage_service API contains many function, the actuall implementation will
be added gradually."
2015-06-29 14:57:45 +03:00
Amnon Heiman
72c034abe1 Http API: Add Swagger-UI support
This patch adds support to the Swagger-UI. It does so by adding
reference to the Swagger-UI target directory, after applying this patch
/ui/ will display the Swagger-UI page with the available APIs.

From the Swagger-UI page it is possible to run the different APIs.

The target directory of the ui can be override from the command line.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-25 16:41:38 +03:00
Amnon Heiman
2956ec641d API: Add helper function to the API
This adds a general map_to_key_value method that can work with any map
like object. This method gets the target vector in a parameter to help
the compiler inference the parameters type.

map_keys is a helper function that gets a map like objects and returns a
vector with its keys (i.e. the call to it's iterator first)

split is a wraper around the boost split and split_cf is a specific
split that is aligned with how column family are passed in the API
parameters.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-25 14:41:39 +03:00
Amnon Heiman
25188ed28e API: Adding a helper function to sum a map
In a typical scenario the API collect values from multiple distributed
instances. Sometimes it is needed to reduce multiple maps by merging
their keys and accumulating their values.

This is a helper function that can be used in map_reduce to perform maps
sum.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-16 14:40:08 +03:00
Amnon Heiman
a75376e8e3 API: Add a helper function from map to key value list
When using swagger definition file, returning a map, needs to be in a
key, value list. To handle this common case in the API, a helper
function was added that gets an unorder_map and return a vector of key,
value mapping.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:13:03 +03:00
Amnon Heiman
57a2777da9 api: fix string containing space cause boost execption
When the container_to_vec helper function has a string that contains
space, a boost exection is thrown.

This fixes it by using std::string for the conversion that the boost
recognize as a string type.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:00:32 +03:00
Amnon Heiman
f0e5d76d85 API: Add helper function to transfer collection to list of sstring
These adds a helper function to transfer a list of object to a list of
string. It will be used by the API implementation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-27 15:28:20 +03:00
Amnon Heiman
b795acdf63 Adds the database to the API context
The API needs the database distribute object to get information from it.
This adds a database reference the API context so it would be
available in the API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-19 13:27:57 +03:00
Amnon Heiman
e5007f49ae Adding the API to urchin
This adds the API to urchin, all API related files will be placed under
the api directory.

The API server uses a context object to access global parameters,
typically the different servers themselves.

After this patch the api-doc will be available, though empty under:
http://localhost:10000/api-doc

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-04-13 18:57:14 +03:00