]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_multipart_meta_filter.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
4 #include "svc_tier_rados.h"
8 const std::string MP_META_SUFFIX
= ".meta";
10 bool MultipartMetaFilter::filter(const string
& name
, string
& key
) {
11 // the length of the suffix so we can skip past it
12 static const size_t MP_META_SUFFIX_LEN
= MP_META_SUFFIX
.length();
14 size_t len
= name
.size();
16 // make sure there's room for suffix plus at least one more
18 if (len
<= MP_META_SUFFIX_LEN
)
21 size_t pos
= name
.find(MP_META_SUFFIX
, len
- MP_META_SUFFIX_LEN
);
22 if (pos
== string::npos
)
25 pos
= name
.rfind('.', pos
- 1);
26 if (pos
== string::npos
)
29 key
= name
.substr(0, pos
);