]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/io/ObjectDispatchSpec.cc
Import ceph 15.2.8
[ceph.git] / ceph / src / librbd / io / ObjectDispatchSpec.cc
CommitLineData
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
9namespace librbd {
10namespace io {
11
12void 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
31void ObjectDispatchSpec::C_Dispatcher::finish(int r) {
32 on_finish->complete(r);
33 delete object_dispatch_spec;
34}
35
36void ObjectDispatchSpec::send() {
37 object_dispatcher->send(this);
38}
39
40void ObjectDispatchSpec::fail(int r) {
41 ceph_assert(r < 0);
42 dispatcher_ctx.complete(r);
43}
44
45} // namespace io
46} // namespace librbd