GitBook: [docs] 6 pages modified

This commit is contained in:
boneyard93501 2021-03-31 21:01:56 +00:00 committed by gitbook-bot
parent d48b8508f5
commit b2370610e3
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
6 changed files with 13 additions and 23 deletions

View File

@ -44,7 +44,7 @@
* [Building a Collaborative Editor](tutorials_tutorials/building-a-collaborative-editor.md)
* [Recipes](recipes_recipes/README.md)
* [Setting Up Your Environment](recipes_recipes/recipes_setting_up.md)
* [Curl](recipes_recipes/recipes_curl.md)
* [cUrl as a Service](recipes_recipes/recipes_curl.md)
* [Error Management and Testing Of Services](recipes_recipes/error-management-and-testing-of-services.md)
* [Sqlite](recipes_recipes/sqlite.md)
* [Redis](recipes_recipes/redis.md)

View File

@ -183,9 +183,7 @@ 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!!
{% 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 %}
TODO: this isn't working since we can't upload a key with the script.
For completeness sake, let's remove the stored service with the following AIR script:
@ -194,6 +192,8 @@ 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%20%281%29.png)
**Figure 2: Sequential Instruction** ![Execution](../../.gitbook/assets/air_sequential_2%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%20%281%29.png)
**Figure 4: Fold Instruction** ![Execution](../../.gitbook/assets/air_fold_4%20%281%29.png)
The fold instruction iterates over the elements of an array and workds as follows:

View File

@ -6,36 +6,29 @@ 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.
```scheme
;; handle possible errors via xor
```text
(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"}'
@ -82,7 +75,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.

View File

@ -1,4 +1,4 @@
# Curl
# cUrl as a Service
## Overview

View File

@ -1,7 +1,4 @@
# Research, Papers And References
* [Fluence Manifesto](https://fluence.network/manifesto.html)
* [Fluence Protocol](https://github.com/fluencelabs/rfcs/blob/main/0-overview.md)
Coming soon. If you really need this section, contact us through any of the social media channels or Github.