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) 2016 Red Hat Inc
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.
15 #ifndef COMMAND_TABLE_H_
16 #define COMMAND_TABLE_H_
18 #include "messages/MCommand.h"
26 std::vector<std::string> cmd;
32 MCommand *get_message(const uuid_d &fsid) const
34 MCommand *m = new MCommand(fsid);
42 CommandOp(const ceph_tid_t t) : tid(t), on_finish(nullptr),
43 outbl(nullptr), outs(nullptr) {}
44 CommandOp() : tid(0), on_finish(nullptr), outbl(nullptr), outs(nullptr) {}
48 * Hold client-side state for a collection of in-flight commands
49 * to a remote service.
56 std::map<ceph_tid_t, T> commands;
66 assert(commands.empty());
71 ceph_tid_t tid = last_tid++;
72 commands.insert(std::make_pair(tid, T(tid)) );
74 return commands.at(tid);
77 const std::map<ceph_tid_t, T> &get_commands() const
82 bool exists(ceph_tid_t tid) const
84 return commands.count(tid) > 0;
87 T& get_command(ceph_tid_t tid)
89 return commands.at(tid);
92 void erase(ceph_tid_t tid)