Implement encapsulation of RGWFileHandle in rgw_file_handle,
so return these from rgw_lookup(), add new rgw_fh_rele() to release
internal state.
Currently the rgw_fh_rele just deletes, in future might be extended
with refcnt support.
Implement the first (atomic) stage of i/o using GET and PUT, add a
new librgw_file_gp test driver for this.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
The logic to create a default S3 policy in
RGWCreateBucket_OS_Lib::get_params() was essentially correct, but
failed to store the resulting policy on the current request.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
* set uri in rgw_mkdir (duh)
* RGWCreateBucketRequest should override RGWHandler::read_permissions
to return 0
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
There is no longer an explicit (e.g., inherited) dependency on REST
implementations.
The remaining coupling (via RGWLibEnv, and struct req_state), can
be factored out later.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
1. remove unused RGWLibRequestEnv code marked to delete
2. restore call to RGWHandler::authorize
3. provide RGWLibRequest::authorize implementing it
** the implementation is incomplete, and shows need to expand
the initial mount auth to deal with keystone, etc
4. since acl check is still not quite right in verify_permissions()
disable this again (temporarily)
5. fix dout_subsys of rgw_request.cc
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
* remove disabled S3 authorize step (user authorized on mount)
* re-enable op->verify_permission()
Skipping the latter makes RGW unhappy (1s stalls on each request),
but no objects are listing yet.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
The private RGWLibFS type holds a RGWUserInfo, and
calls rgw_get_user_info_by_access_key and verifies the returned
secret, checks for suspended user, on rgw_mount.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
The immediate purpose is to permit auth caching in RGWLib, but
it seems likely that this will be useful for general req_state
de-bloatification.
For now, all request processing paths put a RGWUserInfo on the
stack, so the lifetime of the object is unchanged from when it was
an expanded member. A later change will introduce caching of
the objects.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
1. the prior commit had authorize cognate with S3
1.1 which may be right
1.2 but maybe not for each request
1.3 and lacked priming/forged auth data
The forging of auth data is now easy, but the interesting part is
caching and efficiently attaching it so I paused, and
2. disabled auth, which was now overriding and anonymizing all
requests (good!)
3. fixed another instance of reinterpret_cast where (one of)
dynamic_cast or a saved pointer descendant request (avoids a runtime
check, so will add later) is needed
4. fixed bad offset argument to rgw_readdir
The list bucket facility now works, modulo non-auth.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
* initialize RGWEnv with required HTTP_HOST (incorrectly!)
* assign req_state::cio (not really correctly)
* remove incorrect delete of RGWOp, which no longer alloc'd
Now runs, but don't see buckets.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Refactor RGWLib variant of process_request(...) as a (actually 2,
one which puts an RGWLibIO on the stack) member function of
RGWLibProcess.
Also replace extern abort_early with static inline abort_req(),
since the rgw_rest extern assumes HTTP/REST.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Adds the missing bits of RGWLibProcess and RGWLibFrontend, and
calls them from rgw_readdir().
Clients can call enqueue_req() to route a request through the
work queue, or execute_req() to run it inline.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
The REST cognates of this class largely deal with HTTP, and is 1-1
w/request, client-io, op, etc. At worst, its functions can be absorbed
into one of those (client-io, initially).
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
There's some tricky overloading induced by multiple inheritance,
also this design makes repeatedly shared handles in current framework
very visible.
The most important non-boilerplate is in descendant RGWRequest
initializers (rgw_lib.h), which need to set up req_state appropriately
for their action/op.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Derive RGWLibRequest from RGWRequest, RGWHandler.
This strategy defines the dialect of ops following the derivation
pattern for RGWLib actions to be their handler.
On the negative side, RGWLibRequest has struct req_state* s from two
ancestors. Since we don't use virtal inheritance, the only overhead is
the extra copy, and need for disambiguation in the direct descendants
(this is only 1 method in 1 file, atm).
The motivation is as follows. RGWHandler currently has 3 responsibilities:
1) op-chasing; 2) to hold authorize() and read_permissions() methods
3) to initialize req_state
RGWLib actions have no use for the op-chasing behavior, and authorize()
and read_permissions() methods are arguably more naturally expressed as
methods on the actions. Meanwhile struct req_state appears to be a
candidate for refactoring into the RGWRequest class hierarchy, which would
mean that initalization probably should move from hanlder to request, as
well. Refactoring req_state is would be quite intrusive, so this change
defers that for later, but keeps the 1-1 mappings from request to
handler at 0 cost.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This change renames RGWHandler_ObjStore to RGWHandler_REST, and
moves the following protected, virtual, RESTful methods:
virtual bool is_obj_update_op() { return false; }
virtual RGWOp *op_get() { return NULL; }
virtual RGWOp *op_put() { return NULL; }
virtual RGWOp *op_delete() { return NULL; }
virtual RGWOp *op_head() { return NULL; }
virtual RGWOp *op_post() { return NULL; }
virtual RGWOp *op_copy() { return NULL; }
virtual RGWOp *op_options() { return NULL; }
and the following public, virtual methods not needed by the
prototyped RGWLibHandler:
virtual RGWOp *get_op(RGWRados *store);
virtual void put_op(RGWOp *op);
from RGWHandler into the renamed class.
The motivation for this change is to allow a (maybe) transitional
refactoring stage which allows to implement the RGWHandler
interface, without implementing get_handler() or get_op(), put_op(),
or op_*().
Prior refactoring (which could be reversed) moved authorize() and
read_permissions() into the precursor RGWHandler_ObjStore
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Fix public header inclusion from rgw_file.h internal header, which
of course needs to see the public interface.
Finish up the minimal RGWListBucketsRequest callback functor.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
* move RGWLibRequest decls into rgw_file.h
* revise include guard token in rados/rgw_file.h (avoid conflict)
* save CephContext* in RGWLibRequest
* initialize RGWLibRequest cct in ctor, req_state in process_request
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
all RGW_Auth_S3::authorize() from process_request(). Add a
read_permissions() primitive replacing RGWHandler's version in
RGWLibRequest.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
It would be nice to have some compile-type assistance w/the
dual RGWOp & RGWLibRequest boilerplate.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
* RGWLib bucket ops prototyped
* progress made on RGWOp+RGWRequest unification (RGWLib only)
* mostly-harmlessness of RGWHandler-free operation try-checked
The replacement for process_request is the next code to prototype--
RGWHandler-free operation, for great justice.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
In order to support direct/library clients, we want to
more fully decouple RGWOp processing from client HTTP
processing, since in the direct case, there is no HTTP
client.
This change tackles essentially just RGWClientIO, by moving
stream operations to a new subclass RGWStreamIO, and updating
the stream backends (e.g., SWIFT, S3) and REST handlers
accordingly.
In addition, the RGWLib backend is incrementally updated, with
RGWLibIO still deriving from the base RGWClientIO. The RGWLib
path is incomplete as of this change, but is moving in the
direction of its own process_request call path (incomplete,
partly due to header conflicts that will be resolved in
subsequent commits).
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Widen rgw_mount(...) to take the library context, which from
there on follows struct rgw_fs.
Implement an open-coded version of list buckets in rgw_readdir(...),
which now...lists buckets.
The future home of this and the rest of the rgw_file impl. logic
looks to be a more fully elaborated RGWLib* class family.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>