rgw: hide fcgi details from client code

client code (rgw_rest* et al) does not need to see the
fcgi library details.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: start moving usage management functions

Move usage management functionality to its own place.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: sed 's/_REST/_ObjStore/g' *

It's all REST, we want to add new non objstore handling,
so let's differentiate by the actual type.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: tie callbacks in different handlers directly to REST

Don't translate RESTful operations into a more meaningful
callback name. The handlers themselves should do that
translation. This way we can later register different
handlers with different meanings for the operations.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: refactor protocol stacking

New RESTMgr* classes to handle a specific uri entry
point. Actions are handled by RGWHandler*.

Changing init order, newly instantiated RGWHandler
for every op.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: REST resources init uses configurables

Also, move it to main().

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add rest-usage handler

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Formatter: fix XML formatter

XML formatter wasn't clearing stream string buffer
when completing the section.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add a flusher to handle output data, simplify client api

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: different formatters for different services

Use json formatter by default for new usage stuff. Also
make it configurable.

We use the JSON formatter for the swift auth.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: usage show accepts more params

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: usage trim

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add user caps

User info now holds caps map, which contains a mapping between
a freestyle cap name string to permissions bitfield (read, write).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: configurable set of enabled apis

We can now specify which set of apis the gateway supports. Also,
passed resource should not start with a slash, we prepend that
automatically.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: abort_early should initialize formatter if needed

The formatter might not have been initialized, as we
abort early (e.g., when protocol handler wasn't found)
so we need to initialize it in order to dump error
status.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: fix chunked object PUT for small objects

We didn't update buffer size according to read data.
Also, didn't update the total obj_size (was doing it only
for the second chunk being put, but for chunked input that
only had a single piece we ended up with zero obj_size). Also
remove assertion that second call to handle_data() means that
ofs > chunk size. This isn't true for chunked input.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: document admin, usage api

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: virtual bucket affects resource lookup

Removed special casing of virtual bucket handling
and just prepending it to the URI. So now virtual
bucket also affects admin and swift* protocols.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>