summaryrefslogtreecommitdiffstats
path: root/src/crimson/osd/osd_operations/internal_client_request.h
blob: 1cfde4ab080ecafd4afa6e41324ae031a1cdb49b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#pragma once

#include "crimson/common/type_helpers.h"
#include "crimson/osd/object_context_loader.h"
#include "crimson/osd/osd_operation.h"
#include "crimson/osd/osd_operations/client_request_common.h"
#include "crimson/osd/pg.h"
#include "crimson/osd/pg_activation_blocker.h"

namespace crimson::osd {

class InternalClientRequest : public PhasedOperationT<InternalClientRequest>,
                              private CommonClientRequest {
public:
  explicit InternalClientRequest(Ref<PG> pg);
  ~InternalClientRequest();

  // imposed by `ShardService::start_operation<T>(...)`.
  seastar::future<> start();

protected:
  virtual const hobject_t& get_target_oid() const = 0;
  virtual PG::do_osd_ops_params_t get_do_osd_ops_params() const = 0;
  virtual std::vector<OSDOp> create_osd_ops() = 0;

  const PG& get_pg() const {
    return *pg;
  }

private:
  friend OperationT<InternalClientRequest>;

  static constexpr OperationTypeCode type =
    OperationTypeCode::internal_client_request;

  void print(std::ostream &) const final;
  void dump_detail(Formatter *f) const final;

  CommonPGPipeline& client_pp();

  InternalClientRequest::interruptible_future<> with_interruption();
  InternalClientRequest::interruptible_future<> do_process(
    crimson::osd::ObjectContextRef obc,
    std::vector<OSDOp> &osd_ops);

  Ref<PG> pg;
  epoch_t start_epoch;
  OpInfo op_info;
  std::optional<ObjectContextLoader::Orderer> obc_orderer;
  PipelineHandle handle;

public:
  PipelineHandle& get_handle() { return handle; }

  std::tuple<
    StartEvent,
    CommonOBCPipeline::Process::BlockingEvent,
    CommonOBCPipeline::WaitRepop::BlockingEvent,
    CompletionEvent
  > tracking_events;
};

} // namespace crimson::osd

#if FMT_VERSION >= 90000
template <> struct fmt::formatter<crimson::osd::InternalClientRequest> : fmt::ostream_formatter {};
#endif