]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "librbd/io/ObjectDispatchSpec.h" | |
5 | #include "include/Context.h" | |
6 | #include "librbd/io/ObjectDispatcher.h" | |
7 | #include <boost/variant.hpp> | |
8 | ||
9 | namespace librbd { | |
10 | namespace io { | |
11 | ||
12 | void ObjectDispatchSpec::C_Dispatcher::complete(int r) { | |
13 | if (r < 0) { | |
14 | finish(r); | |
15 | return; | |
16 | } | |
17 | ||
18 | switch (object_dispatch_spec->dispatch_result) { | |
19 | case DISPATCH_RESULT_CONTINUE: | |
20 | object_dispatch_spec->send(); | |
21 | break; | |
22 | case DISPATCH_RESULT_COMPLETE: | |
23 | finish(r); | |
24 | break; | |
25 | case DISPATCH_RESULT_INVALID: | |
26 | ceph_abort(); | |
27 | break; | |
28 | } | |
29 | } | |
30 | ||
31 | void ObjectDispatchSpec::C_Dispatcher::finish(int r) { | |
32 | on_finish->complete(r); | |
33 | delete object_dispatch_spec; | |
34 | } | |
35 | ||
36 | void ObjectDispatchSpec::send() { | |
37 | object_dispatcher->send(this); | |
38 | } | |
39 | ||
40 | void ObjectDispatchSpec::fail(int r) { | |
41 | ceph_assert(r < 0); | |
42 | dispatcher_ctx.complete(r); | |
43 | } | |
44 | ||
45 | } // namespace io | |
46 | } // namespace librbd |