Commit bd6f4d58 authored by Kenton Varda's avatar Kenton Varda

Define standard 'persistent' annotation.

parent 3a01c67c
......@@ -48,9 +48,10 @@ interface Persistent@0xc8cb212fcd9f5691(SturdyRef, Owner) {
# the capability's interface should NOT inherit `Persistent`; instead, just perform a cast at
# runtime. It's not type-safe, but trying to be type-safe in these cases will likely lead to
# tears. In cases where a particular interface only makes sense on persistent capabilities, it
# *might* make sense to explicitly inherit it. But, even in these cases, you probably don't want
# to specify the `SturdyRef` parameter, since this type may differ from app to app or even host
# to host.
# still should not explicitly inherit Persistent because the `SturdyRef` and `Owner` types will
# vary between realms (they may even be different at the call site than they are on the
# implementation). Instead, mark persistent interfaces with the $persistent annotation (defined
# below).
#
# Sealing
# -------
......@@ -123,3 +124,16 @@ interface RealmGateway(InternalRef, ExternalRef, InternalOwner, ExternalOwner) {
# Given an internal capability, save it and return an external reference. Used when someone
# outside the realm tries to save a capability from inside the realm.
}
annotation persistent(interface, field) :Void;
# Apply this annotation to interfaces for objects that will always be persistent, instead of
# extending the Persistent capability, since the correct type parameters to Persistent depend on
# the realm, which is orthogonal to the interface type and therefore should not be defined
# along-side it.
#
# You may also apply this annotation to a capability-typed field which will always contain a
# persistent capability, but where the capability's interface itself is not already marked
# persistent.
#
# Note that absence of the $persistent annotation doesn't mean a capability of that type isn't
# persistent; it just means not *all* such capabilities are persistent.
......@@ -482,5 +482,35 @@ const ::capnp::_::RawSchema s_ecafa18b482da3aa = {
2, 2, i_ecafa18b482da3aa, nullptr, nullptr, { &s_ecafa18b482da3aa, nullptr, bd_ecafa18b482da3aa, 0, sizeof(bd_ecafa18b482da3aa) / sizeof(bd_ecafa18b482da3aa[0]), nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<21> b_f622595091cafb67 = {
{ 0, 0, 0, 0, 5, 0, 6, 0,
103, 251, 202, 145, 80, 89, 34, 246,
23, 0, 0, 0, 5, 0, 32, 1,
215, 238, 63, 152, 54, 8, 99, 184,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 18, 1, 0, 0,
37, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
32, 0, 0, 0, 2, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 112, 101,
114, 115, 105, 115, 116, 101, 110, 116,
46, 99, 97, 112, 110, 112, 58, 112,
101, 114, 115, 105, 115, 116, 101, 110,
116, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, }
};
::capnp::word const* const bp_f622595091cafb67 = b_f622595091cafb67.words;
#if !CAPNP_LITE
const ::capnp::_::RawSchema s_f622595091cafb67 = {
0xf622595091cafb67, b_f622595091cafb67.words, 21, nullptr, nullptr,
0, 0, nullptr, nullptr, nullptr, { &s_f622595091cafb67, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
} // namespace schemas
} // namespace capnp
......@@ -23,6 +23,7 @@ CAPNP_DECLARE_SCHEMA(b76848c18c40efbf);
CAPNP_DECLARE_SCHEMA(84ff286cd00a3ed4);
CAPNP_DECLARE_SCHEMA(f0c2cc1d3909574d);
CAPNP_DECLARE_SCHEMA(ecafa18b482da3aa);
CAPNP_DECLARE_SCHEMA(f622595091cafb67);
} // namespace schemas
} // namespace capnp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment