From af9cc0ad8c995ce760c7c552cf97352146146871 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 28 Oct 2024 11:17:55 -0400 Subject: [PATCH 1/5] chore: start whats'new --- sdf/concepts/dataflow-yaml.mdx | 5 ++- sdf/whatsnew.mdx | 60 ++++++---------------------------- 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/sdf/concepts/dataflow-yaml.mdx b/sdf/concepts/dataflow-yaml.mdx index 00016b05..b2790a5c 100644 --- a/sdf/concepts/dataflow-yaml.mdx +++ b/sdf/concepts/dataflow-yaml.mdx @@ -215,6 +215,7 @@ topics: producer: + profile: ``` #### Where @@ -227,6 +228,7 @@ topics: * **converter** - is the converter to deserialize the key (**optional** - defaults to [config](#config)). * **producer** - is the producer configuration (**optional** - defaults to [config](#config)). * **consumer** - is the consumer configuration (**optional** - defaults to [config](#config)). +* **profile** - is the [Fluvio profile] that will be used to perform the connection. Useful to reach an external cluster. #### For Example @@ -307,4 +309,5 @@ dev: [Services]: services.mdx [Services Section]: services.mdx [batching]: /docs/latest/fluvio/concepts/batching -[dataflow examples]: https://github.com/infinyon/stateful-dataflows-examples \ No newline at end of file +[dataflow examples]: https://github.com/infinyon/stateful-dataflows-examples +[Fluvio profile]: /docs/latest/fluvio/cli/fluvio/profile \ No newline at end of file diff --git a/sdf/whatsnew.mdx b/sdf/whatsnew.mdx index 809ba3d9..a5ba5e02 100644 --- a/sdf/whatsnew.mdx +++ b/sdf/whatsnew.mdx @@ -4,14 +4,14 @@ description: Changes and updates to SDF sidebar_position: 20 --- -# Beta 2 +# Beta 3 ## Upgrading -To upgrade CLI to the beta2, run the following command: +To upgrade CLI to the beta3, run the following command: ```bash -$ fvm install sdf-beta2 +$ fvm install sdf-beta3 ``` To upgrade host workers, shutdown and restart the worker: @@ -25,63 +25,24 @@ For upgrading cloud workers, please contact [InfinyOn support](#infinyon-support ### Compatibility and Breaking changes -`0.4.0` version of dataflow is no longer supported. Please upgrade to `0.5.0`. -The version of the dataflow is specified in the `apiVersion` field in the dataflow file. - - ### CLI changes - -Publishing command is simplified. -`sdf hub publish` -> `sdf publish` - - -`run` command is separated into `run` and `deploy`. Please see [deployment] for details: - -To run dataflow in ephemeral mode: -Beta1.1: `sdf run --ephemeral` -Beta2: `sdf run` - - -To run dataflow in a worker: -Beta1.1: `sdf run`, -Beta2: `sdf deploy` - +- `sdf worker list` now performs workers version check by default ### Package migration -Since beta2, the packages functions are consolidated in a single rust crate on generation. This allows us to share types and logic between different package functions. - -In order to migrate your existing packages, you need to generate your package (`sdf generate`) using the `sdf-beta2` version and then copy the code in the new location of the generated code. - -In other words, for each function, the logic in `rust//src/lib.rs` must be copied on `rust//src/.rs`. But please, make sure that all the attributes in `#[sdf]` attribute macro matches with the attributes that we get on code generation. - - +We suggest to regenerate the packages again and copy the operator logic in the new generated file, to include the package generated code improvements. ## New Features -- Support for customizing JSON serialization and deserialization (see [custom serialization]) +- Support connecting to other fluvio cluster topics via profile. See how to access external clusters in [topics configuration]. ## Improvements - -- CLI: Operators logs works for both `run` and `deployment` mode including cloud. -- CLI: Hub package list now shows public or private packages. -- Hub: Private package works with hub. -- Deployment: Separate `run` vs `deployment` mode. -- Deployment: Dataflows can be stopped and started in the worker. -- Deployment: dataflow command uses fully qualified package name to avoid conflicts. -- Deployment: `show dataflow` now display the status and last updated time. -- Deployment: Dataflow can be stopped and restarted. -- Deployment: Import errors are properly reported. -- Worker: Worker listing with `-all` shows the version. -- Config: Producer config now supports `compression`, `isolation`, and `timeout`. -- Cloud: Cloud supports larger worker storage. -- Cloud: Secret support -- Package: Generated codes are consolidated and hidden from developers. -- Operator: Operator error messages are sent to log. +- Upgrade wasmtime to 26 +- Support `sdf cleanup` in packages. ## Bug Fixes -- CLI show list of created topics +- Terminate daemon sdf if parent terminates ## InfinyOn Support @@ -89,5 +50,4 @@ For any questions or issues, please contact InfinyOn support at support@infinyon [deployment]: deployment.mdx -[custom serialization]: concepts/custom-serialization.mdx - +[topics configuration]: concepts/dataflow-yaml.mdx#topics From 0bf5ed9f4b4bf691fdf6d3094e251fd35725fa76 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 28 Oct 2024 12:15:27 -0400 Subject: [PATCH 2/5] chore: update overview --- sdf/composition/overview.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdf/composition/overview.mdx b/sdf/composition/overview.mdx index 47b8ad65..421a091a 100644 --- a/sdf/composition/overview.mdx +++ b/sdf/composition/overview.mdx @@ -171,7 +171,7 @@ The generator created several directories and files that we'll edit next. ##### 3. Add the Custom Code -First, let's update the first function, `sentence-to-words`. Open `rust/sentence-to-words/src/lib.rs` and update the function body with the following code: +First, let's update the first function, `sentence-to-words`. Open `rust/sentence-pkg/src/sentence_to_words.rs` and update the function body with the following code: ```rust pub(crate) fn sentence_to_words(sentence: String) -> Result> { @@ -179,7 +179,7 @@ pub(crate) fn sentence_to_words(sentence: String) -> Result> { } ``` -Next update `augment_count`. Open `rust/augment-count/src/lib.rs` and replace the function body: +Next update `augment_count`. Open `rust/sentence-pkg/src/augment_count.rs` and replace the function body: ```rust pub(crate) fn augment_count(word: String) -> Result { @@ -231,7 +231,7 @@ augment-count Let's test `sentence-to-words` first: ```bash copy="fl" ->> test function sentence-to-words --input "Hello World" +>> test function sentence-to-words --value "Hello World" Hello World ``` @@ -239,14 +239,14 @@ World Next, test `augment-count`: ```bash copy="fl" ->> test function augment-count --input "Hello" +>> test function augment-count --value "Hello" Hello(5) ``` You may also test the `rust` code via Cargo: ```bash -$ cd rust +$ cd rust/sentence-pkg $ cargo test ``` @@ -436,7 +436,7 @@ The dataflow collects runtime metrics that you can inspect in the runtime termin Check the `sentence-to-words` counters: ```bash copy="fl" ->> show state sentence-words/sentence-to-words/metrics --table +>> show state sentence-words/sentence-to-words/metrics Key Window succeeded failed stats * 2 0 ``` @@ -444,7 +444,7 @@ Check the `sentence-to-words` counters: Check the `augment-count` counters: ```bash copy="fl" ->> show state sentence-words/augment-count/metrics --table +>> show state sentence-words/augment-count/metrics Key Window succeeded failed stats * 4 0 ``` From 00771767f7cace830ed5b6eda47a8ec8d7f39311 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 28 Oct 2024 12:43:02 -0400 Subject: [PATCH 3/5] chore: updates for new release --- sdf/composition/overview.mdx | 295 +-------------------------------- sdf/composition/quickstart.mdx | 13 +- sdf/whatsnew.mdx | 4 +- 3 files changed, 10 insertions(+), 302 deletions(-) diff --git a/sdf/composition/overview.mdx b/sdf/composition/overview.mdx index 421a091a..d535a5ff 100644 --- a/sdf/composition/overview.mdx +++ b/sdf/composition/overview.mdx @@ -91,166 +91,7 @@ The sections are as follows: * `functions` - defines functions in the package * `dev` - defines substitutions used during development and test - -#### Build and Test a Package - -We'll use the [SDF] command line tool with the package definition file to generate the WebAssembly glue code and the placeholder for the custom logic. - -```bash copy="fl" -$ sdf -h -Stateful Dataflow Command Line Interface - -Usage: sdf - -Commands: - clean Clean generated artifacts such as state and internal objects - build Build package (requires: sdf-package.yaml) - generate Generate package (requires: sdf-package.yaml) - update Update package (requires: sdf-package.yaml) - test Test command shell (requires sdf-package.yaml) - run Run dataflow (requires: dataflow.yaml) - setup Setup pre-requisites for Stateful Dataflows - version Prints binary version - log Print dataflow logs -``` - -Let's start with an example. Create a package that split sentences into words and counts the number of characters in each word. - -##### 1. Create the Package file - -Create a fresh project directory `split-sentence` with two subdirectories: `packages` and `sentence`: - -```bash -$ mkdir -p split-sentence/packages/sentence -$ cd split-sentence/packages/sentence -``` - -Inside the `sentence` directory and create the `sdf-package.yaml` and add the following content: - -```yaml -#sdf-package.yaml -apiVersion: 0.5.0 - -meta: - name: sentence-pkg - version: 0.1.0 - namespace: example - -functions: - - sentence-to-words: - operator: flat-map - inputs: - - name: sentence - type: string - output: - type: string - - augment-count: - operator: map - inputs: - - name: word - type: string - output: - type: string - -dev: - converter: raw -``` - -##### 2. Generate the Package Project - -Use SDF generate command to build the project: - -```bash copy="fl" -$ sdf generate -``` - -The generator created several directories and files that we'll edit next. - - -##### 3. Add the Custom Code - -First, let's update the first function, `sentence-to-words`. Open `rust/sentence-pkg/src/sentence_to_words.rs` and update the function body with the following code: - -```rust -pub(crate) fn sentence_to_words(sentence: String) -> Result> { - Ok(sentence.split_whitespace().map(String::from).collect()) -} -``` - -Next update `augment_count`. Open `rust/sentence-pkg/src/augment_count.rs` and replace the function body: - -```rust -pub(crate) fn augment_count(word: String) -> Result { - Ok(format!("{}({})", word, word.chars().count())) -} -``` - -Let's add some tests as well: - -```rust -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_augment_count() { - let input = "Hello".to_string(); - let output = augment_count(input); - assert_eq!(output.unwrap(), "Hello(5)"); - } -} -``` - -We've implemented both functions; it's time to compile and test our work. - - -##### 4. Build and Test the Package - -To build the package, run: - -```bash -$ sdf build -``` - -Use `sdf test` interactive shell to test the code: - -```bash -$ sdf test -``` - -In the test shell, you can view the functions available for testing: - -```bash copy="fl" ->> show functions -sentence-to-words -augment-count -``` - -Let's test `sentence-to-words` first: - -```bash copy="fl" ->> test function sentence-to-words --value "Hello World" -Hello -World -``` - -Next, test `augment-count`: - -```bash copy="fl" ->> test function augment-count --value "Hello" -Hello(5) -``` - -You may also test the `rust` code via Cargo: - -```bash -$ cd rust/sentence-pkg -$ cargo test -``` - -The tests passed, and the package is now ready to use in the dataflow file. +# Dataflows ## The Dataflow @@ -326,144 +167,16 @@ The sections are as follows: The dataflow file has other variants such as `window` and `partitions`, which are omitted for simplicity. For additional details check the [Dataflow file] section. +# Getting started -#### Create a Dataflow - -We'll import the package built in the [previous](#build-and-test-a-package) section to create the `split-sentence` dataflow. - -##### 1. Create the Dataflow file - -Create a dataflow file in the directory `split-sentence` directory: - -```bash -$ cd split-sentence -``` - -Create the `dataflow.yaml` and add the following content: - -```yaml name="dataflow.yaml" -apiVersion: 0.5.0 - -meta: - name: split-sentence - version: 0.1.0 - namespace: example - -imports: - - pkg: example/sentence-pkg@0.1.0 - functions: - - name: sentence-to-words - - name: augment-count - -config: - converter: raw - -topics: - sentence: - schema: - value: - type: string - converter: raw - words: - schema: - value: - type: string - converter: raw - -services: - sentence-words: - sources: - - type: topic - id: sentence - - transforms: - - operator: flat-map - uses: sentence-to-words - - operator: map - uses: augment-count - - sinks: - - type: topic - id: words - -dev: - imports: - - pkg: example/sentence-pkg@0.1.0 - path: ./packages/sentence -``` - -##### 2. Run the Dataflow +See [next section] for a quickstart. -Use `sdf` command line tool to run the dataflow: - -```bash copy="fl" -$ sdf run --dev -``` - -Use `--dev` to ask the engine to change the path to the local package. Without this flag, the engine will look for the package in `InfinyOn Hub`. - - -##### 3. Test the Dataflow - -1. Produce sentences to in `sentence` topic: - -```bash copy="fl" -$ fluvio produce sentence -``` - -```bash -Hello world -Hi there -``` - -Consume from `words` to retrieve the result: - -```bash -$ fluvio consume words -Bd -``` - -```bash -Hello(5) -world(5) -Hi(2) -there(5) -``` - -##### 4. Show State - -The dataflow collects runtime metrics that you can inspect in the runtime terminal. - -Check the `sentence-to-words` counters: - -```bash copy="fl" ->> show state sentence-words/sentence-to-words/metrics - Key Window succeeded failed - stats * 2 0 -``` - -Check the `augment-count` counters: - -```bash copy="fl" ->> show state sentence-words/augment-count/metrics - Key Window succeeded failed - stats * 4 0 -``` - -Congratulations! You've successfully built and run a composable dataflow! The project is available for download in [github]. - -##### 5. Clean-up - -Exit the `sdf` terminal and remove the topics: - -```bash -fluvio topic delete sentence -fluvio topic delete words -``` ### References * [Example Workflows in github] +[next section]: quickstart.mdx [Inline Dataflows]: sdf/quickstart.mdx [Dataflow file]: sdf/concepts/dataflow-yaml.mdx [SDF]: sdf/cli/index.mdx diff --git a/sdf/composition/quickstart.mdx b/sdf/composition/quickstart.mdx index dfda5de4..66439fa7 100644 --- a/sdf/composition/quickstart.mdx +++ b/sdf/composition/quickstart.mdx @@ -9,11 +9,6 @@ sidebar_position: 20 This guide will get you started with [SDF], an utility that helps developers build, troubleshoot, and run full-featured event-driven dataflows. -#### Overview - -This [SDF] release includes several new features and improvements. The main feature isĀ [composition], which allows you to create individual packages and import them to create dataflows. - - #### Example Dataflow As an example, we'll create a dataflow that splits sentences into words, and counts the number of characters in each word. @@ -66,7 +61,7 @@ Your Fluvio cluster is ready for use. SDF is in beta and it requires the following image: ```bash -fvm install sdf-beta2 +fvm install sdf-beta3 ``` You can validate prerequisites with: @@ -145,7 +140,7 @@ The generator created several directories and files that we'll edit next. #### 1.3 Add the Custom Code -First let's update the first function `sentence-to-words`. Open `rust/sentence-to-words/src/lib.rs` and update the function body with the following code: +First let's update the first function `sentence-to-words`. Open `rust/sentence-pkg/src/sentence_to_words.rs` and update the function body with the following code: ```rust fn sentence_to_words(sentence: String) -> Result> { @@ -153,7 +148,7 @@ fn sentence_to_words(sentence: String) -> Result> { } ``` -Next update `augment_count`. Open `rust/augment-count/src/lib.rs` and replace the function body: +Next update `augment_count`. Open `rust/sentence-pkg/src/augment_count.rs` and replace the function body: ```rust fn augment_count(word: String) -> Result { @@ -374,7 +369,7 @@ For additional examples, check out [stateful-dataflows-examples] in github. The Stateful Dataflows is an ambitious project with many possibilities and just as many hazards. Please get in touch, we would love to hear your feedback and help us steer the product in the right direction. -[SDF]: /sdf +[SDF]: sdf [composition]: overview.mdx [stateful-dataflows-examples]: https://github.com/infinyon/stateful-dataflows-examples [github]: https://github.com/infinyon/stateful-dataflows-examples/tree/main/dataflows-composed/split-sentence diff --git a/sdf/whatsnew.mdx b/sdf/whatsnew.mdx index a5ba5e02..91ae727f 100644 --- a/sdf/whatsnew.mdx +++ b/sdf/whatsnew.mdx @@ -38,11 +38,11 @@ We suggest to regenerate the packages again and copy the operator logic in the n - Support connecting to other fluvio cluster topics via profile. See how to access external clusters in [topics configuration]. ## Improvements -- Upgrade wasmtime to 26 - Support `sdf cleanup` in packages. +- Improvements on SDF packages. ## Bug Fixes -- Terminate daemon sdf if parent terminates +- Sdf dataflow properly terminates in host worker. ## InfinyOn Support From bc5ceebf44e777854cdbf833378a71df58f058fb Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 28 Oct 2024 13:48:45 -0400 Subject: [PATCH 4/5] chore: use embeds for installacion command --- sdf/_embeds/install-sdf.bash | 1 + sdf/cli/index.mdx | 7 ++++--- sdf/composition/overview.mdx | 3 --- sdf/composition/quickstart.mdx | 9 +++++---- sdf/quickstart.mdx | 8 +++++--- sdf/whatsnew.mdx | 7 ++++--- 6 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 sdf/_embeds/install-sdf.bash diff --git a/sdf/_embeds/install-sdf.bash b/sdf/_embeds/install-sdf.bash new file mode 100644 index 00000000..80d5a53d --- /dev/null +++ b/sdf/_embeds/install-sdf.bash @@ -0,0 +1 @@ +fvm install sdf-beta3 \ No newline at end of file diff --git a/sdf/cli/index.mdx b/sdf/cli/index.mdx index 1ae842ac..12002737 100644 --- a/sdf/cli/index.mdx +++ b/sdf/cli/index.mdx @@ -4,6 +4,9 @@ description: Stateful Dataflows Command Line Interface. sidebar_position: 10 --- +import CodeBlock from '@theme/CodeBlock'; +import InstallFvm from '!!raw-loader!../_embeds/install-sdf.bash'; + Stateful Dataflows (sdf) is a binary, shipped with fluvio, that helps developers build, test, and deploy packages and dataflows. ### Install SDF @@ -16,9 +19,7 @@ $ curl -fsS https://hub.infinyon.cloud/install/install.sh | bash 2. Install the preview release: -```bash copy="fl" -$ fvm install sdf-beta2 -``` +{InstallFvm} ### SDF Commands diff --git a/sdf/composition/overview.mdx b/sdf/composition/overview.mdx index d535a5ff..2ac33dad 100644 --- a/sdf/composition/overview.mdx +++ b/sdf/composition/overview.mdx @@ -91,13 +91,10 @@ The sections are as follows: * `functions` - defines functions in the package * `dev` - defines substitutions used during development and test -# Dataflows - ## The Dataflow The **dataflow** imports functions, types, and states from one more package. Packages may also import components from others; however, dataflow maintains the final composition. - #### `dataflow.yaml` The [SDF] command line tool uses the dataflow definition file `dataflow.yaml` to assemble the data application, and it has the following hierarchy: diff --git a/sdf/composition/quickstart.mdx b/sdf/composition/quickstart.mdx index 66439fa7..30a2dfdb 100644 --- a/sdf/composition/quickstart.mdx +++ b/sdf/composition/quickstart.mdx @@ -4,6 +4,9 @@ description: Guide on how to create Stateful Dataflows using the Stateful Datafl sidebar_position: 20 --- +import CodeBlock from '@theme/CodeBlock'; +import InstallFvm from '!!raw-loader!../_embeds/install-sdf.bash'; + # Getting Started with Stateful Dataflows This guide will get you started with [SDF], an utility that helps developers build, troubleshoot, and run full-featured event-driven dataflows. @@ -60,9 +63,7 @@ Your Fluvio cluster is ready for use. SDF is in beta and it requires the following image: -```bash -fvm install sdf-beta3 -``` +{InstallFvm} You can validate prerequisites with: @@ -369,7 +370,7 @@ For additional examples, check out [stateful-dataflows-examples] in github. The Stateful Dataflows is an ambitious project with many possibilities and just as many hazards. Please get in touch, we would love to hear your feedback and help us steer the product in the right direction. -[SDF]: sdf +[SDF]: ../../ [composition]: overview.mdx [stateful-dataflows-examples]: https://github.com/infinyon/stateful-dataflows-examples [github]: https://github.com/infinyon/stateful-dataflows-examples/tree/main/dataflows-composed/split-sentence diff --git a/sdf/quickstart.mdx b/sdf/quickstart.mdx index f1fa27da..07bd0735 100644 --- a/sdf/quickstart.mdx +++ b/sdf/quickstart.mdx @@ -4,6 +4,10 @@ description: Getting started with Stateful Dataflows sidebar_position: 10 --- +import CodeBlock from '@theme/CodeBlock'; +import InstallFvm from '!!raw-loader!./_embeds/install-sdf.bash'; + + # SDF Quickstart Provisioning and operating a Stateful Dataflow requires the following system components: @@ -35,9 +39,7 @@ Let's create a simple dataflow to split a sentence into words and count the word Stateful dataflows are managed via [sdf cli] that we install it using [fvm]. -``` -$ fvm install sdf-beta2 -``` +{InstallFvm} ### 2. Create the Dataflow file diff --git a/sdf/whatsnew.mdx b/sdf/whatsnew.mdx index 91ae727f..01b32d33 100644 --- a/sdf/whatsnew.mdx +++ b/sdf/whatsnew.mdx @@ -4,15 +4,16 @@ description: Changes and updates to SDF sidebar_position: 20 --- +import CodeBlock from '@theme/CodeBlock'; +import InstallFvm from '!!raw-loader!./_embeds/install-sdf.bash'; + # Beta 3 ## Upgrading To upgrade CLI to the beta3, run the following command: -```bash -$ fvm install sdf-beta3 -``` +{InstallFvm} To upgrade host workers, shutdown and restart the worker: From a53760013e76a4ed886be2cb95a870e8ce22f177 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Mon, 28 Oct 2024 14:02:51 -0400 Subject: [PATCH 5/5] chore: use embed --- sdf/_embeds/operators/augment_count.rs | 3 +++ sdf/_embeds/operators/sentence_to_words.rs | 3 +++ sdf/composition/quickstart.mdx | 14 ++++---------- 3 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 sdf/_embeds/operators/augment_count.rs create mode 100644 sdf/_embeds/operators/sentence_to_words.rs diff --git a/sdf/_embeds/operators/augment_count.rs b/sdf/_embeds/operators/augment_count.rs new file mode 100644 index 00000000..deb76ec5 --- /dev/null +++ b/sdf/_embeds/operators/augment_count.rs @@ -0,0 +1,3 @@ +fn augment_count(word: String) -> Result { + Ok(format!("{}({})", word, word.chars().count())) +} diff --git a/sdf/_embeds/operators/sentence_to_words.rs b/sdf/_embeds/operators/sentence_to_words.rs new file mode 100644 index 00000000..b0d07378 --- /dev/null +++ b/sdf/_embeds/operators/sentence_to_words.rs @@ -0,0 +1,3 @@ +fn sentence_to_words(sentence: String) -> Result> { + Ok(sentence.split_whitespace().map(String::from).collect()) +} diff --git a/sdf/composition/quickstart.mdx b/sdf/composition/quickstart.mdx index 30a2dfdb..f65d1182 100644 --- a/sdf/composition/quickstart.mdx +++ b/sdf/composition/quickstart.mdx @@ -6,6 +6,8 @@ sidebar_position: 20 import CodeBlock from '@theme/CodeBlock'; import InstallFvm from '!!raw-loader!../_embeds/install-sdf.bash'; +import SentenceToWords from '!!raw-loader!../_embeds/operators/sentence_to_words.rs'; +import AugmentCount from '!!raw-loader!../_embeds/operators/augment_count.rs'; # Getting Started with Stateful Dataflows @@ -143,19 +145,11 @@ The generator created several directories and files that we'll edit next. First let's update the first function `sentence-to-words`. Open `rust/sentence-pkg/src/sentence_to_words.rs` and update the function body with the following code: -```rust -fn sentence_to_words(sentence: String) -> Result> { - Ok(sentence.split_whitespace().map(String::from).collect()) -} -``` +{SentenceToWords} Next update `augment_count`. Open `rust/sentence-pkg/src/augment_count.rs` and replace the function body: -```rust -fn augment_count(word: String) -> Result { - Ok(format!("{}({})", word, word.chars().count())) -} -``` +{AugmentCount} Let's add some tests as well: