return scan(header, keys, out, 0);
}
-int DBObjectMap::clone_keys(const hobject_t &hoid,
- CollectionIndex::IndexedPath path,
- const hobject_t &target,
- CollectionIndex::IndexedPath target_path)
+int DBObjectMap::clone(const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ const hobject_t &target,
+ CollectionIndex::IndexedPath target_path)
{
KeyValueDB::Transaction t = db->get_transaction();
{
return db->submit_transaction(t);
}
-int DBObjectMap::link_keys(const hobject_t &hoid,
- CollectionIndex::IndexedPath path,
- const hobject_t &target,
- CollectionIndex::IndexedPath target_path)
+int DBObjectMap::link(const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ const hobject_t &target,
+ CollectionIndex::IndexedPath target_path)
{
KeyValueDB::Transaction t = db->get_transaction();
{
set<string> *out
);
- int clone_keys(
+ int get_xattrs(
+ const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ const set<string> &to_get,
+ map<string, bufferlist> *out
+ );
+
+ int get_all_xattrs(
+ const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ set<string> *out
+ );
+
+ int set_xattrs(
+ const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ const map<string, bufferlist> &to_set
+ );
+
+ int remove_xattrs(
+ const hobject_t &hoid,
+ CollectionIndex::IndexedPath path,
+ const set<string> &to_remove
+ );
+
+ int clone(
const hobject_t &hoid,
CollectionIndex::IndexedPath path,
const hobject_t &target,
CollectionIndex::IndexedPath target_path
);
- int link_keys(
+ int link(
const hobject_t &hoid,
CollectionIndex::IndexedPath path,
const hobject_t &target,
if (r < 0)
return -errno;
- r = object_map->link_keys(o, path_old, o, path_new);
+ r = object_map->link(o, path_old, o, path_new);
if (r < 0)
return r;
r = _do_clone_range(o, n, 0, st.st_size, 0);
if (r < 0)
r = -errno;
- dout(20) << "objectmap_clone_keys" << dendl;
- r = object_map->clone_keys(oldoid, from, newoid, to);
+ dout(20) << "objectmap clone" << dendl;
+ r = object_map->clone(oldoid, from, newoid, to);
// clone is non-idempotent; record our work.
_set_replay_guard(n, spos);
set<string> *out ///< [out] Subset of keys defined on hoid
) = 0;
+ /// Get xattrs
+ virtual int get_xattrs(
+ const hobject_t &hoid, ///< [in] object
+ CollectionIndex::IndexedPath path, ///< [in] path to hoid
+ const set<string> &to_get, ///< [in] keys to get
+ map<string, bufferlist> *out ///< [out] subset of attrs/vals defined
+ ) = 0;
+
+ /// Get all xattrs
+ virtual int get_all_xattrs(
+ const hobject_t &hoid, ///< [in] object
+ CollectionIndex::IndexedPath path, ///< [in] path to hoid
+ set<string> *out ///< [out] attrs and values
+ ) = 0;
+
+ /// set xattrs in to_set
+ virtual int set_xattrs(
+ const hobject_t &hoid, ///< [in] object
+ CollectionIndex::IndexedPath path, ///< [in] path to object
+ const map<string, bufferlist> &to_set ///< [in] attrs/values to set
+ ) = 0;
+
+ /// remove xattrs in to_remove
+ virtual int remove_xattrs(
+ const hobject_t &hoid, ///< [in] object
+ CollectionIndex::IndexedPath path, ///< [in] path to hoid
+ const set<string> &to_remove ///< [in] attrs to remove
+ ) = 0;
+
+
/// Clone keys efficiently from hoid map to target map
- virtual int clone_keys(
+ virtual int clone(
const hobject_t &hoid, ///< [in] object containing map
CollectionIndex::IndexedPath path, ///< [in] Path to hoid
const hobject_t &target, ///< [in] target of clone
) { return 0; }
/// Efficiently tie <target, target_path> to same key space as <hoid, path>
- virtual int link_keys(
+ virtual int link(
const hobject_t &hoid, ///< [in] object containing map
CollectionIndex::IndexedPath path, ///< [in] Path to hoid
const hobject_t &target, ///< [in] target of link
void clone(hobject_t hoid, CollectionIndex::IndexedPath path,
hobject_t hoid2, CollectionIndex::IndexedPath path2) {
- db->clone_keys(hoid, path, hoid2, path2);
+ db->clone(hoid, path, hoid2, path2);
}
void clear(const string &objname) {
ASSERT_EQ(r, 1);
ASSERT_EQ(result, "bar");
- db->clone_keys(hoid, path, hoid2, path);
+ db->clone(hoid, path, hoid2, path);
r = get_key(hoid, path, "foo", &result);
ASSERT_EQ(r, 1);
ASSERT_EQ(result, "bar");
set_key(hoid, path, "foo" + num_str(i), "bar" + num_str(i));
}
- db->link_keys(hoid, path, hoid_link, path);
- db->clone_keys(hoid, path, hoid2, path);
+ db->link(hoid, path, hoid_link, path);
+ db->clone(hoid, path, hoid2, path);
int r = 0;
for (unsigned i = 0; i < 1000; ++i) {