]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MClientLease.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #ifndef CEPH_MCLIENTLEASE_H
17 #define CEPH_MCLIENTLEASE_H
19 #include <string_view>
21 #include "msg/Message.h"
23 class MClientLease
: public SafeMessage
{
25 struct ceph_mds_lease h
;
28 int get_action() const { return h
.action
; }
29 ceph_seq_t
get_seq() const { return h
.seq
; }
30 int get_mask() const { return h
.mask
; }
31 inodeno_t
get_ino() const { return inodeno_t(h
.ino
); }
32 snapid_t
get_first() const { return snapid_t(h
.first
); }
33 snapid_t
get_last() const { return snapid_t(h
.last
); }
36 MClientLease() : SafeMessage(CEPH_MSG_CLIENT_LEASE
) {}
37 MClientLease(const MClientLease
& m
) :
38 SafeMessage(CEPH_MSG_CLIENT_LEASE
),
41 MClientLease(int ac
, ceph_seq_t seq
, int m
, uint64_t i
, uint64_t sf
, uint64_t sl
) :
42 SafeMessage(CEPH_MSG_CLIENT_LEASE
) {
51 MClientLease(int ac
, ceph_seq_t seq
, int m
, uint64_t i
, uint64_t sf
, uint64_t sl
, std::string_view d
) :
52 SafeMessage(CEPH_MSG_CLIENT_LEASE
),
62 ~MClientLease() override
{}
65 std::string_view
get_type_name() const override
{ return "client_lease"; }
66 void print(ostream
& out
) const override
{
67 out
<< "client_lease(a=" << ceph_lease_op_name(get_action())
68 << " seq " << get_seq()
69 << " mask " << get_mask();
70 out
<< " " << get_ino();
71 if (h
.last
!= CEPH_NOSNAP
)
72 out
<< " [" << snapid_t(h
.first
) << "," << snapid_t(h
.last
) << "]";
78 void decode_payload() override
{
79 auto p
= payload
.cbegin();
83 void encode_payload(uint64_t features
) override
{
86 encode(dname
, payload
);
90 template<class T
, typename
... Args
>
91 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);