GitBook: [docs] 54 pages and 6 assets modified

This commit is contained in:
boneyard93501 2021-03-31 20:21:34 +00:00 committed by gitbook-bot
parent 8788229521
commit f4814439c6
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
7 changed files with 17 additions and 11 deletions

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -18,7 +18,6 @@
* [SQLite Service](development_development/development_reward_block_app/development_sqlite.md)
* [Blocks To Database](development_development/development_reward_block_app/development_persisting_blocks.md)
* [Additional Concepts](development_development/development_reward_block_app/development_additional_concepts.md)
* [A Little More AIR, Please](development_development/development_reward_block_app/development_more_air.md)
* [Recap](development_development/development_reward_block_app/recap.md)
* [Building A Frontend with JS SDK](building-a-frontend-with-js-sdk.md)
* [Knowledgebase](knowledge_knowledge/README.md)

View File

@ -183,7 +183,9 @@ Particle id: 5fb0af87-310f-4b12-8c73-e044cfd8ef6e. Waiting for results... Press
And we are golden. Give it some time and start checking Ethqlite for latest block and reward info!!
TODO: this isn't working since we can't upload a key with the script.
{% hint style="info" %}
Unfortunately, our daemonized service won't work just yet as the current implementation cannot take the \(client\) seed we need in order to get our SQLite write working. It's on the to-do list but if you need it, please contact us and we'll see about juggling priorities.
{% endhint %}
For completeness sake, let's remove the stored service with the following AIR script:
@ -192,8 +194,6 @@ For completeness sake, let's remove the stored service with the following AIR sc
(call node ("script" "remove") [script_id] result)
```
TODO: finalize or delete for now.
## Advanced Service Output Access
As Aquamarine advances a particle's journey through the network, output from a service at workflow sequence s-1 method tends to be the input for a service at sequence s method. For example, the _hex\_to\_int_ method, as used earlier, takes the output from the _get\_latest\_block_ method. With single parameter outputs, this is a pretty straight forward and inherently decoupled dependency relation. However, when result parameters become more complex, such as structs, we still would like to keep services as decoupled as possible.

View File

@ -23,7 +23,7 @@ AIR instructions are intended to launch the execution of a service method as fol
4. The arguments specified by the argument list are passed to the method
5. The result of the method returned under the name output name
**Figure 2: Sequential Instruction** ![Execution](../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29.png)
**Figure 2: Sequential Instruction** ![Execution](../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29%20%281%29.png)
The seq instruction takes two instructions at most as its arguments and executes them sequentially, one after the other.
@ -33,7 +33,7 @@ The par</i.> instruction takes two instructions at most as its arguments a
TODO: add better graphic showing the disticntion of branching vs seq.
**Figure 4: Fold Instruction** ![Execution](../../.gitbook/assets/air_fold_4%20%281%29.png)
**Figure 4: Fold Instruction** ![Execution](../../.gitbook/assets/air_fold_4%20%281%29%20%281%29.png)
The fold instruction iterates over the elements of an array and workds as follows:

View File

@ -6,29 +6,36 @@ The [Fluence Dashboard](https://dash.fluence.dev/) facilitates the discovery of
In order to execute the cUrl service and collect the result, i.e., response, we call upon our composition and coordination medium Aquamarine via an Aquamarine Intermediate Representation \(AIR\) script.
```text
```scheme
;; handle possible errors via xor
(xor
(seq
;; call function 'service_id.request' on node 'relay'
(call relay (service_id "request") [url] result)
;; return result back to the client
(call %init_peer_id% (returnService "run") [result])
)
;; if error, return it to the client
(call %init_peer_id% (returnService "run") [%last_error%])
)
```
Without going too deep into Aquamarine and AIR, this script specifies that we call a public peer-to-peer relay \(node\) on the network, ask to run the \(curl\) _request_ function with data parameter _url_ and _service\_id_ parameter, and collect the _result_ **xor** the _error message_ in case of execution failure. We also promise to pass the _service\_id_ and _url_ parameters to the scripts. The "magic" happens by handing the script to the `fldist` CLI tool, which then sends the script for execution to the specified p2p network and locally shadows the execution. Please note that Instead of developing full-fledged frontend applications, we use the `fldist` CLI tool. However, a [JS SDK](https://github.com/fluencelabs/fluence-js) is available to accelerate the development of more complex frontend applications.
Without going too deep into Aquamarine and AIR, this script specifies that we call a public peer-to-peer relay \(node\) on the network, ask to run the \(curl\) _request_ function with data parameter _url_ and _service\_id_ parameter, and collect the _result_ **xor** the _error message_ in case of execution failure. We also promise to pass the _service\_id_ and _url_ parameters to the scripts.
The "magic" happens by handing the script to the `fldist` CLI tool, which then sends the script for execution to the specified p2p network and locally shadows the execution. Please note that Instead of developing full-fledged frontend applications, we use the `fldist` CLI tool. However, a [JS SDK](https://github.com/fluencelabs/fluence-js) is available to accelerate the development of more complex frontend applications.
{% hint style="info" %}
Throughout the document, we utilize service and node ids, which in most cases may be different for you.
{% endhint %}
With the service id parameter obtained from the dashboard lookup above, e.g., "f92ce98b-1ed6-4ce3-9864-11f4e93a478f", and some Fluence goodness at both the local and remote levels enables us to:
With the service id parameter obtained from the dashboard lookup above, e.g., `"f92ce98b-1ed6-4ce3-9864-11f4e93a478f"`, and some Fluence goodness at both the local and remote levels enables us to:
1. find the p2p node hosting the curl service with above service id ,
2. execute the service and
3. collect the response
In your directory of choice, save the above script as _curl\_request.clj_ and run:
In your directory of choice, save the above script as `curl_request.clj` and run:
```bash
$ fldist run_air -p curl_request.clj -d '{"service_id": "f92ce98b-1ed6-4ce3-9864-11f4e93a478f", "url":"https://api.duckduckgo.com/?q=homotopy&format=json"}'
@ -75,7 +82,7 @@ To recap, we:
* executed the \(remote\) curl service request, and
* collected the result
With essentially a two line script and a couple of parameters we executed a search request as a service on a peer-to-peer network. Even this small example should impress the ease afforded by Aquamarine to compose applications from portable, reusable and distributed services not only taken serverless to the next level by greatly reducing devops requirements but also empowering developers with a composition and coordination medium second to none.
With essentially a two-line script and a couple of parameters, we executed a search request as a service on a peer-to-peer network. Even this small example should impress the ease afforded by Aquamarine to compose applications from portable, reusable and distributed services not only taken serverless to the next level by greatly reducing devops requirements but also empowering developers with a composition and coordination medium second to none.
In the next section, we build an Ethereum block getter application by coordinating multiple services into an application.