*h.back(), 5));
}
+// -- pg_lease_t --
+
+void pg_lease_t::encode(bufferlist& bl) const
+{
+ ENCODE_START(1, 1, bl);
+ encode(readable_until, bl);
+ encode(readable_until_ub, bl);
+ encode(interval, bl);
+ ENCODE_FINISH(bl);
+}
+
+void pg_lease_t::decode(bufferlist::const_iterator& p)
+{
+ DECODE_START(1, p);
+ decode(readable_until, p);
+ decode(readable_until_ub, p);
+ decode(interval, p);
+ DECODE_FINISH(p);
+}
+
+void pg_lease_t::dump(Formatter *f) const
+{
+ f->dump_stream("readable_until") << readable_until;
+ f->dump_stream("readable_until_ub") << readable_until_ub;
+ f->dump_stream("interval") << interval;
+}
+
+void pg_lease_t::generate_test_instances(std::list<pg_lease_t*>& o)
+{
+ o.push_back(new pg_lease_t());
+ o.push_back(new pg_lease_t());
+ o.back()->readable_until = make_timespan(1.5);
+ o.back()->readable_until_ub = make_timespan(3.4);
+ o.back()->interval = make_timespan(1.0);
+}
+
+// -- pg_lease_ack_t --
+
+void pg_lease_ack_t::encode(bufferlist& bl) const
+{
+ ENCODE_START(1, 1, bl);
+ encode(readable_until_ub, bl);
+ ENCODE_FINISH(bl);
+}
+
+void pg_lease_ack_t::decode(bufferlist::const_iterator& p)
+{
+ DECODE_START(1, p);
+ decode(readable_until_ub, p);
+ DECODE_FINISH(p);
+}
+
+void pg_lease_ack_t::dump(Formatter *f) const
+{
+ f->dump_stream("readable_until_ub") << readable_until_ub;
+}
+
+void pg_lease_ack_t::generate_test_instances(std::list<pg_lease_ack_t*>& o)
+{
+ o.push_back(new pg_lease_ack_t());
+ o.push_back(new pg_lease_ack_t());
+ o.back()->readable_until_ub = make_timespan(3.4);
+}
+
+
// -- ObjectModDesc --
void ObjectModDesc::visit(Visitor *visitor) const
{
return out;
}
+/**
+ * pg_lease_t - readable lease metadata, from primary -> non-primary
+ *
+ * This metadata serves to increase either or both of the lease expiration
+ * and upper bound on the non-primary.
+ */
+struct pg_lease_t {
+ /// pg readable_until value; replicas must not be readable beyond this
+ ceph::signedspan readable_until = ceph::signedspan::zero();
+
+ /// upper bound on any acting osd's readable_until
+ ceph::signedspan readable_until_ub = ceph::signedspan::zero();
+
+ /// duration of the lease (in case clock deltas aren't available)
+ ceph::signedspan interval = ceph::signedspan::zero();
+
+ pg_lease_t() {}
+ pg_lease_t(ceph::signedspan ru, ceph::signedspan ruub,
+ ceph::signedspan i)
+ : readable_until(ru),
+ readable_until_ub(ruub),
+ interval(i) {}
+
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_lease_t*>& o);
+
+ friend ostream& operator<<(ostream& out, const pg_lease_t& l) {
+ return out << "pg_lease(ru " << l.readable_until
+ << " ub " << l.readable_until_ub
+ << " int " << l.interval << ")";
+ }
+};
+WRITE_CLASS_ENCODER(pg_lease_t)
+
+/**
+ * pg_lease_ack_t - lease ack, from non-primary -> primary
+ *
+ * This metadata acknowledges to the primary what a non-primary's noted
+ * upper bound is.
+ */
+struct pg_lease_ack_t {
+ /// highest upper bound non-primary has recorded (primary's clock)
+ ceph::signedspan readable_until_ub = ceph::signedspan::zero();
+
+ pg_lease_ack_t() {}
+ pg_lease_ack_t(ceph::signedspan ub)
+ : readable_until_ub(ub) {}
+
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_lease_ack_t*>& o);
+
+ friend ostream& operator<<(ostream& out, const pg_lease_ack_t& l) {
+ return out << "pg_lease_ack(ruub " << l.readable_until_ub << ")";
+ }
+};
+WRITE_CLASS_ENCODER(pg_lease_ack_t)
+
+
+
class PGBackend;
class ObjectModDesc {
bool can_local_rollback;