Skip to content

Commit

Permalink
A slew of cleanups (n0-computer#198)
Browse files Browse the repository at this point in the history
* fix a bunch of broken links
* We have docker images now
* Gossip section in the API
* Gossip component in more places
* Correct Layer / Component terminology in a few places
  • Loading branch information
b5 authored Sep 6, 2024
1 parent 12a0ad3 commit 0ff9c11
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 39 deletions.
27 changes: 25 additions & 2 deletions api-code-examples/api.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const docs = [
{
name: 'docs delete',
Expand Down Expand Up @@ -247,7 +246,7 @@ gjfmivyaycuads6ek4asma3qacdtvs6waaaaaaaaaanctrkxaetag4aaq45mprsyystlwe66csxvqmru
description: 'Set the active document (only works within the Iroh console).',
slug: 'docs-switch',
arguments: [
{ name: 'id', necessity: 'required', description: 'The [identifier](/docs/layers/documents#document-identifiers) of the document to switch to.' },
{ name: 'id', necessity: 'required', description: 'The [document identifier](/docs/components/documents#document-identifiers) of the document to switch to.' },
],
examples: {
console: `> docs create
Expand Down Expand Up @@ -409,6 +408,29 @@ author:2ziftxhhind7atie
}
]

const gossip = [
{
name: 'gossip subscribe',
description: 'Subscribe to a gossip topic',
slug: 'gossip-subscribe',
arguments: [
{
name: 'topic',
necessity: 'required',
description: 'The topic to subscribe to'
},
{
name: 'bootstrap',
necessity: '',
description: 'one or more nodeIDs to bootstrap the subscription (nodes already hosting the topic)'
}
],
examples: {
console: `> gossip subscribe --topic your-topic-name-here`
}
},
]

const tags = [
{
name: 'tags list',
Expand Down Expand Up @@ -804,6 +826,7 @@ const api = {
docs,
authors,
tags,
gossip,
blobs
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/why-we-forked-quinn/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default (props) => <BlogPostLayout article={post} {...props} />

We chose QUIC as the transport protocol to underpin iroh on the network because it offers desirable user-facing features, such as multiple-ordered streams that do not block each other. However, we also chose QUIC for no small part because it sends UDP packets over the network. Leveraging UDP is instrumental in allowing us to do reliable hole-punching through firewalls and NAT routers to establish direct connections.

We opted to use [Quinn](/~https://github.com/quinn-rs/quinn), a solid open-source implementation with all the features we needed for iroh. It allowed us to plug in our custom [MagicSocket](https://iroh.computer/docs/layers/networking#magic-sockets), which selects the best network path among multiple paths between iroh endpoints with the help of a relay server.
We opted to use [Quinn](/~https://github.com/quinn-rs/quinn), a solid open-source implementation with all the features we needed for iroh. It allowed us to plug in our custom [MagicSocket](https://iroh.computer/docs/components/net#magic-sockets), which selects the best network path among multiple paths between iroh endpoints with the help of a relay server.

We had great success integrating with the Quinn API. However, even with our success, we knew we would likely see some performance issues in iroh because we couldn’t integrate closely *enough* with certain QUIC features.

Expand Down
2 changes: 1 addition & 1 deletion src/app/docs/api/docs-switch/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Set the active document (only works within the Iroh console). {{ className: 'lea

| name | necessity | description |
| ---- | --------- | ----------- |
| id | required | The [identifier](/docs/layers/documents#document-identifiers) of the document to switch to. |
| id | required | The [document identifier](/docs/components/documents#document-identifiers) of the document to switch to. |



Expand Down
39 changes: 39 additions & 0 deletions src/app/docs/api/gossip-subscribe/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{/* THIS FILE IS GENERATED FROM A TEMPLATE. See scripts/generate-api-pages.js for more */}
import Breadcrumbs from '@/components/Breadcrumbs'
export const metadata = {
title: "gossip subscribe",
description: "Subscribe to a gossip topic"
}

<div className='not-prose mb-5'>
<Breadcrumbs pages={[
{ name: 'API', href: '/docs/api', current: false },
{ name: 'gossip subscribe', href: '/docs/api/gossip-subscribe', current: true },
]} />
</div>

# gossip subscribe

Subscribe to a gossip topic {{ className: 'lead' }}


### Arguments

| name | necessity | description |
| ---- | --------- | ----------- |
| topic | required | The topic to subscribe to |
| bootstrap | | one or more nodeIDs to bootstrap the subscription (nodes already hosting the topic) |



## Examples

<CodeGroup title="gossip subscribe">
```text {{ title: 'console' }}
> gossip subscribe --topic your-topic-name-here
```




</CodeGroup>
16 changes: 12 additions & 4 deletions src/app/docs/api/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ Iroh has a single application programming interface (API), implemented in numero

## Documents

Manage & manipulate [documents](/docs/layers/documents): syncable, multi-writer key-value stores.
Manage & manipulate [documents](/docs/components/docs): syncable, multi-writer key-value stores.

<ApiCommands commands={commands.docs} />

---

## Authors

[Authors](/docs/layers/documents#authors-and-permissions) manage & view documents.
[Authors](/docs/components/docs#authors-and-permissions) manage & view documents.

<ApiCommands commands={commands.authors} />

---

## Gossip

[Gossip](/docs/components/gossip) broadcasts messages to a group of nodes.

<ApiCommands commands={commands.gossip} />

---

## Tags

Tags are local, human-readable names for things iroh should keep.
Expand All @@ -39,15 +47,15 @@ Tags are local, human-readable names for things iroh should keep.

## Blobs

[Blobs](/docs/layers/blobs) are opaque content-addressed byte sequences.
[Blobs](/docs/components/blobs) are opaque content-addressed byte sequences.

<ApiCommands commands={commands.blobs} />

---

## Net

Manage [remote node connections](/docs/layers/networking)
Manage [remote node connections](/docs/components/networking)

<ApiCommands commands={commands.net} />

Expand Down
18 changes: 4 additions & 14 deletions src/app/docs/concepts/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,26 @@ import { Resources, Resource } from '@/components/Resources';

# Concepts

<Resources title='iroh layers'>
<Resources title='iroh components'>
<Resource
href='/docs/layers/documents'
href='/docs/components/documents'
name='Documents'
description='Documents are portable, syncable key-value stores'
icon='CodeBracketIcon'
pattern={{ y: 32, squares: [[0, 2], [1, 4]] }}
/>
<Resource
href='/docs/layers/blobs'
href='/docs/components/blobs'
name='SDKs'
description='Content-addressable storage & transfer of any-sized binary data'
icon='ArchiveBoxIcon'
pattern={{ y: -6, squares: [[-1, 2], [1, 3]] }}
/>
<Resource
href='/docs/layers/networking'
href='/docs/components/net'
name='Todos Example'
description='Connect to any device by node ID'
icon='UserIcon'
pattern={{ y: 16, squares:[[0, 1],[1, 3]] }}
/>
</Resources>

<Resources title='iroh concepts'>
<Resource
href='/docs/concepts/anchors'
name='Anchor Nodes'
description='Anchors are high-availability iroh nodes that support apps'
icon='CodeBracketIcon'
pattern={{ y: 32, squares: [[0, 2], [1, 4]] }}
/>
</Resources>
13 changes: 12 additions & 1 deletion src/app/docs/install/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Iroh is meant be used as a library by importing one of the existing Iroh SDKs, b
</div>
</Note>

## Install via bash script

Run this script to get started:
```bash
Expand All @@ -34,7 +35,17 @@ $ iroh --help

## Docker Containers

The Iroh CLI is not currently available as a docker image. We're working on it.
Iroh is available as a Docker container. To run the latest version, run:

```bash
docker pull n0computer/iroh
```

We also make supporting binaries like the iroh relay & iroh DNS available on [docker hub](https://hub.docker.com/u/n0computer)

## NixOS

Iroh is available as a [nix flake](https://mynixos.com/nixpkgs/package/iroh)

## Building from Source
Details on how to build from source can be found in the iroh [Developer documentation](/~https://github.com/n0-computer/iroh).
Expand Down
6 changes: 3 additions & 3 deletions src/app/docs/ipfs/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Here's a quick rundown on some of the core technical distinctions between IPFS &

| Concept | Iroh | Kubo |
| ------- | ---- | ---- |
| **[CID](https://docs.ipfs.tech/concepts/content-addressing/) Usage** | Used for root hashes on the [Blob layer](/docs/layers/blobs) | Used for all blocks |
| **[CID](https://docs.ipfs.tech/concepts/content-addressing/) Usage** | Used for root hashes on the [Blob layer](/docs/components/blobs) | Used for all blocks |
| **Hash Function** | BLAKE3 | Various, SHA2 by default |
| **Maximum Block Size** | none | 1MiB |
| **Data Layout** | Key-Value | Directed Acyclic Graphs (DAGs) |
| **Data Model** | "Bring your own" | [IPLD](https://ipld.io/specs) or "Bring your own" |
| **Syncing** | [Document Layer](/docs/layers/documents) | none |
| **Networking Stack** | [Connection Layer](/docs/layers/connections) | [libp2p](https://libp2p.io) |
| **Syncing** | [documents](/docs/components/documents) | none |
| **Networking Stack** | [iroh-net](/docs/components/net) | [libp2p](https://libp2p.io) |
| **Public Key Cryptography** | ED25519 Keys | Various, ED25519 by default |
| **Naming system** | none | [IPNS](https://specs.ipfs.tech/ipns/), [DNSLink](https://dnslink.dev/) |
| **Content Storage** | User Files + Cache | Internal Repository |
Expand Down
7 changes: 4 additions & 3 deletions src/app/docs/overview/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ Every key in a document points to a hash-verified blob of bytes. We say “blobs
Iroh is organized into three _layers_. Each higher layer depends on functionality in the layer below it. Documents rely on blobs, and blobs rely on connections.

<Concepts>
<Concept name="Documents" href="/docs/layers/documents" description="Collaborate on shared key-value tables of blobs with peers." />
<Concept name="Blobs" href="/docs/layers/blobs" description="Fetch and cache byte sequences by their hash." />
<Concept name="Connections" href="/docs/layers/connections" description="Open a connection to any available peer on the network." />
<Concept name="Documents" href="/docs/components/documents" description="Collaborate on shared key-value tables of blobs with peers." />
<Concept name="Blobs" href="/docs/components/blobs" description="Fetch and cache byte sequences by their hash." />
<Concept name="Gossip" href="/docs/components/gossip" description="Broadcast messages to a swarm of peers." />
<Concept name="Net" href="/docs/components/net" description="Open a connection to any available peer on the network." />
</Concepts>

Most users can and should be able to build entire applications with only the sync layer. If your use case is complex, iroh lets you remove the batteries, dropping down to lower layers in the stack. You can build trustless systems directly on the blob layer, or build your own networking protocol using the networking layer.
Expand Down
8 changes: 8 additions & 0 deletions src/app/docs/quickstart/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export const metadata = {

This guide will give you a quick tour of iroh from the command line. We'll create a document and sync it between two terminals. After that we'll look at where to go next to learn about how iroh works & where to integrate into your application. {{className: 'lead'}}

<Note>
Iroh is meant be used as a library by importing one of the existing Iroh SDKs. the Quickstart uses the CLI as a language-agnostic startiong point.

<div className="not-prose mb-16 mt-6 flex gap-3">
<Button href="/docs/sdks" arrow="right" variant="text" children="Explore SDKs" />
</div>
</Note>

## Install Iroh

The first thing you'll need to do is get the iroh CLI. Follow the instructions on our [install guide](/docs/install) to install iroh.
Expand Down
24 changes: 14 additions & 10 deletions src/components/Guides.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ import {Heading} from '@/components/Heading';

const guides = [
{
href: '/docs/layers',
name: 'Layers',
description: 'Iroh has three mix-and-match layers: Documents, Blobs, & Connections',
},
{
href: '/docs/layers/documents',
href: '/docs/components/documents',
name: 'Documents',
description: 'Understand documents, mutable, syncable key-value stores',
},
{
href: '/docs/layers/blobs',
href: '/docs/components/blobs',
name: 'Blobs',
description:
'Documents point to blobs: opaque bytes identified by their hash',
},
{
href: '/docs/layers/networking',
href: '/docs/components/gossip',
name: 'Gossip',
description:
'Broadcast messages to all nodes in a swarm',
},
{
href: '/docs/components/net',
name: 'Networking',
description:
'At the core of iroh is the ability to connect to any online node with only a Peer identifier',
Expand All @@ -30,12 +31,15 @@ export function Guides() {
return (
<div className="my-16 xl:max-w-none">
<Heading level={2} id="guides">
Overview
Components
</Heading>
<p className="text-md text-zinc-600 dark:text-zinc-400">
Iroh has four mix-and-match components: Documents, Blobs, Gossip, & Networking
</p>
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4">
{guides.map((guide) => (
<div key={guide.href}>
<h3 className="text-sm font-semibold text-zinc-900 dark:text-white">
<h3 className="text-md font-semibold text-zinc-900 dark:text-white">
{guide.name}
</h3>
<p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400">
Expand Down

0 comments on commit 0ff9c11

Please sign in to comment.