summaryrefslogtreecommitdiffstats
path: root/src/messages/MClientQuota.h
blob: ddad8fbddf03702a448d5e13873b512b7e8570cb (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
#ifndef CEPH_MCLIENTQUOTA_H
#define CEPH_MCLIENTQUOTA_H

#include "msg/Message.h"

class MClientQuota final : public SafeMessage {
public:
  inodeno_t ino;
  nest_info_t rstat;
  quota_info_t quota;

protected:
  MClientQuota() :
    SafeMessage{CEPH_MSG_CLIENT_QUOTA},
    ino(0)
  {}
  ~MClientQuota() final {}

public:
  std::string_view get_type_name() const override { return "client_quota"; }
  void print(std::ostream& out) const override {
    out << "client_quota(";
    out << " [" << ino << "] ";
    out << rstat << " ";
    out << quota;
    out << ")";
  }

  void encode_payload(uint64_t features) override {
    using ceph::encode;
    encode(ino, payload);
    encode(rstat.rctime, payload);
    encode(rstat.rbytes, payload);
    encode(rstat.rfiles, payload);
    encode(rstat.rsubdirs, payload);
    encode(quota, payload);
  }
  void decode_payload() override {
    using ceph::decode;
    auto p = payload.cbegin();
    decode(ino, p);
    decode(rstat.rctime, p);
    decode(rstat.rbytes, p);
    decode(rstat.rfiles, p);
    decode(rstat.rsubdirs, p);
    decode(quota, p);
    ceph_assert(p.end());
  }
private:
  template<class T, typename... Args>
  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
  template<class T, typename... Args>
  friend MURef<T> crimson::make_message(Args&&... args);
};

#endif