mirror of
https://github.com/fluencelabs/aqua-lib
synced 2025-04-25 07:52:14 +00:00
Compare commits
88 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ac266a69bf | ||
|
cba9b785a3 | ||
|
49ca1fe7ff | ||
|
c8efe9c33a | ||
|
7bf3e62d3b | ||
|
f8ef9f3a54 | ||
|
c01820d7ef | ||
|
b439997ba7 | ||
|
724bd44805 | ||
|
c92d3e3363 | ||
|
ae27eebd67 | ||
|
5414624156 | ||
|
f2665b0292 | ||
|
5b5237dde6 | ||
|
60b91def4a | ||
|
d50ea23fb2 | ||
|
f89ecfbe79 | ||
|
09c2cd9c07 | ||
|
e3c06bf8fc | ||
|
3b31da9a41 | ||
|
a062fcd444 | ||
|
f8d7738798 | ||
|
a59acbf40e | ||
|
401621a389 | ||
|
e0c0d953f6 | ||
|
f3b2144e35 | ||
|
a3ce915a11 | ||
|
0363446d79 | ||
|
658d63472c | ||
|
cce6da5f42 | ||
|
6dff62c393 | ||
|
7402e0c072 | ||
|
39da3b5b5c | ||
|
a773935d65 | ||
|
7634d381d1 | ||
|
3c78d8693f | ||
|
3da9ce925b | ||
|
428365b886 | ||
|
8447625cfa | ||
|
c47dd03e8c | ||
|
67edcbb584 | ||
|
fbde8e97c2 | ||
|
8db811843c | ||
|
b849728f05 | ||
|
ca0af31ace | ||
|
a6f4a2af5a | ||
|
96af0d4d4d | ||
|
d4b2e5dd40 | ||
|
f575e71e05 | ||
|
d7bc270d36 | ||
|
419156c67d | ||
|
4cd81dbe43 | ||
|
c1d0209c81 | ||
|
e7e5fb41ca | ||
|
94ff99be24 | ||
|
f9ff829413 | ||
|
6f7f0cefb5 | ||
|
9870e454a2 | ||
|
c48bf22d0d | ||
|
70c78e4f0d | ||
|
3d5565f0e9 | ||
|
3298a0e23c | ||
|
d24d2bf6ed | ||
|
69dbb49db6 | ||
|
1e892f4ac1 | ||
|
8820344f60 | ||
|
df80149d05 | ||
|
7e157fbd75 | ||
|
c64babf199 | ||
|
83efd3dd74 | ||
|
04e5d1775c | ||
|
b1bab7036b | ||
|
75a978c779 | ||
|
7ce35fdc74 | ||
|
1193236fe7 | ||
|
0e87271350 | ||
|
b90f2dddc3 | ||
|
049e761810 | ||
|
fde133e750 | ||
|
a12ebdf755 | ||
|
49f3b39e4a | ||
|
0842501dfe | ||
|
47875e6465 | ||
|
15953e92eb | ||
|
4b6cbbc31e | ||
|
a42965f53c | ||
|
9207b76aeb | ||
|
580cb7f596 |
11
.github/release-please/config.json
vendored
Normal file
11
.github/release-please/config.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"bootstrap-sha": "c1d0209c81976c2b232b13f5526e81dba0875f05",
|
||||||
|
"release-type": "node",
|
||||||
|
"bump-minor-pre-major": true,
|
||||||
|
"bump-patch-for-minor-pre-major": true,
|
||||||
|
"packages": {
|
||||||
|
".": {
|
||||||
|
"component": "aqua-lib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
.github/release-please/manifest.json
vendored
Normal file
3
.github/release-please/manifest.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
".": "0.12.1"
|
||||||
|
}
|
29
.github/renovate.json
vendored
Normal file
29
.github/renovate.json
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
],
|
||||||
|
"enabledManagers": ["npm", "github-actions"],
|
||||||
|
"schedule": "every weekend",
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchUpdateTypes": ["major"],
|
||||||
|
"prConcurrentLimit": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"prPriority": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchManagers": ["npm"],
|
||||||
|
"matchPackagePatterns": [
|
||||||
|
"@fluencelabs/.*"
|
||||||
|
],
|
||||||
|
"schedule": "at any time"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchDepTypes": ["devDependencies"],
|
||||||
|
"prPriority": -1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
31
.github/workflows/ci.yml
vendored
Normal file
31
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
name: "ci"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-compiles:
|
||||||
|
name: "Check Aqua compiles"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
cache: "npm"
|
||||||
|
|
||||||
|
- run: npm i
|
||||||
|
|
||||||
|
- name: Check compilation
|
||||||
|
run: npm run compile-dry
|
35
.github/workflows/lint.yml
vendored
Normal file
35
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
name: lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pr:
|
||||||
|
name: Validate PR title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
reviewdog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Lint actions
|
||||||
|
uses: reviewdog/action-actionlint@v1
|
||||||
|
env:
|
||||||
|
SHELLCHECK_OPTS: "-e SC2086"
|
||||||
|
with:
|
||||||
|
reporter: github-pr-check
|
||||||
|
fail_on_error: true
|
164
.github/workflows/release.yml
vendored
164
.github/workflows/release.yml
vendored
@ -1,70 +1,124 @@
|
|||||||
name: "publish-release"
|
name: "release-please"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
npm-publish:
|
release-please:
|
||||||
name: "Publish"
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
outputs:
|
||||||
shell: bash
|
releases-created: ${{ steps.release.outputs.releases_created }}
|
||||||
|
|
||||||
|
fluence-cli-release-created: ${{ steps.release.outputs['release_created'] }}
|
||||||
|
fluence-cli-tag-name: ${{ steps.release.outputs['tag_name'] }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Run release-please
|
||||||
uses: actions/checkout@v2
|
id: release
|
||||||
|
uses: google-github-actions/release-please-action@v3
|
||||||
### Calculate FINAL_VERSION
|
|
||||||
- name: Install jq
|
|
||||||
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq
|
|
||||||
|
|
||||||
- name: Get version from npm and increment
|
|
||||||
run: |
|
|
||||||
yarn global add semver
|
|
||||||
PATH="$(yarn global bin):$PATH"
|
|
||||||
|
|
||||||
# take npm version and increment it
|
|
||||||
PKG_NAME="$(cat package.json | jq -r .name)"
|
|
||||||
NPM_VERSION="$(yarn info --silent "$PKG_NAME" version || true)"
|
|
||||||
NEXT_NPM_VERSION="$(semver --increment patch "$NPM_VERSION")"
|
|
||||||
|
|
||||||
# take local version
|
|
||||||
LOCAL_VERSION="$(cat package.json | jq -r .version)"
|
|
||||||
|
|
||||||
# take maximum of the local and NEXT_NPM versions
|
|
||||||
MAX_VERSION="$(semver "$LOCAL_VERSION" "$NEXT_NPM_VERSION" "0.0.0" | tail -n1)"
|
|
||||||
|
|
||||||
# save info to env
|
|
||||||
echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV
|
|
||||||
echo "PKG_NAME=$PKG_NAME" | tee -a $GITHUB_ENV
|
|
||||||
|
|
||||||
### Set version
|
|
||||||
- name: Set version to ${{ env.FINAL_VERSION }}
|
|
||||||
run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version
|
|
||||||
|
|
||||||
### Publish to NPM registry
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: "14"
|
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
|
||||||
|
command: manifest
|
||||||
|
config-file: .github/release-please/config.json
|
||||||
|
manifest-file: .github/release-please/manifest.json
|
||||||
|
|
||||||
|
- name: Show output from release-please
|
||||||
|
if: steps.release.outputs.releases_created
|
||||||
|
env:
|
||||||
|
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
|
||||||
|
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
|
||||||
|
|
||||||
|
aqua-lib:
|
||||||
|
if: needs.release-please.outputs.fluence-cli-release-created
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- release-please
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Import secrets
|
||||||
|
uses: hashicorp/vault-action@v2.4.3
|
||||||
|
with:
|
||||||
|
url: https://vault.fluence.dev
|
||||||
|
path: jwt/github
|
||||||
|
role: ci
|
||||||
|
method: jwt
|
||||||
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||||
|
jwtTtl: 300
|
||||||
|
exportToken: false
|
||||||
|
secrets: |
|
||||||
|
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "16"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
cache: "npm"
|
||||||
|
|
||||||
- run: npm publish --access public
|
- run: npm i
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }}
|
|
||||||
|
|
||||||
### Create a release
|
- name: Publish to npm registry
|
||||||
- name: Create Release
|
run: npm publish --access public --tag unstable
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
slack:
|
||||||
env:
|
if: always()
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
name: "Notify"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- release-please
|
||||||
|
- aqua-lib
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: lwhiteley/dependent-jobs-result-check@v1
|
||||||
|
id: status
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.FINAL_VERSION }}
|
statuses: failure
|
||||||
release_name: Aqua lib ${{ env.FINAL_VERSION }}
|
dependencies: ${{ toJSON(needs) }}
|
||||||
body: |
|
|
||||||
[${{ env.FINAL_VERSION }} @ NPM registry](https://www.npmjs.com/package/${{ env.PKG_NAME }}/v/${{ env.FINAL_VERSION }})
|
- name: Log output
|
||||||
draft: false
|
run: |
|
||||||
prerelease: false
|
echo "statuses:" "${{ steps.status.outputs.statuses }}"
|
||||||
|
echo "jobs:" "${{ steps.status.outputs.jobs }}"
|
||||||
|
echo "found any?:" "${{ steps.status.outputs.found }}"
|
||||||
|
|
||||||
|
- name: Import secrets
|
||||||
|
uses: hashicorp/vault-action@v2.4.3
|
||||||
|
with:
|
||||||
|
url: https://vault.fluence.dev
|
||||||
|
path: jwt/github
|
||||||
|
role: ci
|
||||||
|
method: jwt
|
||||||
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||||
|
jwtTtl: 300
|
||||||
|
exportToken: false
|
||||||
|
secrets: |
|
||||||
|
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
|
||||||
|
|
||||||
|
- uses: ravsamhq/notify-slack-action@v2
|
||||||
|
if: steps.status.outputs.found == 'true'
|
||||||
|
with:
|
||||||
|
status: "failure"
|
||||||
|
notification_title: "*{workflow}* has {status_message}"
|
||||||
|
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
|
||||||
|
footer: "<{run_url}>"
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.tgz
|
*.tgz
|
||||||
|
node_modules/
|
||||||
|
158
CHANGELOG.md
Normal file
158
CHANGELOG.md
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [0.12.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.12.0...aqua-lib-v0.12.1) (2024-09-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix Peer.identify return type ([#92](https://github.com/fluencelabs/aqua-lib/issues/92)) ([cba9b78](https://github.com/fluencelabs/aqua-lib/commit/cba9b785a3eae32bfd02d55d08febdd076540844))
|
||||||
|
|
||||||
|
## [0.12.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.11.0...aqua-lib-v0.12.0) (2024-09-12)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **builtins:** update peer.identify
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builtins:** update peer.identify ([c8efe9c](https://github.com/fluencelabs/aqua-lib/commit/c8efe9c33a0730a5ebaeb17228c2f4db90f7729e))
|
||||||
|
|
||||||
|
## [0.11.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.2...aqua-lib-v0.11.0) (2024-08-08)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* change Worker type in SubnetResolveResult ([#88](https://github.com/fluencelabs/aqua-lib/issues/88))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* change Worker type in SubnetResolveResult ([#88](https://github.com/fluencelabs/aqua-lib/issues/88)) ([f8ef9f3](https://github.com/fluencelabs/aqua-lib/commit/f8ef9f3a5408354026b6b6fccbf3689b492ff929))
|
||||||
|
|
||||||
|
## [0.10.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.1...aqua-lib-v0.10.2) (2024-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add new method for module upload from vault ([b439997](https://github.com/fluencelabs/aqua-lib/commit/b439997ba77168ea7a5e773368e0a03c6167d988))
|
||||||
|
|
||||||
|
## [0.10.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.0...aqua-lib-v0.10.1) (2024-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **worker:** change cu_ids type ([#84](https://github.com/fluencelabs/aqua-lib/issues/84)) ([c92d3e3](https://github.com/fluencelabs/aqua-lib/commit/c92d3e3363a936b0ba4db6bd0b2e2e42337bcfd1))
|
||||||
|
|
||||||
|
## [0.10.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.9.1...aqua-lib-v0.10.0) (2024-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **worker:** add cu_ids to worker create ([#82](https://github.com/fluencelabs/aqua-lib/issues/82))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **worker:** add cu_ids to worker create ([#82](https://github.com/fluencelabs/aqua-lib/issues/82)) ([5414624](https://github.com/fluencelabs/aqua-lib/commit/54146241562fcece7fd6783305d2c5fd32aa6da8))
|
||||||
|
|
||||||
|
## [0.9.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.9.0...aqua-lib-v0.9.1) (2024-01-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **aqua-lib:** Add headers ([60b91de](https://github.com/fluencelabs/aqua-lib/commit/60b91def4a481e56f849f5d04734d117eb29c902))
|
||||||
|
|
||||||
|
## [0.9.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.2...aqua-lib-v0.9.0) (2023-12-21)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **binary:** Remove binary.aqua ([#75](https://github.com/fluencelabs/aqua-lib/issues/75))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builtin:** Add header to builtin.aqua ([#74](https://github.com/fluencelabs/aqua-lib/issues/74)) ([09c2cd9](https://github.com/fluencelabs/aqua-lib/commit/09c2cd9c07ad25af673dc6f69e5ce4599428dfc0))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **binary:** Remove binary.aqua ([#75](https://github.com/fluencelabs/aqua-lib/issues/75)) ([f89ecfb](https://github.com/fluencelabs/aqua-lib/commit/f89ecfbe7910aed418a30400b4d6de4a82efa197))
|
||||||
|
|
||||||
|
## [0.8.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.1...aqua-lib-v0.8.2) (2023-11-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **workers:** add activate/deactivate ([#65](https://github.com/fluencelabs/aqua-lib/issues/65)) ([401621a](https://github.com/fluencelabs/aqua-lib/commit/401621a38930c8166984ecbf03edede451fe9487))
|
||||||
|
|
||||||
|
## [0.8.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.0...aqua-lib-v0.8.1) (2023-11-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **buitin:** update Srv.list result type ([#66](https://github.com/fluencelabs/aqua-lib/issues/66)) ([f3b2144](https://github.com/fluencelabs/aqua-lib/commit/f3b2144e35c972c09b1121cdd9fc51135eb6cd68))
|
||||||
|
|
||||||
|
## [0.8.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.7...aqua-lib-v0.8.0) (2023-11-14)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **workers:**
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **workers:** deprecate API w/o deal_id; add list [NET-565] ([#61](https://github.com/fluencelabs/aqua-lib/issues/61)) ([cce6da5](https://github.com/fluencelabs/aqua-lib/commit/cce6da5f423837a1f0748150f9c703cae4f05fa5))
|
||||||
|
* **workers:** deprecate API w/o deal_id; add list [NET-565] ([#61](https://github.com/fluencelabs/aqua-lib/issues/61)) ([#64](https://github.com/fluencelabs/aqua-lib/issues/64)) ([0363446](https://github.com/fluencelabs/aqua-lib/commit/0363446d790f7fd19d632e1016aee99f92ca9b39))
|
||||||
|
|
||||||
|
## [0.7.7](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.6...aqua-lib-v0.7.7) (2023-09-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **workers:** fix get_worker_id signature ([#58](https://github.com/fluencelabs/aqua-lib/issues/58)) ([7402e0c](https://github.com/fluencelabs/aqua-lib/commit/7402e0c072a0dd95e5321cba292ae58608ded82a))
|
||||||
|
|
||||||
|
## [0.7.6](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.5...aqua-lib-v0.7.6) (2023-09-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **subnet:** change worker_id type ([#56](https://github.com/fluencelabs/aqua-lib/issues/56)) ([a773935](https://github.com/fluencelabs/aqua-lib/commit/a773935d65d484f715a7349521d9802eb8f32f4a))
|
||||||
|
|
||||||
|
## [0.7.5](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.4...aqua-lib-v0.7.5) (2023-09-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add subnet.aqua to "files" ([3c78d86](https://github.com/fluencelabs/aqua-lib/commit/3c78d8693f909da9ec935e59bb2f48a862532dc9))
|
||||||
|
|
||||||
|
## [0.7.4](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.3...aqua-lib-v0.7.4) (2023-09-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builtin:** add resolve_alias_opt [NET-528] ([#50](https://github.com/fluencelabs/aqua-lib/issues/50)) ([c47dd03](https://github.com/fluencelabs/aqua-lib/commit/c47dd03e8cd20c6e5d30634adf3991289e1bde50))
|
||||||
|
* **builtin:** add subnet.resolve ([428365b](https://github.com/fluencelabs/aqua-lib/commit/428365b886f0690090fa0c7241111c62ab792d9c))
|
||||||
|
* **workers:** add Worker.get_worker_id [NET-523] ([#51](https://github.com/fluencelabs/aqua-lib/issues/51)) ([8447625](https://github.com/fluencelabs/aqua-lib/commit/8447625cfaa8bb1973427a0e989ef16143cc204a))
|
||||||
|
|
||||||
|
## [0.7.3](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.2...aqua-lib-v0.7.3) (2023-07-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builtin:** add vault service ([#49](https://github.com/fluencelabs/aqua-lib/issues/49)) ([fbde8e9](https://github.com/fluencelabs/aqua-lib/commit/fbde8e97c2344f9ded12327c0f27bafe56e66999))
|
||||||
|
* update blueprint API [NET-488] ([#45](https://github.com/fluencelabs/aqua-lib/issues/45)) ([8db8118](https://github.com/fluencelabs/aqua-lib/commit/8db811843c6c377c68b9927bc3bae1eca6944ab6))
|
||||||
|
|
||||||
|
## [0.7.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.1...aqua-lib-v0.7.2) (2023-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add workers.aqua to aqua-lib package ([#46](https://github.com/fluencelabs/aqua-lib/issues/46)) ([ca0af31](https://github.com/fluencelabs/aqua-lib/commit/ca0af31ace0122898382001a2403d905c829ae90))
|
||||||
|
|
||||||
|
## [0.7.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.0...aqua-lib-v0.7.1) (2023-05-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add console-run ([#44](https://github.com/fluencelabs/aqua-lib/issues/44)) ([96af0d4](https://github.com/fluencelabs/aqua-lib/commit/96af0d4d4d7c40562142896a5d6500c4e991302f))
|
||||||
|
* **builtin:** add worker builtin definition [NET-397] ([#42](https://github.com/fluencelabs/aqua-lib/issues/42)) ([f575e71](https://github.com/fluencelabs/aqua-lib/commit/f575e71e054cca529190835ed1cb2f605a544b70))
|
||||||
|
* update Service data structure ([#39](https://github.com/fluencelabs/aqua-lib/issues/39)) ([d7bc270](https://github.com/fluencelabs/aqua-lib/commit/d7bc270d361c25ac087f989d9eb2c6c86d7fba6b))
|
13
CONTRIBUTING.md
Normal file
13
CONTRIBUTING.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
## Contribute Code
|
||||||
|
|
||||||
|
You are welcome to contribute to Fluence!
|
||||||
|
|
||||||
|
Things you need to know:
|
||||||
|
|
||||||
|
1. You need to **agree to the [Contributor License Agreement](https://gist.github.com/fluencelabs-org/3f4cbb3cc14c1c0fb9ad99d8f7316ed7) (CLA)**. This is a common practice in all major Open Source projects. At the current moment, we are unable to accept contributions made on behalf of a company. Only individual contributions will be accepted.
|
||||||
|
|
||||||
|
2. **Not all proposed contributions can be accepted**. Some features may, e.g., just fit a third-party add-on better. The contribution must fit the overall direction of Fluence and really improve it. The more effort you invest, the better you should clarify in advance whether the contribution fits: the best way would be to just open an issue to discuss the contribution you plan to make.
|
||||||
|
|
||||||
|
### Contributor License Agreement
|
||||||
|
|
||||||
|
When you contribute, you have to be aware that your contribution is covered by **[Apache License 2.0](./LICENSE)**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**. In particular, you need to agree to the Contributor License Agreement. If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. The CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.
|
202
LICENSE
202
LICENSE
@ -1,7 +1,201 @@
|
|||||||
Copyright 2021 Fluence Labs
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
1. Definitions.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
28
README.md
Normal file
28
README.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Aqua-lib
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/@fluencelabs/aqua-lib)
|
||||||
|
|
||||||
|
[Aqua](https://github.com/fluencelabs/aqua) is a new-generation language for distributed systems, the core of [Fluence](https://fluence.network). 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** is the API of the protocol-level functions in the [Fluence](https://github.com/fluencelabs/fluence-cli) network. This API is available on all peers powered by Fluence nodes and a part of the API is available on JS/TS-based peers.
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Comprehensive documentation on Fluence is available [here](https://fluence.network/). Detailed instructions and usage examples on Aqua can be found in our dedicated [Aqua Book](https://fluence.dev/docs/aqua-book/introduction).
|
||||||
|
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Please, file an [issue](https://github.com/fluencelabs/aqua-lib/issues) if you find a bug. You can also contact us at [Discord](https://discord.com/invite/5qSnPZKh7u) or [Telegram](https://t.me/fluence_project). We will do our best to resolve the issue ASAP.
|
||||||
|
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Any interested person is welcome to contribute to the project. Please, make sure you read and follow some basic [rules](./CONTRIBUTING.md).
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
All software code is copyright (c) Fluence Labs, Inc. under the [Apache-2.0](./LICENSE) license.
|
||||||
|
|
323
builtin.aqua
323
builtin.aqua
@ -1,14 +1,25 @@
|
|||||||
-- Default public interface of Fluence nodes
|
-- Default public interface of Fluence nodes
|
||||||
|
aqua Builtin declares *
|
||||||
|
|
||||||
alias Field : []string
|
alias Field : []string
|
||||||
alias Argument : []string
|
alias Argument : []string
|
||||||
alias Bytes : []u8
|
alias Bytes : []u8
|
||||||
alias PeerId : string
|
alias PeerId : string
|
||||||
|
alias Pairs : [][]string
|
||||||
|
alias Base58String : string
|
||||||
|
alias Hash : string
|
||||||
|
alias IPLDBlueprint : string
|
||||||
|
alias CID : string
|
||||||
|
alias Path : string
|
||||||
|
|
||||||
data Service:
|
data Service:
|
||||||
id: string
|
id: string
|
||||||
blueprint_id: string
|
blueprint_id: string
|
||||||
|
-- `spell` or `service`
|
||||||
|
service_type: string
|
||||||
owner_id: string
|
owner_id: string
|
||||||
|
aliases: []string
|
||||||
|
worker_id: string
|
||||||
|
|
||||||
data FunctionSignature:
|
data FunctionSignature:
|
||||||
arguments: []Argument
|
arguments: []Argument
|
||||||
@ -24,66 +35,130 @@ data Interface:
|
|||||||
function_signatures: []FunctionSignature
|
function_signatures: []FunctionSignature
|
||||||
record_types: []RecordType
|
record_types: []RecordType
|
||||||
|
|
||||||
data ServiceInfo:
|
data VmInfo:
|
||||||
blueprint_id: string
|
ip: string
|
||||||
service_id: string
|
default_ssh_port: u16
|
||||||
interface: Interface
|
forwarded_ports: []string
|
||||||
|
|
||||||
data Info:
|
data Info:
|
||||||
external_addresses: []string
|
external_addresses: []string
|
||||||
|
node_version: string
|
||||||
|
air_version: string
|
||||||
|
spell_version: string
|
||||||
|
allowed_binaries: []string
|
||||||
|
vm_info: ?VmInfo
|
||||||
|
|
||||||
|
data ModuleWASIConfig:
|
||||||
|
envs: ?Pairs
|
||||||
|
mapped_dirs: ?Pairs
|
||||||
|
mounted_binaries: ?Pairs
|
||||||
|
|
||||||
data ModuleConfig:
|
data ModuleConfig:
|
||||||
name: string
|
name: string
|
||||||
|
mem_pages_count: ?u32
|
||||||
|
max_heap_size: ?string
|
||||||
|
logger_enabled: ?bool
|
||||||
|
logging_mask: ?i32
|
||||||
|
wasi: ?ModuleWASIConfig
|
||||||
|
|
||||||
data Module:
|
data Module:
|
||||||
name: string
|
name: string
|
||||||
hash: string
|
hash: string
|
||||||
config: ModuleConfig
|
config: ModuleConfig
|
||||||
|
|
||||||
data AddBlueprint:
|
|
||||||
name: string
|
|
||||||
dependencies: []string
|
|
||||||
|
|
||||||
data Blueprint:
|
data Blueprint:
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
dependencies: []string
|
dependencies: []CID
|
||||||
|
|
||||||
data ScriptInfo:
|
|
||||||
id: string
|
|
||||||
src: string
|
|
||||||
failures: u32
|
|
||||||
interval: string
|
|
||||||
owner: string
|
|
||||||
|
|
||||||
data Contact:
|
data Contact:
|
||||||
peer_id: string
|
peer_id: string
|
||||||
addresses: []string
|
addresses: []string
|
||||||
|
|
||||||
|
-- A collection of measurements of a stat.
|
||||||
|
-- `avg` and `total` fields are computed over all measured stats and
|
||||||
|
-- `series` stores only several last measurements. The number of measurements
|
||||||
|
-- is configured on each peer.
|
||||||
|
data SeriesStat:
|
||||||
|
avg: f64
|
||||||
|
series: []f64
|
||||||
|
total: f64
|
||||||
|
|
||||||
|
data Stats:
|
||||||
|
-- Number of successful request
|
||||||
|
success_req_count: u64
|
||||||
|
-- Number of failed request
|
||||||
|
failed_req_count: u64
|
||||||
|
-- Duration of call execution in seconds
|
||||||
|
call_time_sec: SeriesStat
|
||||||
|
-- Amount of addintionally allocated memory after a call
|
||||||
|
memory_deltas_bytes: SeriesStat
|
||||||
|
-- Timestamps of the last measurments
|
||||||
|
timestamps: []u64
|
||||||
|
|
||||||
|
data FunctionStat:
|
||||||
|
name: string
|
||||||
|
-- Series contain last measurements that were taken from last N calls to this function
|
||||||
|
stats: Stats
|
||||||
|
|
||||||
|
data ServiceStat:
|
||||||
|
-- Stats for the requested service in total.
|
||||||
|
-- Series contain last measurements that were taken from last N calls to the service
|
||||||
|
total_stats: Stats
|
||||||
|
-- Stats for each interface function of the service
|
||||||
|
functions_stats: []FunctionStat
|
||||||
|
|
||||||
|
data StatResult:
|
||||||
|
status: bool
|
||||||
|
error: string
|
||||||
|
result: ?ServiceStat
|
||||||
|
|
||||||
|
data MemoryStat:
|
||||||
|
-- module name
|
||||||
|
name: string
|
||||||
|
memory_size_bytes: u64
|
||||||
|
max_memory_size_bytes: u64
|
||||||
|
|
||||||
service Op("op"):
|
service Op("op"):
|
||||||
identity()
|
-- does nothing
|
||||||
string_to_b58(s: string) -> string
|
noop()
|
||||||
string_from_b58(b: string) -> string
|
|
||||||
bytes_to_b58(bs: []u8) -> string
|
-- returns length of the passed array
|
||||||
bytes_from_b58(b: string) -> []u8
|
array_length(array: []string) -> u32
|
||||||
|
|
||||||
|
-- takes any number of arguments and wraps them into a single array
|
||||||
|
-- see the doc on varargs https://doc.fluence.dev/aqua-book/libraries/aqua-lib#functions-with-a-variable-number-of-arguments
|
||||||
|
array(a: string, b: string, c: string, d: string) -> []string
|
||||||
|
|
||||||
|
-- takes any number of arrays and flattens them by concatenating
|
||||||
|
-- see the doc on varargs https://doc.fluence.dev/aqua-book/libraries/aqua-lib#functions-with-a-variable-number-of-arguments
|
||||||
|
concat(a: []string, b: []string, c: []string, d: []string) -> []string
|
||||||
|
|
||||||
|
-- takes a single argument and returns it back
|
||||||
|
identity(s: ?string) -> ?string
|
||||||
|
|
||||||
|
-- encodes string's utf8 bytes as base58
|
||||||
|
string_to_b58(s: string) -> Base58String
|
||||||
|
|
||||||
|
-- decodes base58 to bytes to utf8 string
|
||||||
|
-- throws error on invalid UTF8
|
||||||
|
string_from_b58(b: Base58String) -> string
|
||||||
|
|
||||||
|
-- encodes bytes as base58
|
||||||
|
bytes_to_b58(bs: []u8) -> Base58String
|
||||||
|
|
||||||
|
-- decodes base58 to bytes
|
||||||
|
bytes_from_b58(b: Base58String) -> []u8
|
||||||
|
|
||||||
|
-- Applies SHA256 to the given string
|
||||||
|
-- Argument: s - string to apply sha256 to (hash is applied to utf8 bytes of s)
|
||||||
|
-- Returns: returns sha256 multihash encoded as base58
|
||||||
|
sha256_string(s: string) -> Base58String
|
||||||
|
|
||||||
|
-- concatenate strings (in AIR it takes any number of arguments)
|
||||||
|
concat_strings(a: string, b: string) -> string
|
||||||
|
|
||||||
service Peer("peer"):
|
service Peer("peer"):
|
||||||
-- Checks if there is a direct connection to the peer identified by a given PeerId
|
|
||||||
-- Argument: PeerId – id of the peer to check if there's a connection with
|
|
||||||
-- Returns: bool - true if connected to the peer, false otherwise
|
|
||||||
is_connected(peer: PeerId) -> bool
|
|
||||||
|
|
||||||
-- Initiates a connection to the specified peer
|
|
||||||
-- Arguments:
|
|
||||||
-- PeerId – id of the target peer
|
|
||||||
-- [Multiaddr] – an array of target peer's addresses
|
|
||||||
-- Returns: bool - true if connection was successful
|
|
||||||
connect(id: PeerId, multiaddrs: []string) -> bool
|
|
||||||
-- Resolves the contact of a peer via Kademlia
|
|
||||||
-- Argument: PeerId – id of the target peer
|
|
||||||
-- Returns: Contact - true if connection was successful
|
|
||||||
get_contact(peer: PeerId) -> Contact
|
|
||||||
|
|
||||||
-- Get information about the peer
|
-- Get information about the peer
|
||||||
identify() -> Info
|
identify() -> Info
|
||||||
|
|
||||||
@ -93,10 +168,55 @@ service Peer("peer"):
|
|||||||
-- Get Unix timestamp in seconds
|
-- Get Unix timestamp in seconds
|
||||||
timestamp_sec() -> u64
|
timestamp_sec() -> u64
|
||||||
|
|
||||||
|
-- Blocks for the given number of milliseconds. Meant to be used within `par` blocks.
|
||||||
|
-- message is returned after duration has passed
|
||||||
|
timeout(duration_ms: u64, message: string) -> string
|
||||||
|
|
||||||
|
---- Low level functions for accessing connection pool
|
||||||
|
|
||||||
|
-- Checks if there is a direct connection to the peer identified by a given PeerId
|
||||||
|
-- Argument: PeerId – id of the peer to check if there's a connection with
|
||||||
|
-- Returns: bool - true if connected to the peer, false otherwise
|
||||||
|
-- NOTE:
|
||||||
|
-- This is a very low-level function, it most likely won't fit your goals.
|
||||||
|
-- It's almost always better to use race pattern to check connectivity.
|
||||||
|
-- See https://doc.fluence.dev/aqua-book/language/flow/parallel#timeout-and-race-patterns
|
||||||
|
is_connected(peer: PeerId) -> bool
|
||||||
|
|
||||||
|
-- Initiates a connection to the specified peer
|
||||||
|
-- Arguments:
|
||||||
|
-- id - id of the target peer
|
||||||
|
-- multiaddrs – an array of target peer's addresses
|
||||||
|
-- Returns: bool - true if connection was successful
|
||||||
|
-- NOTE:
|
||||||
|
-- This is a low-level function, it most likely won't fit your goals.
|
||||||
|
-- Most often you just need to use `on id:` and connection will be established automatically.
|
||||||
|
connect(id: PeerId, multiaddrs: []string) -> bool
|
||||||
|
|
||||||
|
-- Returns known multiaddresses of a peer
|
||||||
|
-- Argument: PeerId – id of the target peer
|
||||||
|
-- Returns:
|
||||||
|
-- Contact - if target peer is connected to current peer,
|
||||||
|
-- return data structure with multiaddresses inside, and nil otherwise.
|
||||||
|
get_contact(peer: PeerId) -> ?Contact
|
||||||
|
|
||||||
service Kademlia("kad"):
|
service Kademlia("kad"):
|
||||||
-- Instructs node to return the locally-known nodes
|
-- Instructs node to return the locally-known nodes
|
||||||
-- in the Kademlia neighborhood for a given key
|
-- in the Kademlia neighborhood for a given key
|
||||||
neighborhood(key: PeerId, already_hashed: bool) -> []PeerId
|
-- Arguments:
|
||||||
|
-- key – base58 string
|
||||||
|
-- already_hashed – default false; if set to true, key is considered to be a SHA256 multihash
|
||||||
|
-- count – default 20; limits number of returned nodes
|
||||||
|
neighborhood(key: Base58String, already_hashed: ?bool, count: ?u32) -> []PeerId
|
||||||
|
|
||||||
|
-- Merges given lists and sorts them by distance to target
|
||||||
|
-- Arguments:
|
||||||
|
-- target – base58 string; result is sorted by XOR distance to target
|
||||||
|
-- left – list of base58 strings
|
||||||
|
-- right – list of base58 strings
|
||||||
|
-- count – how many items to return; default 20
|
||||||
|
-- Returns: list of base58 strings sorted by distance to target; list will contain at most count elements
|
||||||
|
merge(target: Base58String, left: []string, right: []string, count: ?u32) -> []string
|
||||||
|
|
||||||
service Srv("srv"):
|
service Srv("srv"):
|
||||||
-- Used to create a service on a certain node
|
-- Used to create a service on a certain node
|
||||||
@ -115,44 +235,145 @@ service Srv("srv"):
|
|||||||
|
|
||||||
-- Adds an alias on service, so, service could be called
|
-- Adds an alias on service, so, service could be called
|
||||||
-- not only by service_id but by alias as well.
|
-- not only by service_id but by alias as well.
|
||||||
-- Argument:
|
-- Arguments:
|
||||||
-- alias - settable service name
|
-- alias - settable service name
|
||||||
-- service_id – ID of the service whose interface you want to name.
|
-- service_id – ID of the service whose interface you want to name.
|
||||||
add_alias(alias: string, service_id: string)
|
add_alias(alias: string, service_id: string)
|
||||||
|
|
||||||
|
-- Resolves given alias to a service id
|
||||||
|
-- If there's no such alias, throws an error
|
||||||
|
-- Returns: service id associated with the given alias
|
||||||
|
resolve_alias(alias: string) -> string
|
||||||
|
|
||||||
|
-- Resolves given alias to a service id
|
||||||
|
-- If there's no such alias, returns nil
|
||||||
|
-- Returns: service id associated with the given alias or nil
|
||||||
|
resolve_alias_opt(alias: string) -> ?string
|
||||||
|
|
||||||
-- Retrieves the functional interface of a service running
|
-- Retrieves the functional interface of a service running
|
||||||
-- on the node specified in the service call
|
-- on the node specified in the service call
|
||||||
-- Argument: service_id – ID of the service whose interface you want to retrieve.
|
-- Argument: service_id – ID of the service whose interface you want to retrieve.
|
||||||
get_interface(service_id: string) -> ServiceInfo
|
get_interface(service_id: string) -> Interface
|
||||||
|
|
||||||
|
-- Retrieves information about service
|
||||||
|
-- Argument: service_id – ID or alias of the service
|
||||||
|
info(service_id: string) -> Service
|
||||||
|
|
||||||
service Dist("dist"):
|
service Dist("dist"):
|
||||||
|
-- Constructs a ModuleConfig structure
|
||||||
|
-- Arguments:
|
||||||
|
-- module_name - import name of the module
|
||||||
|
-- mem_pages_count - Maximum memory size accessible by a module in Wasm pages (64 Kb)
|
||||||
|
-- logger_enabled - Defines whether Marine should provide a special host log_utf8_string function for this module
|
||||||
|
-- preopened_files - Files available for this module. Module can access only files from this list
|
||||||
|
-- envs - environment variables available for this module
|
||||||
|
-- mapped_dirs - Directory mapping, e.g. [["/sites", "./web/data"]] so all
|
||||||
|
-- reads & writes to /sites will actually to go ./web/data
|
||||||
|
-- mounted_binaries - Mapping of host binaries available to call from module,
|
||||||
|
-- e.g. [["curl", "/usr/bin/curl"]] will allow module to
|
||||||
|
-- call /usr/bin/curl binary as function 'curl'
|
||||||
|
-- logging_mask - Binary mask to enable & disable logging targets. Targets are
|
||||||
|
-- configured in WasmLoggerBuilder::with_target_map
|
||||||
|
-- mem_pages_count - (deprecated) Maximum memory size accessible by a module in Wasm pages (64 Kb)
|
||||||
|
-- max_heap_size - Maximum module heap size, in bytes
|
||||||
|
make_module_config(name: string, mem_pages_count: ?u32, max_heap_size: ?string, logger_enabled: ?bool, preopened_files: ?[]string, envs: ?Pairs, mapped_dirs: ?Pairs, mounted_binaries: ?Pairs, logging_mask: ?i32) -> ModuleConfig
|
||||||
|
|
||||||
|
-- Constructs a ModuleConfig structure
|
||||||
|
-- Arguments:
|
||||||
|
-- module_name - import name of the module
|
||||||
|
default_module_config(module_name: string) -> ModuleConfig
|
||||||
|
|
||||||
-- Used to add modules to the node specified in the service call
|
-- Used to add modules to the node specified in the service call
|
||||||
-- Arguments:
|
-- Arguments:
|
||||||
-- bytes – a base64 string containing the .wasm module to add.
|
-- bytes – a base64 string containing the .wasm module to add.
|
||||||
-- config – module info
|
-- config – module info
|
||||||
-- Returns: blake3 hash of the module
|
-- Returns: blake3 hash of the module
|
||||||
|
-- NOTE: the config is IGNORED and only module's `name` is taken from it
|
||||||
add_module(wasm_b56_content: Bytes, conf: ModuleConfig) -> string
|
add_module(wasm_b56_content: Bytes, conf: ModuleConfig) -> string
|
||||||
|
|
||||||
|
-- Adds module by copying it from Particle Vault directory
|
||||||
|
-- Arguments:
|
||||||
|
-- path – path or a filename
|
||||||
|
-- config - module config
|
||||||
|
-- NOTE: the config is IGNORED and only module's `name` is taken from it
|
||||||
|
add_module_from_vault(path: Path, config: ModuleConfig) -> Hash
|
||||||
|
|
||||||
|
-- Adds module by copying it from Particle Vault directory
|
||||||
|
-- Arguments:
|
||||||
|
-- path – path or a filename
|
||||||
|
-- config - module config
|
||||||
|
add_module_bytes_from_vault(name: string, module_cid: string) -> string
|
||||||
|
|
||||||
-- Get a list of modules available on the node
|
-- Get a list of modules available on the node
|
||||||
list_modules() -> []Module
|
list_modules() -> []Module
|
||||||
|
|
||||||
-- Get the interface of a module
|
-- Get the interface of a module
|
||||||
get_interface(module_id: string) -> Interface
|
get_module_interface(module_hash: string) -> Interface
|
||||||
|
|
||||||
-- Used to add a blueprint to the node specified in the service call
|
-- Creates IPLD Blueprint structure from blueprint name and dependencies (modules)
|
||||||
add_blueprint(blueprint: AddBlueprint) -> string
|
make_blueprint(name: string, dependencies: []CID) -> IPLDBlueprint
|
||||||
|
-- Add an IPLD blueprint to the node
|
||||||
|
add_blueprint(blueprint: IPLDBlueprint) -> string
|
||||||
|
|
||||||
|
-- Loads blueprint by copying it from Particle Vault directory
|
||||||
|
-- Arguments:
|
||||||
|
-- blueprint_path – path in Particle Vault
|
||||||
|
load_blueprint(blueprint_path: Path) -> IPLDBlueprint
|
||||||
|
|
||||||
-- Used to get the blueprints available on the node specified in the service call.
|
-- Used to get the blueprints available on the node specified in the service call.
|
||||||
-- A blueprint is an object of the following structure
|
-- A blueprint is an object of the following structure
|
||||||
list_blueprints() -> []Blueprint
|
list_blueprints() -> []Blueprint
|
||||||
|
|
||||||
service Script("script"):
|
-- Get a single blueprint
|
||||||
-- Adds the given script to a node
|
get_blueprint(blueprint_id: string) -> Blueprint
|
||||||
add(air_content: string, run_every: string) -> string
|
|
||||||
|
|
||||||
-- Removes recurring script from a node. Only a creator of the script can delete it
|
data SignResult:
|
||||||
remove(script_id: string) -> bool
|
-- Was call successful or not
|
||||||
|
success: bool
|
||||||
|
-- Error message. Will be null if the call is successful
|
||||||
|
error: ?string
|
||||||
|
-- Signature as byte array. Will be null if the call is not successful
|
||||||
|
signature: ?[]u8
|
||||||
|
|
||||||
-- Returns a list of existing scripts on the node.
|
service Sig("sig"):
|
||||||
-- Each object in the list is of the following structure
|
-- Signs data with the service's private key.
|
||||||
list() -> ScriptInfo
|
-- Depending on implementation the service might check call params to restrict usage for security reasons.
|
||||||
|
-- By default it is only allowed to be used on the same peer the particle was initiated
|
||||||
|
-- and accepts data only from the following sources:
|
||||||
|
-- trust-graph.get_trust_bytes
|
||||||
|
-- trust-graph.get_revocation_bytes
|
||||||
|
-- registry.get_key_bytes (for FluenceJS only)
|
||||||
|
-- registry.get_record_bytes
|
||||||
|
-- registry.get_record_metadata_bytes
|
||||||
|
-- Argument: data - byte array to sign
|
||||||
|
-- Returns: signature as SignResult structure
|
||||||
|
sign(data: []u8) -> SignResult
|
||||||
|
|
||||||
|
-- Given the data and signature both as byte arrays, returns true if the signature is correct, false otherwise.
|
||||||
|
verify(signature: []u8, data: []u8) -> bool
|
||||||
|
|
||||||
|
-- Gets the peer id of the service's key pair.
|
||||||
|
get_peer_id() -> string
|
||||||
|
|
||||||
|
-- Available only on rust peers
|
||||||
|
-- Aquire service statistic
|
||||||
|
service Stat("stat"):
|
||||||
|
-- Detailed stats for the service and its interface functions
|
||||||
|
service_stat(service_id: string) -> StatResult
|
||||||
|
-- The amount of memeory allocated for each module of the service.
|
||||||
|
service_memory(service_id: string) -> []MemoryStat
|
||||||
|
|
||||||
|
-- Service for debugging purposes only
|
||||||
|
service Debug("debug"):
|
||||||
|
-- Convert any object into a string
|
||||||
|
stringify(o: ⊤) -> string
|
||||||
|
|
||||||
|
service Console("run-console"):
|
||||||
|
print(any: ⊤)
|
||||||
|
|
||||||
|
-- Particle File Vault
|
||||||
|
service Vault("vault"):
|
||||||
|
-- Puts data into the vault and returns virtual path
|
||||||
|
put(data: string) -> Path
|
||||||
|
-- Returns the content of the file from the vault
|
||||||
|
cat(path: Path) -> string
|
||||||
|
48
math.aqua
Normal file
48
math.aqua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
aqua MathLib declares *
|
||||||
|
|
||||||
|
service Math("math"):
|
||||||
|
-- x + y
|
||||||
|
add(x: i64, y: i64) -> i64
|
||||||
|
-- x - y
|
||||||
|
sub(x: i64, y: i64) -> i64
|
||||||
|
-- x * y
|
||||||
|
mul(x: i64, y: i64) -> i64
|
||||||
|
-- floor(x * y)
|
||||||
|
fmul(x: f64, y: f64) -> i64
|
||||||
|
-- x / y
|
||||||
|
div(x: i64, y: i64) -> i64
|
||||||
|
-- division remainder, x % y
|
||||||
|
rem(x: i64, y: i64) -> i64
|
||||||
|
-- x^y
|
||||||
|
pow(x: i64, y: u32) -> i64
|
||||||
|
-- logarithm of y to base x
|
||||||
|
-- x – logarithm base
|
||||||
|
log(x: i64, y: i64) -> u32
|
||||||
|
|
||||||
|
service Compare("cmp"):
|
||||||
|
-- x > y
|
||||||
|
gt(x: i64, y: i64) -> bool
|
||||||
|
-- x >= y
|
||||||
|
gte(x: i64, y: i64) -> bool
|
||||||
|
-- x < y
|
||||||
|
lt(x: i64, y: i64) -> bool
|
||||||
|
-- x <= y
|
||||||
|
lte(x: i64, y: i64) -> bool
|
||||||
|
-- compare x and y
|
||||||
|
-- x < y, return -1
|
||||||
|
-- x = y, return 0
|
||||||
|
-- x > y, return 1
|
||||||
|
cmp(x: i64, y: i64) -> i8
|
||||||
|
|
||||||
|
|
||||||
|
service Array("array"):
|
||||||
|
-- sum of all numbers in array
|
||||||
|
sum(xs: []i64) -> i64
|
||||||
|
-- remove duplicates, not stable
|
||||||
|
dedup(xs: []string) -> []string
|
||||||
|
-- set-intersection of two arrays, not stable, deduplicates
|
||||||
|
intersect(xs: []string, ys: []string) -> []string
|
||||||
|
-- set-difference of two arrays, not stable, deduplicates
|
||||||
|
diff(xs: []string, ys: []string) -> []string
|
||||||
|
-- symmetric difference of two arrays, not stable, deduplicates
|
||||||
|
sdiff(xs: []string, ys: []string) -> []string
|
14473
package-lock.json
generated
14473
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@ -1,11 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@fluencelabs/aqua-lib",
|
"name": "@fluencelabs/aqua-lib",
|
||||||
"version": "0.1.0",
|
"version": "0.12.1",
|
||||||
"description": "Aqua standard library",
|
"description": "Aqua standard library",
|
||||||
"files": [
|
"files": [
|
||||||
"builtin.aqua"
|
"builtin.aqua",
|
||||||
|
"math.aqua",
|
||||||
|
"binary.aqua",
|
||||||
|
"workers.aqua",
|
||||||
|
"subnet.aqua"
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {
|
||||||
|
"compile-dry": "aqua -i . --dry"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/fluencelabs/aqua-lib.git"
|
"url": "git+https://github.com/fluencelabs/aqua-lib.git"
|
||||||
@ -19,5 +25,8 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/fluencelabs/aqua-lib/issues"
|
"url": "https://github.com/fluencelabs/aqua-lib/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/fluencelabs/aqua-lib#readme"
|
"homepage": "https://github.com/fluencelabs/aqua-lib#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@fluencelabs/aqua": "0.9.4"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
21
readme.md
21
readme.md
@ -1,21 +0,0 @@
|
|||||||
## 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
|
|
||||||
|
|
||||||
TBD
|
|
||||||
|
|
||||||
### usage
|
|
||||||
|
|
||||||
TBD
|
|
||||||
|
|
||||||
### references
|
|
||||||
|
|
||||||
- To get started writing aqua see: https://github.com/fluencelabs/aqua-playground
|
|
17
subnet.aqua
Normal file
17
subnet.aqua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
aqua SubnetLib declares *
|
||||||
|
|
||||||
|
data Worker:
|
||||||
|
cu_ids: []string
|
||||||
|
host_id: string
|
||||||
|
worker_id: ?string
|
||||||
|
|
||||||
|
data SubnetResolveResult:
|
||||||
|
-- Was call successful or not
|
||||||
|
success: bool
|
||||||
|
-- Error message. Will be null if the call is successful
|
||||||
|
error: ?string
|
||||||
|
workers: []Worker
|
||||||
|
|
||||||
|
service Subnet("subnet"):
|
||||||
|
-- Returns a list of workers by deal id
|
||||||
|
resolve(deal_id: string) -> SubnetResolveResult
|
41
workers.aqua
Normal file
41
workers.aqua
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
aqua WorkersLib declares *
|
||||||
|
|
||||||
|
import PeerId from "./builtin.aqua"
|
||||||
|
|
||||||
|
alias CUID : []u8
|
||||||
|
|
||||||
|
-- Available only on rust peers
|
||||||
|
service Worker("worker"):
|
||||||
|
-- Creates new worker associated with `deal_id` and allows specifying custom `cu_ids`.
|
||||||
|
-- Arguments:
|
||||||
|
-- deal_id - ID of the deal
|
||||||
|
-- cu_ids – an array of target compute unit IDs
|
||||||
|
-- Returns: PeerId - worker ID if creation was successful
|
||||||
|
-- Throws an error if a worker exists.
|
||||||
|
create(deal_id: string, cu_ids: []CUID) -> PeerId
|
||||||
|
|
||||||
|
-- Returns worker peer id associated with `deal_id`.
|
||||||
|
-- Returns nil if worker doesn't exist.
|
||||||
|
get_worker_id(deal_id: string) -> ?PeerId
|
||||||
|
|
||||||
|
-- Removes worker with all deployed spells and services.
|
||||||
|
-- Throws an error if worker doesn't exist.
|
||||||
|
-- Worker can be removed only by worker creator or worker itself.
|
||||||
|
remove(worker_id: PeerId)
|
||||||
|
|
||||||
|
-- Returns list of all workers.
|
||||||
|
list() -> []PeerId
|
||||||
|
|
||||||
|
-- Restarts worker installation spell.
|
||||||
|
-- Can be called only by system spells or peer manager,
|
||||||
|
-- Throws an error if worker doesn't exist.
|
||||||
|
activate(deal_id: string)
|
||||||
|
|
||||||
|
-- Stops all worker spells and drops all incoming particles until activation.
|
||||||
|
-- Can be called only by system spells or peer manager,
|
||||||
|
-- Throws an error if worker doesn't exist.
|
||||||
|
deactivate(deal_id: string)
|
||||||
|
|
||||||
|
-- Returns true if worker is active.
|
||||||
|
-- Throws an error if worker doesn't exist.
|
||||||
|
is_active(deal_id: string) -> bool
|
Loading…
x
Reference in New Issue
Block a user