mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-03 06:11:01 +03:00
app_store wit: split up
This commit is contained in:
parent
66b8d8b37a
commit
5be42420ca
@ -1,25 +1,47 @@
|
||||
interface download {
|
||||
interface downloads {
|
||||
//
|
||||
// download API as presented by download:app_store:sys-v0
|
||||
//
|
||||
|
||||
use standard.{package-id};
|
||||
|
||||
record download-request {
|
||||
package-id: package-id,
|
||||
download-from: string,
|
||||
desired-version-hash: option<string>,
|
||||
variant downloads {
|
||||
download(download-request),
|
||||
chunk(chunk-request),
|
||||
progress(progress-update),
|
||||
size(size-update),
|
||||
}
|
||||
|
||||
// I wonder if these should be long-running instead.
|
||||
// updates from FT worker or lack of them might come back as updates first, which is fine.
|
||||
// the approve/deny is useful but not guaranteed, could be an intra process thing, separate request.
|
||||
variant download-response {
|
||||
started,
|
||||
bad-response,
|
||||
denied(reason),
|
||||
already-exists,
|
||||
already-downloading,
|
||||
record download-request {
|
||||
package-id: package-id,
|
||||
download-from: option<string>, // note, might be too much implicit complexity,
|
||||
// but: download-from received locally, is an instruction where to download-from
|
||||
// and if received from remote, is an instruction where to send, where the "download-from" came from.
|
||||
desired-version-hash: string,
|
||||
}
|
||||
|
||||
record download-response {
|
||||
success: bool,
|
||||
error: option<string>,
|
||||
}
|
||||
|
||||
record chunk-request {
|
||||
package-id: package-id,
|
||||
version-hash: string,
|
||||
offset: u64,
|
||||
length: u64,
|
||||
}
|
||||
|
||||
record progress-update {
|
||||
package-id: package-id,
|
||||
version-hash: string,
|
||||
downloaded: u64,
|
||||
total: u64,
|
||||
}
|
||||
|
||||
record size-update {
|
||||
package-id: package-id,
|
||||
size: u64,
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,40 +91,124 @@ interface chain {
|
||||
|
||||
interface main {
|
||||
//
|
||||
// app store API as presented by :app_store:sys-v0
|
||||
// app store API as presented by main:app_store:sys-v0
|
||||
//
|
||||
|
||||
use standard.{package-id};
|
||||
|
||||
record onchain-metadata {
|
||||
name: option<string>,
|
||||
description: option<string>,
|
||||
image: option<string>,
|
||||
external-url: option<string>,
|
||||
animation-url: option<string>,
|
||||
properties: onchain-properties,
|
||||
}
|
||||
|
||||
record onchain-properties {
|
||||
package-name: string,
|
||||
publisher: string,
|
||||
current-version: string,
|
||||
mirrors: list<string>,
|
||||
code-hashes: list<tuple<string, string>>,
|
||||
license: option<string>,
|
||||
screenshots: option<list<string>>,
|
||||
wit-version: option<u32>,
|
||||
dependencies: option<list<string>>,
|
||||
}
|
||||
|
||||
variant request {
|
||||
remote(remote-request),
|
||||
local(local-request),
|
||||
}
|
||||
|
||||
variant response {
|
||||
remote(remote-response),
|
||||
local(local-response),
|
||||
}
|
||||
|
||||
variant remote-request {
|
||||
download(remote-download-request),
|
||||
}
|
||||
|
||||
record remote-download-request {
|
||||
package-id: package-id,
|
||||
desired-version-hash: option<string>,
|
||||
}
|
||||
|
||||
variant remote-response {
|
||||
download-approved,
|
||||
download-denied(reason),
|
||||
}
|
||||
|
||||
variant reason {
|
||||
no-package,
|
||||
not-mirroring,
|
||||
hash-mismatch(hash-mismatch),
|
||||
file-not-found,
|
||||
worker-spawn-failed
|
||||
}
|
||||
|
||||
record hash-mismatch {
|
||||
requested: string,
|
||||
have: string,
|
||||
}
|
||||
|
||||
variant local-request {
|
||||
install(package-id), // bytes in blob?
|
||||
new-package(new-package-request),
|
||||
download(download-request),
|
||||
install(package-id),
|
||||
uninstall(package-id),
|
||||
start-mirroring(package-id),
|
||||
stop-mirroring(package-id),
|
||||
start-auto-update(package-id),
|
||||
stop-auto-update(package-id),
|
||||
rebuild-index,
|
||||
apis,
|
||||
get-api(package-id),
|
||||
}
|
||||
|
||||
use standard.{package-id};
|
||||
record new-package-request {
|
||||
package-id: package-id,
|
||||
metadata: onchain-metadata,
|
||||
mirror: bool,
|
||||
}
|
||||
|
||||
// find a place for these, error type for each world.
|
||||
// variant reason {
|
||||
// no-package,
|
||||
// not-mirroring,
|
||||
// hash-mismatch(hash-mismatch),
|
||||
// file-not-found,
|
||||
// worker-spawn-failed
|
||||
// }
|
||||
// record hash-mismatch {
|
||||
// requested: string,
|
||||
// have: string,
|
||||
// }
|
||||
record download-request {
|
||||
package-id: package-id,
|
||||
download-from: string,
|
||||
mirror: bool,
|
||||
auto-update: bool,
|
||||
desired-version-hash: option<string>,
|
||||
}
|
||||
|
||||
variant local-response {
|
||||
new-package-response(new-package-response),
|
||||
download-response(download-response),
|
||||
install-response(install-response),
|
||||
uninstall-response(uninstall-response),
|
||||
mirror-response(mirror-response),
|
||||
auto-update-response(auto-update-response),
|
||||
rebuild-index-response(rebuild-index-response),
|
||||
apis-response(apis-response),
|
||||
get-api-response(get-api-response),
|
||||
}
|
||||
|
||||
enum new-package-response {
|
||||
success,
|
||||
no-blob,
|
||||
install-failed,
|
||||
already-exists,
|
||||
}
|
||||
|
||||
variant download-response {
|
||||
started,
|
||||
bad-response,
|
||||
denied(reason),
|
||||
already-exists,
|
||||
already-downloading,
|
||||
}
|
||||
|
||||
enum install-response {
|
||||
success,
|
||||
failure, // TODO
|
||||
@ -113,7 +219,21 @@ interface main {
|
||||
failure, // TODO
|
||||
}
|
||||
|
||||
// TODO: not sure where exactly these should be
|
||||
enum mirror-response {
|
||||
success,
|
||||
failure, // TODO
|
||||
}
|
||||
|
||||
enum auto-update-response {
|
||||
success,
|
||||
failure, // TODO
|
||||
}
|
||||
|
||||
enum rebuild-index-response {
|
||||
success,
|
||||
failure, // TODO
|
||||
}
|
||||
|
||||
record apis-response {
|
||||
apis: list<package-id>,
|
||||
}
|
||||
@ -127,7 +247,7 @@ interface main {
|
||||
|
||||
world app-store-sys-v0 {
|
||||
import main;
|
||||
import download;
|
||||
import downloads;
|
||||
import chain;
|
||||
include process-v0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user