Skip to content

Commit

Permalink
Move node configuration to runtime
Browse files Browse the repository at this point in the history
The ApplicationConfiguration object is now more of a directory of
executable wasm modules, and an initial Node configuration.

Subsequent Nodes are created at runtime by passing the serialized
NodeConfiguration protobuf message to `node_create` directly.

This allows removing an extra indirection from application to the config
of individual nodes, in favour of inlining configs in the Wasm code of
the main node itself.

Ref project-oak#688
  • Loading branch information
tiziano88 committed Apr 30, 2020
1 parent 01d4558 commit ff8a731
Show file tree
Hide file tree
Showing 56 changed files with 698 additions and 1,066 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions docs/abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,22 @@ return the channel handles for its read and write halves.

### node_create

`node_create: (usize, usize, usize, usize, usize, usize, u64) -> u32` creates a
new Node running the Node configuration identified by args 0 and 1, using the
entrypoint specified by args 2 and 3, passing in an initial handle to the read
half of a channel identified by arg 4. The entrypoint name is ignored when
creating non-WebAssembly Nodes.
`node_create: (usize, usize, usize, usize, u64) -> u32` creates a new Node
running the Node configuration identified by args 0 and 1, passing in an initial
handle to the read half of a channel identified by arg 4.

The Node configuration is a serialized
[`NodeConfiguration`](/oak/proto/application.proto) protobuf message.

If creating the specified node would violate
[information flow control](/docs/concepts.md#labels), returns
`PERMISSION_DENIED`.

- arg 0: Source buffer holding node configuration name
- arg 1: Node configuration name size in bytes
- arg 2: Source buffer holding entrypoint name
- arg 3: Entrypoint name size in bytes
- arg 4: Source buffer holding label
- arg 5: Label size in bytes
- arg 6: Handle to channel
- arg 0: Source buffer holding serialized NodeConfiguration
- arg 1: Serialized NodeConfiguration size in bytes
- arg 2: Source buffer holding label
- arg 3: Label size in bytes
- arg 4: Handle to channel
- return 0: Status of operation

### random_get
Expand Down
3 changes: 0 additions & 3 deletions examples/abitest/abitest_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ impl oak::io::Encodable for InternalMessage {
Ok(oak::io::Message { bytes, handles })
}
}

// Expected name for log node config.
pub const LOG_CONFIG_NAME: &str = "logging-config";
4 changes: 2 additions & 2 deletions examples/abitest/config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ exports_files(srcs = glob(["*.textproto"]))
serialized_config(
name = "config",
modules = {
"frontend-config": "//:target/wasm32-unknown-unknown/release/abitest_0_frontend.wasm",
"backend-config": "//:target/wasm32-unknown-unknown/release/abitest_1_backend.wasm",
"frontend_module": "//:target/wasm32-unknown-unknown/release/abitest_0_frontend.wasm",
"backend_module": "//:target/wasm32-unknown-unknown/release/abitest_1_backend.wasm",
},
textproto = ":config.textproto",
)
57 changes: 6 additions & 51 deletions examples/abitest/config/config.textproto
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
node_configs {
name: "frontend-config"
wasm_config {
module_bytes: "<bytes>"
}
}
node_configs {
name: "backend-config"
wasm_config {
module_bytes: "<bytes>"
}
}
node_configs {
name: "logging-config"
log_config {}
}
node_configs {
name: "storage"
storage_config {
address: "localhost:7867"
}
}
node_configs {
name: "absent-storage"
storage_config {
address: "test.invalid:9999"
}
}
node_configs {
name: "grpc-client"
grpc_client_config {
address: "localhost:7878"
}
}
node_configs {
name: "absent-grpc-client"
grpc_client_config {
address: "test.invalid:9999"
}
}
node_configs {
name: "roughtime-client"
roughtime_client_config {}
}
node_configs {
name: "roughtime-misconfig"
roughtime_client_config {
min_overlapping_intervals: 99
grpc_port: 8080
initial_node_configuration: {
name: "main"
wasm_config: {
wasm_module_name: "frontend_module"
wasm_entrypoint_name: "frontend_oak_main"
}
}
grpc_port: 8080
initial_node_config_name: "frontend-config"
initial_entrypoint_name: "frontend_oak_main"
Loading

0 comments on commit ff8a731

Please sign in to comment.