@artifact/web-client@0.0.39
Holds logic for implementing the artifact api object that is passed to napps at context time.
Is passed in services which it wires together. It requires a blob store, a consistency source, and an execution engine.
These dependencies can be swapped out for different implementations. The logic that connects them is the same, regardless.
This module bridges the api exposed to consumers of artifact with the backing implementation services, where the backing services can be very different.
Examples of different backing services:
- A local filesystem
- A remote filesystem
- A git repository
- A database
- A cloud storage service
Snapshots
Snapshots are a posix filesystem that works with content addressable files and is snapshot aware.
A snapshot represents a tree of posix file paths that represent hashed content.
Snapshots have linked lineage, and all except the first snapshot in a chain have at least one parent, and can have several parents if the snapshot represents a merge of multiple snapshots.
The intended purpose of this implementation is to be backed by a git repository, but this abstraction need not use git, and could use any other kind of blockchain structure underneath, like IPFS or Pijul, for example.
The purpose of representing a posix filesystem is that all code understands files, and so this model is time tested, familiar, and broadly compatible with multiple software languages.
Snapshots have 3 key concepts.
- blobs, which are analogous to files, that are represented by a hash
- trees, which are analogous to directories, are a data structure containing an array of blobs and trees
- snapshots, which are analogous to commits, represent a specific tree with pointers to the previous snapshots, representing a linear progression of changes
Benchmarks
CPU | AMD EPYC 7702P 64-Core Processor Runtime | Deno 2.1.9 (x86_64-unknown-linux-gnu) file:///napps/context/bench.ts benchmark time/iter (avg) iter/s (min … max) p75 p99 p995 -------------------------------- ----------------------------- --------------------- -------------------------- randomness 17.1 µs 58,620 ( 14.1 µs … 409.8 µs) 15.5 µs 56.4 µs 86.1 µs group add-file Add file (N=100) 7.0 ms 142.4 ( 5.8 ms … 9.9 ms) 7.7 ms 9.9 ms 9.9 ms Add file (N=100) sharded 8.8 ms 113.8 ( 5.9 ms … 17.6 ms) 10.0 ms 17.6 ms 17.6 ms Add file (N=1000) 33.8 ms 29.6 ( 29.9 ms … 38.4 ms) 35.3 ms 38.4 ms 38.4 ms Add file (N=1000) sharded 15.7 ms 63.5 ( 12.5 ms … 23.3 ms) 17.0 ms 23.3 ms 23.3 ms Add file (N=3000) 98.0 ms 10.2 ( 87.6 ms … 110.9 ms) 100.2 ms 110.9 ms 110.9 ms Add file (N=3000) sharded 15.9 ms 62.8 ( 12.6 ms … 40.6 ms) 18.2 ms 40.6 ms 40.6 ms Add file (N=10000) 338.5 ms 3.0 (297.6 ms … 377.8 ms) 361.1 ms 377.8 ms 377.8 ms Add file (N=10000) sharded 18.2 ms 55.0 ( 14.1 ms … 26.1 ms) 21.1 ms 26.1 ms 26.1 ms Add file (N=30000) 937.3 ms 1.1 (870.5 ms … 999.3 ms) 968.7 ms 999.3 ms 999.3 ms Add file (N=30000) sharded 19.5 ms 51.4 ( 15.9 ms … 27.2 ms) 23.2 ms 27.2 ms 27.2 ms summary Add file (N=100) 1.25x faster than Add file (N=100) sharded 2.24x faster than Add file (N=1000) sharded 2.27x faster than Add file (N=3000) sharded 2.59x faster than Add file (N=10000) sharded 2.77x faster than Add file (N=30000) sharded 4.81x faster than Add file (N=1000) 13.96x faster than Add file (N=3000) 48.21x faster than Add file (N=10000) 133.50x faster than Add file (N=30000) group read-file Read file (N=100) 2.2 µs 449,600 ( 1.5 µs … 539.3 µs) 2.3 µs 3.8 µs 4.4 µs Read file (N=100) sharded 9.4 µs 106,900 ( 6.3 µs … 1.5 ms) 9.8 µs 15.6 µs 17.0 µs Read file (N=1000) 5.6 µs 179,500 ( 1.6 µs … 3.5 ms) 7.2 µs 11.3 µs 12.1 µs Read file (N=1000) sharded 9.9 µs 100,600 ( 6.3 µs … 1.5 ms) 10.1 µs 16.3 µs 17.8 µs Read file (N=3000) 35.8 µs 27,940 ( 1.8 µs … 1.4 ms) 58.6 µs 93.9 µs 97.5 µs Read file (N=3000) sharded 9.8 µs 101,600 ( 6.5 µs … 1.9 ms) 10.1 µs 16.5 µs 18.0 µs Read file (N=10000) 190.4 µs 5,253 ( 2.7 µs … 3.8 ms) 298.5 µs 407.7 µs 413.1 µs Read file (N=10000) sharded 10.6 µs 94,120 ( 6.5 µs … 1.8 ms) 11.2 µs 17.2 µs 18.7 µs Read file (N=30000) 375.1 µs 2,666 ( 7.5 µs … 916.3 µs) 548.1 µs 884.4 µs 897.0 µs Read file (N=30000) sharded 11.9 µs 84,070 ( 6.8 µs … 3.7 ms) 12.7 µs 17.7 µs 19.0 µs summary Read file (N=100) 2.50x faster than Read file (N=1000) 4.21x faster than Read file (N=100) sharded 4.43x faster than Read file (N=3000) sharded 4.47x faster than Read file (N=1000) sharded 4.78x faster than Read file (N=10000) sharded 5.35x faster than Read file (N=30000) sharded 16.09x faster than Read file (N=3000) 85.60x faster than Read file (N=10000) 168.70x faster than Read file (N=30000) group delete-file Delete file (N=100) 6.3 ms 159.6 ( 5.4 ms … 15.7 ms) 5.9 ms 15.7 ms 15.7 ms Delete file (N=100) sharded 8.1 ms 124.2 ( 6.8 ms … 18.2 ms) 7.7 ms 18.2 ms 18.2 ms Delete file (N=1000) 36.6 ms 27.3 ( 28.9 ms … 45.0 ms) 41.9 ms 45.0 ms 45.0 ms Delete file (N=1000) sharded 15.9 ms 63.1 ( 12.8 ms … 24.3 ms) 17.8 ms 24.3 ms 24.3 ms Delete file (N=3000) 98.3 ms 10.2 ( 88.4 ms … 111.1 ms) 102.1 ms 111.1 ms 111.1 ms Delete file (N=3000) sharded 13.6 ms 73.3 ( 12.4 ms … 18.3 ms) 14.7 ms 18.3 ms 18.3 ms Delete file (N=10000) 318.6 ms 3.1 (290.3 ms … 359.2 ms) 328.9 ms 359.2 ms 359.2 ms Delete file (N=10000) sharded 16.1 ms 62.0 ( 13.6 ms … 25.7 ms) 17.5 ms 25.7 ms 25.7 ms Delete file (N=30000) 1.0 s 1.0 (972.7 ms … 1.2 s) 1.1 s 1.2 s 1.2 s Delete file (N=30000) sharded 19.1 ms 52.3 ( 15.7 ms … 28.6 ms) 22.2 ms 28.6 ms 28.6 ms summary Delete file (N=100) 1.28x faster than Delete file (N=100) sharded 2.18x faster than Delete file (N=3000) sharded 2.53x faster than Delete file (N=1000) sharded 2.57x faster than Delete file (N=10000) sharded 3.05x faster than Delete file (N=30000) sharded 5.85x faster than Delete file (N=1000) 15.69x faster than Delete file (N=3000) 50.84x faster than Delete file (N=10000) 165.10x faster than Delete file (N=30000) group list-directory ls directory (N=100) 87.7 µs 11,400 ( 72.4 µs … 949.4 µs) 87.9 µs 133.7 µs 384.7 µs ls directory (N=100) sharded 628.4 µs 1,591 (536.7 µs … 1.8 ms) 593.6 µs 1.4 ms 1.5 ms ls directory (N=1000) 801.1 µs 1,248 (727.8 µs … 4.6 ms) 773.7 µs 1.3 ms 1.5 ms ls directory (N=1000) sharded 3.6 ms 275.1 ( 3.4 ms … 4.2 ms) 3.8 ms 4.2 ms 4.2 ms ls directory (N=3000) 2.5 ms 407.8 ( 2.2 ms … 3.7 ms) 2.6 ms 3.4 ms 3.4 ms ls directory (N=3000) sharded 12.8 ms 78.1 ( 9.3 ms … 15.2 ms) 14.2 ms 15.2 ms 15.2 ms ls directory (N=10000) 11.7 ms 85.1 ( 8.1 ms … 26.4 ms) 13.2 ms 26.4 ms 26.4 ms ls directory (N=10000) sharded 32.0 ms 31.3 ( 29.9 ms … 34.8 ms) 33.0 ms 34.8 ms 34.8 ms ls directory (N=30000) 52.8 ms 18.9 ( 35.9 ms … 64.9 ms) 59.7 ms 64.9 ms 64.9 ms ls directory (N=30000) sharded 108.3 ms 9.2 ( 97.9 ms … 132.8 ms) 112.6 ms 132.8 ms 132.8 ms summary ls directory (N=100) 7.17x faster than ls directory (N=100) sharded 9.13x faster than ls directory (N=1000) 27.96x faster than ls directory (N=3000) 41.44x faster than ls directory (N=1000) sharded 134.00x faster than ls directory (N=10000) 146.10x faster than ls directory (N=3000) sharded 364.80x faster than ls directory (N=10000) sharded 601.90x faster than ls directory (N=30000) 1234x faster than ls directory (N=30000) sharded group exists-check Exists check (N=100) 2.4 µs 411,900 ( 1.4 µs … 868.4 µs) 2.7 µs 4.5 µs 4.8 µs Exists check (N=100) sharded 8.9 µs 112,200 ( 5.9 µs … 1.4 ms) 9.4 µs 15.7 µs 16.8 µs Exists check (N=1000) 5.4 µs 185,200 ( 1.4 µs … 1.3 ms) 7.0 µs 12.0 µs 13.5 µs Exists check (N=1000) sharded 9.6 µs 104,700 ( 6.1 µs … 1.4 ms) 9.9 µs 16.5 µs 17.7 µs Exists check (N=3000) 36.2 µs 27,590 ( 1.5 µs … 3.2 ms) 59.5 µs 95.5 µs 99.8 µs Exists check (N=3000) sharded 11.0 µs 91,240 ( 6.2 µs … 2.8 ms) 12.3 µs 19.8 µs 22.1 µs Exists check (N=10000) 199.1 µs 5,022 ( 2.8 µs … 4.2 ms) 311.9 µs 524.2 µs 552.8 µs Exists check (N=10000) sharded 10.6 µs 94,700 ( 6.6 µs … 3.2 ms) 11.0 µs 16.9 µs 18.2 µs Exists check (N=30000) 389.2 µs 2,569 ( 3.6 µs … 931.9 µs) 569.3 µs 878.0 µs 890.6 µs Exists check (N=30000) sharded 11.6 µs 86,030 ( 6.6 µs … 4.9 ms) 12.1 µs 18.3 µs 19.8 µs summary Exists check (N=100) 2.22x faster than Exists check (N=1000) 3.67x faster than Exists check (N=100) sharded 3.93x faster than Exists check (N=1000) sharded 4.35x faster than Exists check (N=10000) sharded 4.51x faster than Exists check (N=3000) sharded 4.79x faster than Exists check (N=30000) sharded 14.93x faster than Exists check (N=3000) 82.01x faster than Exists check (N=10000) 160.30x faster than Exists check (N=30000)
Add Package
deno add jsr:@artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";
Import directly with a jsr specifier
import * as web_client from "jsr:@artifact/web-client";
Add Package
pnpm i jsr:@artifact/web-client
pnpm dlx jsr add @artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";
Add Package
yarn add jsr:@artifact/web-client
yarn dlx jsr add @artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";
Add Package
vlt install jsr:@artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";
Add Package
npx jsr add @artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";
Add Package
bunx jsr add @artifact/web-client
Import symbol
import * as web_client from "@artifact/web-client";