summaryrefslogtreecommitdiff
path: root/src/librbd/WatchCtx.h
blob: 0c0802a40356f4902ecd8bdd0540300a685c02aa (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_LIBRBD_WATCHCTX_H
#define CEPH_LIBRBD_WATCHCTX_H

#include <inttypes.h>

#include "common/Mutex.h"
#include "include/buffer.h"
#include "include/rados/librados.hpp"

class ImageCtx;

namespace librbd {

  class WatchCtx : public librados::WatchCtx {
    ImageCtx *ictx;
    bool valid;
    Mutex lock;
  public:
    uint64_t cookie;
    WatchCtx(ImageCtx *ctx) : ictx(ctx),
			      valid(true),
			      lock("librbd::WatchCtx"),
			      cookie(0) {}
    virtual ~WatchCtx() {}
    void invalidate();
    virtual void notify(uint8_t opcode, uint64_t ver, ceph::bufferlist& bl);
  };
}

#endif