o.back()->addr = ea;
}
+// -- object_manifest_t --
+
+void object_manifest_t::encode(bufferlist& bl) const
+{
+ ENCODE_START(1, 1, bl);
+ ::encode(type, bl);
+ switch (type) {
+ case TYPE_NONE: break;
+ case TYPE_REDIRECT:
+ ::encode(redirect_target, bl);
+ break;
+ default:
+ ceph_abort();
+ }
+ ENCODE_FINISH(bl);
+}
+
+void object_manifest_t::decode(bufferlist::iterator& bl)
+{
+ DECODE_START(1, bl);
+ ::decode(type, bl);
+ switch (type) {
+ case TYPE_NONE: break;
+ case TYPE_REDIRECT:
+ ::decode(redirect_target, bl);
+ break;
+ default:
+ ceph_abort();
+ }
+ DECODE_FINISH(bl);
+}
+
+void object_manifest_t::dump(Formatter *f) const
+{
+ f->dump_unsigned("type", type);
+ f->open_object_section("redirect_target");
+ redirect_target.dump(f);
+ f->close_section();
+}
+
+void object_manifest_t::generate_test_instances(list<object_manifest_t*>& o)
+{
+ o.push_back(new object_manifest_t());
+ o.back()->type = TYPE_REDIRECT;
+}
+
+ostream& operator<<(ostream& out, const object_manifest_t& om)
+{
+ return out << "type:" << om.type << " redirect_target:" << om.redirect_target;
+}
// -- object_info_t --
++i) {
old_watchers.insert(make_pair(i->first.second, i->second));
}
- ENCODE_START(16, 8, bl);
+ ENCODE_START(17, 8, bl);
::encode(soid, bl);
::encode(myoloc, bl); //Retained for compatibility
::encode((__u32)0, bl); // was category, no longer used
::encode(expected_object_size, bl);
::encode(expected_write_size, bl);
::encode(alloc_hint_flags, bl);
+ ::encode(manifest, bl);
ENCODE_FINISH(bl);
}
expected_write_size = 0;
alloc_hint_flags = 0;
}
+ if (struct_v >= 17) {
+ ::decode(manifest, bl);
+ }
DECODE_FINISH(bl);
}
f->dump_unsigned("expected_object_size", expected_object_size);
f->dump_unsigned("expected_write_size", expected_write_size);
f->dump_unsigned("alloc_hint_flags", alloc_hint_flags);
+ f->dump_object("manifest", manifest);
f->open_object_section("watchers");
for (map<pair<uint64_t, entity_name_t>,watch_info_t>::const_iterator p =
watchers.begin(); p != watchers.end(); ++p) {
out << " alloc_hint [" << oi.expected_object_size
<< " " << oi.expected_write_size
<< " " << oi.alloc_hint_flags << "]";
+ if (oi.has_manifest())
+ out << " " << oi.manifest;
out << ")";
return out;
<< " " << n.timeout << "s)";
}
+struct object_info_t;
+struct object_manifest_t {
+ enum {
+ TYPE_NONE = 0,
+ TYPE_REDIRECT = 1, // start with this
+ TYPE_CHUNKED = 2, // do this later
+ };
+ uint8_t type; // redirect, chunked, ...
+ hobject_t redirect_target;
+
+ object_manifest_t() : type(0) { }
+ object_manifest_t(uint8_t type, const hobject_t& redirect_target)
+ : type(type), redirect_target(redirect_target) { }
+
+ bool is_empty() const {
+ return type == TYPE_NONE;
+ }
+ bool is_redirect() const {
+ return type == TYPE_REDIRECT;
+ }
+ bool is_chunked() const {
+ return type == TYPE_CHUNKED;
+ }
+ static const char *get_type_name(uint8_t m) {
+ switch (m) {
+ case TYPE_NONE: return "none";
+ case TYPE_REDIRECT: return "redirect";
+ case TYPE_CHUNKED: return "chunked";
+ default: return "unknown";
+ }
+ }
+ const char *get_type_name() const {
+ return get_type_name(type);
+ }
+ static void generate_test_instances(list<object_manifest_t*>& o);
+ void encode(bufferlist &bl) const;
+ void decode(bufferlist::iterator &bl);
+ void dump(Formatter *f) const;
+ friend ostream& operator<<(ostream& out, const object_info_t& oi);
+};
+WRITE_CLASS_ENCODER(object_manifest_t)
+ostream& operator<<(ostream& out, const object_manifest_t& oi);
struct object_info_t {
hobject_t soid;
FLAG_DATA_DIGEST = 1 << 4, // has data crc
FLAG_OMAP_DIGEST = 1 << 5, // has omap crc
FLAG_CACHE_PIN = 1 << 6, // pin the object in cache tier
+ FLAG_MANIFEST = 1 << 7, // has manifest
// ...
FLAG_USES_TMAP = 1<<8, // deprecated; no longer used.
} flag_t;
uint64_t expected_object_size, expected_write_size;
uint32_t alloc_hint_flags;
+ struct object_manifest_t manifest;
+
void copy_user_bits(const object_info_t& other);
static ps_t legacy_object_locator_to_ps(const object_t &oid,
bool is_cache_pinned() const {
return test_flag(FLAG_CACHE_PIN);
}
+ bool has_manifest() const {
+ return !manifest.is_empty();
+ }
void set_data_digest(__u32 d) {
set_flag(FLAG_DATA_DIGEST);