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 May 21, 2020
1 parent df425bd commit 81d00ef
Show file tree
Hide file tree
Showing 62 changed files with 781 additions and 1,229 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

23 changes: 12 additions & 11 deletions docs/abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,23 @@ Closes the channel identified by `param[0]`.
### `node_create`

Creates a new Node running the Node configuration identified by `param[0]` and
`param[1]`, using the entrypoint specified by `param[2]` and `param[3]`,
assigning the label specified by `param[4]` and `param[5]` to the newly created
Node, passing in an initial handle to the read half of a channel identified by
`param[6]`. The entrypoint name is ignored when creating non-WebAssembly Nodes.
`param[1]`, assigning the label specified by `param[2]` and `param[3]` to the
newly created Node, passing in an initial handle to the read half of a channel
identified by `param[4]`. The entrypoint name is ignored when creating
non-WebAssembly Nodes.

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
`ERR_PERMISSION_DENIED`.

- `param[0]: usize`: Source buffer holding node configuration name
- `param[1]: usize`: Node configuration name size in bytes
- `param[2]: usize`: Source buffer holding entrypoint name
- `param[3]: usize`: Entrypoint name size in bytes
- `param[4]: usize`: Source buffer holding label
- `param[5]: usize`: Label size in bytes
- `param[6]: usize`: Handle to channel
- `param[0]: usize`: Source buffer holding serialized NodeConfiguration
- `param[1]: usize`: Serialized NodeConfiguration size in bytes
- `param[2]: usize`: Source buffer holding label
- `param[3]: usize`: Label size in bytes
- `param[4]: usize`: Handle to channel
- `result[0]: u32`: 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",
)
65 changes: 6 additions & 59 deletions examples/abitest/config/config.textproto
Original file line number Diff line number Diff line change
@@ -1,61 +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-server"
grpc_server_config {
address: "[::]:8080"
}
}
node_configs {
name: "grpc-client"
grpc_client_config {
uri: "https://localhost:7878"
address: "localhost:7878"
}
}
node_configs {
name: "absent-grpc-client"
grpc_client_config {
uri: "https://test.invalid:9999"
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: "grpc_frontend_oak_main"
Loading

0 comments on commit 81d00ef

Please sign in to comment.