summaryrefslogtreecommitdiffstats
path: root/src/cls/cmpomap/types.h
blob: 11e39575fea7621e861a28de52cb1dd1c93e01a6 (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp

/*
 * Ceph - scalable distributed file system
 *
 * Copyright (C) 2020 Red Hat, Inc
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software
 * Foundation.  See file COPYING.
 */

#pragma once

#include <string>
#include <boost/container/flat_map.hpp>
#include "include/rados.h" // CEPH_OSD_CMPXATTR_*
#include "include/encoding.h"

namespace cls::cmpomap {

/// comparison operand type
enum class Mode : uint8_t {
  String = CEPH_OSD_CMPXATTR_MODE_STRING,
  U64    = CEPH_OSD_CMPXATTR_MODE_U64,
};

/// comparison operation, where the left-hand operand is the input value and
/// the right-hand operand is the stored value (or the optional default)
enum class Op : uint8_t {
  EQ  = CEPH_OSD_CMPXATTR_OP_EQ,
  NE  = CEPH_OSD_CMPXATTR_OP_NE,
  GT  = CEPH_OSD_CMPXATTR_OP_GT,
  GTE = CEPH_OSD_CMPXATTR_OP_GTE,
  LT  = CEPH_OSD_CMPXATTR_OP_LT,
  LTE = CEPH_OSD_CMPXATTR_OP_LTE,
};

/// mapping of omap keys to value comparisons
using ComparisonMap = boost::container::flat_map<std::string, ceph::bufferlist>;

} // namespace cls::cmpomap