Make claims/interest owned

This commit is contained in:
Nadja von Reitzenstein Čerpnjak 2024-04-16 15:12:44 +02:00
parent 1378c8722d
commit d28a3ea5aa
3 changed files with 12 additions and 3 deletions

View File

@ -3,6 +3,7 @@
using CSharp = import "programming_language/csharp.capnp"; using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema"); $CSharp.namespace("FabAccessAPI.Schema");
using import "owned.capnp".Owned;
using import "resource.capnp".Resource; using import "resource.capnp".Resource;
using import "notify.capnp".Notifiable; using import "notify.capnp".Notifiable;
using import "interest.capnp".Interest; using import "interest.capnp".Interest;
@ -36,7 +37,7 @@ interface Lockable {
# already locked will succeed, invalidating the former lock. # already locked will succeed, invalidating the former lock.
} }
interface Claim extends (Notifiable) { interface Claim extends (Notifiable, Owned) {
resource @0 () -> ( resource :Resource, dummy :UInt8 = 0 ); resource @0 () -> ( resource :Resource, dummy :UInt8 = 0 );
# Pointer back to the resource this claim comes from. Primarily useful when restoring persisted # Pointer back to the resource this claim comes from. Primarily useful when restoring persisted
# claims or restoring after a connection failure. # claims or restoring after a connection failure.
@ -77,7 +78,7 @@ interface Claim extends (Notifiable) {
getDependencies @5 () -> ( dependencies: List(Claim) ); getDependencies @5 () -> ( dependencies: List(Claim) );
} }
interface Lock extends (Claim) { interface Lock extends (Claim, Owned) {
# An exclusive claim on a resource. Only a single Lock may exist for any given resource. # An exclusive claim on a resource. Only a single Lock may exist for any given resource.
downgrade @0 () -> ( claim :Claim ); downgrade @0 () -> ( claim :Claim );

View File

@ -3,6 +3,7 @@
using CSharp = import "programming_language/csharp.capnp"; using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema"); $CSharp.namespace("FabAccessAPI.Schema");
using import "owned.capnp".Owned;
using import "resource.capnp".Resource; using import "resource.capnp".Resource;
using import "resource.capnp".Description; using import "resource.capnp".Description;
using import "claim.capnp".Claim; using import "claim.capnp".Claim;
@ -23,7 +24,7 @@ interface Interestable {
# WARNING: Impersonates users # WARNING: Impersonates users
} }
interface Interest { interface Interest extends (Owned) {
resource @0 () -> ( resource :Resource ); resource @0 () -> ( resource :Resource );
describe @1 () -> Description; describe @1 () -> Description;
drop @2 (); drop @2 ();

7
owned.capnp Normal file
View File

@ -0,0 +1,7 @@
@0x8c931d6e0367db87;
using import "user.capnp".User;
interface Owned {
getUser @0 () -> ( owner :User );
}