]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/services/svc_tier_rados.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / rgw / services / svc_tier_rados.cc
CommitLineData
9f95a23c
TL
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#include "svc_tier_rados.h"
5
20effc67
TL
6using namespace std;
7
9f95a23c
TL
8const std::string MP_META_SUFFIX = ".meta";
9
20effc67
TL
10MultipartMetaFilter::~MultipartMetaFilter() {}
11
9f95a23c
TL
12bool MultipartMetaFilter::filter(const string& name, string& key) {
13 // the length of the suffix so we can skip past it
14 static const size_t MP_META_SUFFIX_LEN = MP_META_SUFFIX.length();
15
16 size_t len = name.size();
17
18 // make sure there's room for suffix plus at least one more
19 // character
20 if (len <= MP_META_SUFFIX_LEN)
21 return false;
22
23 size_t pos = name.find(MP_META_SUFFIX, len - MP_META_SUFFIX_LEN);
24 if (pos == string::npos)
25 return false;
26
27 pos = name.rfind('.', pos - 1);
28 if (pos == string::npos)
29 return false;
30
31 key = name.substr(0, pos);
32
33 return true;
34}
35
36