2021-04-29 12:22:39 +00:00
|
|
|
## Aqua
|
|
|
|
Aqua is a new-gen language for distributed systems.
|
|
|
|
|
|
|
|
Aqua programs are executed on many peers, sequentially
|
|
|
|
or in parallel, forming a single-use coordination network.
|
|
|
|
|
|
|
|
Aqua's runtime is heterogeneous: it includes browsers, servers, devices, all involved in solving a single task.
|
|
|
|
Therefore, Aqua scripts are compiled into several targets at once, with AIR and Typescript as a default.
|
|
|
|
|
|
|
|
## aqua-lib
|
|
|
|
|
2021-07-30 12:00:01 +00:00
|
|
|
API of the protocol-level functions in the Fluence Network.
|
|
|
|
|
|
|
|
This API is available on all peers powered by Fluence nodes, and a part of the API is available on JS/TS-based (browsers, NodeJS) peers.
|
|
|
|
|
|
|
|
### Documentation
|
2022-02-28 11:14:22 +00:00
|
|
|
See [Aqua Book](https://doc.fluence.dev/aqua-book/libraries/aqua-lib).
|
2021-04-29 12:22:39 +00:00
|
|
|
|
2021-07-30 12:00:01 +00:00
|
|
|
### How to use it in Aqua
|
2021-04-29 12:22:39 +00:00
|
|
|
|
2021-07-30 12:00:01 +00:00
|
|
|
Add `@fluencelabs/aqua-lib` to your package.json dependencies, and then in your Aqua script, import and use it:
|
|
|
|
```haskell
|
2022-02-28 09:17:26 +00:00
|
|
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
2021-04-29 12:22:39 +00:00
|
|
|
|
2021-07-30 12:00:01 +00:00
|
|
|
-- gather Peer.identify from all nodes in the neighbourhood
|
|
|
|
func getPeersInfo() -> []Info:
|
|
|
|
infos: *Info
|
|
|
|
nodes <- Kademlia.neighborhood(%init_peer_id%, nil, nil)
|
|
|
|
for node in nodes:
|
|
|
|
on node:
|
|
|
|
infos <- Peer.identify()
|
|
|
|
<- infos
|
|
|
|
```
|
2021-04-29 12:22:39 +00:00
|
|
|
|