]>
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 <boost/utility/string_view.hpp>
21 #include "msg/Message.h"
23 struct MClientLease
: public Message
{
24 struct ceph_mds_lease h
;
27 int get_action() const { return h
.action
; }
28 ceph_seq_t
get_seq() const { return h
.seq
; }
29 int get_mask() const { return h
.mask
; }
30 inodeno_t
get_ino() const { return inodeno_t(h
.ino
); }
31 snapid_t
get_first() const { return snapid_t(h
.first
); }
32 snapid_t
get_last() const { return snapid_t(h
.last
); }
34 MClientLease() : Message(CEPH_MSG_CLIENT_LEASE
) {}
35 MClientLease(int ac
, ceph_seq_t seq
, int m
, uint64_t i
, uint64_t sf
, uint64_t sl
) :
36 Message(CEPH_MSG_CLIENT_LEASE
) {
45 MClientLease(int ac
, ceph_seq_t seq
, int m
, uint64_t i
, uint64_t sf
, uint64_t sl
, boost::string_view d
) :
46 Message(CEPH_MSG_CLIENT_LEASE
),
57 ~MClientLease() override
{}
60 const char *get_type_name() const override
{ return "client_lease"; }
61 void print(ostream
& out
) const override
{
62 out
<< "client_lease(a=" << ceph_lease_op_name(get_action())
63 << " seq " << get_seq()
64 << " mask " << get_mask();
65 out
<< " " << get_ino();
66 if (h
.last
!= CEPH_NOSNAP
)
67 out
<< " [" << snapid_t(h
.first
) << "," << snapid_t(h
.last
) << "]";
73 void decode_payload() override
{
74 bufferlist::iterator p
= payload
.begin();
78 void encode_payload(uint64_t features
) override
{
80 ::encode(dname
, payload
);