]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_dmclock.h
import ceph quincy 17.2.6
[ceph.git] / ceph / src / rgw / rgw_dmclock.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 /*
5 * Ceph - scalable distributed file system
6 *
7 * Copyright (C) 2019 Red Hat, Inc.
8 * Copyright (C) 2019 SUSE LLC
9 *
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
14 *
15 */
16
17 #ifndef RGW_DMCLOCK_H
18 #define RGW_DMCLOCK_H
19 #include "dmclock/src/dmclock_server.h"
20
21 namespace rgw::dmclock {
22 // TODO: implement read vs write
23 enum class client_id {
24 admin, //< /admin apis
25 auth, //< swift auth, sts
26 data, //< PutObj, GetObj
27 metadata, //< bucket operations, object metadata
28 count
29 };
30
31 // TODO move these to dmclock/types or so in submodule
32 using crimson::dmclock::Cost;
33 using crimson::dmclock::ClientInfo;
34
35 enum class scheduler_t {
36 none,
37 throttler,
38 dmclock
39 };
40
41 inline scheduler_t get_scheduler_t(CephContext* const cct)
42 {
43 const auto scheduler_type = cct->_conf.get_val<std::string>("rgw_scheduler_type");
44 if (scheduler_type == "dmclock")
45 return scheduler_t::dmclock;
46 else if (scheduler_type == "throttler")
47 return scheduler_t::throttler;
48 else
49 return scheduler_t::none;
50 }
51
52 } // namespace rgw::dmclock
53
54 #endif /* RGW_DMCLOCK_H */