summaryrefslogtreecommitdiffstats
path: root/src/librbd/migration/FormatInterface.h
blob: d13521d1193da0369290b81e193b0814bff33ea1 (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#ifndef CEPH_LIBRBD_MIGRATION_FORMAT_INTERFACE_H
#define CEPH_LIBRBD_MIGRATION_FORMAT_INTERFACE_H

#include "include/buffer_fwd.h"
#include "include/int_types.h"
#include "common/zipkin_trace.h"
#include "librbd/Types.h"
#include "librbd/io/Types.h"
#include <map>

struct Context;

namespace librbd {

namespace io {
struct AioCompletion;
struct ReadResult;
} // namespace io

namespace migration {

struct FormatInterface {
  typedef std::map<uint64_t, SnapInfo> SnapInfos;

  virtual ~FormatInterface() {
  }

  virtual void open(Context* on_finish) = 0;
  virtual void close(Context* on_finish) = 0;

  virtual void get_snapshots(SnapInfos* snap_infos, Context* on_finish) = 0;
  virtual void get_image_size(uint64_t snap_id, uint64_t* size,
                              Context* on_finish) = 0;

  virtual bool read(io::AioCompletion* aio_comp, uint64_t snap_id,
                    io::Extents&& image_extents, io::ReadResult&& read_result,
                    int op_flags, int read_flags,
                    const ZTracer::Trace &parent_trace) = 0;

  virtual void list_snaps(io::Extents&& image_extents, io::SnapIds&& snap_ids,
                          int list_snaps_flags,
                          io::SnapshotDelta* snapshot_delta,
                          const ZTracer::Trace &parent_trace,
                          Context* on_finish) = 0;
};

} // namespace migration
} // namespace librbd

#endif // CEPH_LIBRBD_MIGRATION_FORMAT_INTERFACE_H