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