Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ownership proto #151

Merged
merged 1 commit into from
Dec 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- The key in the process's nodes had been moved from the node resource to the root of the node.
- `CreateProcessRequest` now accepts a `name` instead of a `key`.
- `Execution` contains a `nodeKey` instead of `stepID`
- Ownership now contains the `resourceHash` and a `resource` that can be `Service (1)` or `Process (2)`. `serviceHash` attribute has been removed

#### Added

Expand Down
19 changes: 14 additions & 5 deletions packages/api/src/protobuf/types/ownership.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option go_package = "github.com/mesg-foundation/engine/ownership";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = true;


// Ownership is a ownership relation between one owner and a resource.
message Ownership {

Expand All @@ -24,10 +25,18 @@ message Ownership {
];

// Resource's hash.
oneof resource {
bytes serviceHash = 3 [
(gogoproto.moretags) = 'hash:"name:3"',
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash"
];
bytes resourceHash = 3 [
(gogoproto.moretags) = 'hash:"name:3"',
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

enum Resource {
None = 0;
Service = 1;
Process = 2;
}

// Resource's type.
Resource resource = 4;
}
23 changes: 18 additions & 5 deletions packages/api/src/typedef/ownership.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ declare namespace mesg {
/** Ownership owner */
owner?: (string|null);

/** Ownership serviceHash */
serviceHash?: (Uint8Array|null);
/** Ownership resourceHash */
resourceHash?: (Uint8Array|null);

/** Ownership resource */
resource?: (mesg.types.Ownership.Resource|null);
}

/** Represents an Ownership. */
Expand All @@ -38,11 +41,21 @@ declare namespace mesg {
/** Ownership owner. */
public owner: string;

/** Ownership serviceHash. */
public serviceHash: Uint8Array;
/** Ownership resourceHash. */
public resourceHash: Uint8Array;

/** Ownership resource. */
public resource?: "serviceHash";
public resource: mesg.types.Ownership.Resource;
}

namespace Ownership {

/** Resource enum. */
enum Resource {
None = 0,
Service = 1,
Process = 2
}
}
}

Expand Down