-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
650 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,4 @@ jobs: | |
yarn build | ||
cd ../../examples/canvas | ||
yarn install --frozen-lockfile | ||
yarn build | ||
yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Build Docker Image | ||
on: | ||
release: | ||
types: [published] | ||
permissions: | ||
packages: write | ||
env: | ||
IMAGE: ghcr.io/${{ github.repository }} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.IMAGE }} | ||
tags: | | ||
${{ github.event.release.tag_name }} | ||
latest | ||
- name: Build and push Docker image | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./packages/node | ||
file: ./packages/node/Dockerfile | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: | | ||
${{ env.IMAGE }}:${{ github.event.release.tag_name }} | ||
${{ env.IMAGE }}:latest | ||
outputs: type=image,name=${{ env.IMAGE }},name-canonical=true,push=true | ||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-* | ||
merge-multiple: true | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.IMAGE }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.IMAGE }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Generate docs | ||
on: | ||
release: | ||
types: [published] | ||
permissions: | ||
pages: write | ||
id-token: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
- run: | | ||
cd packages/node && yarn && yarn build | ||
cd ../.. && yarn docs | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./docs | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
|
||
dist/ | ||
docs/ | ||
node_modules/ | ||
|
||
**/tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,43 @@ | ||
# ts-topology | ||
The official TypeScript implementation of Topology Protocol | ||
<div align="center"> | ||
<img src="https://avatars.githubusercontent.com/u/157637200" height="128"> | ||
<br /> | ||
<h1>The TypeScript implementation of the Topology Protocol</h1> | ||
</div> | ||
|
||
<div align="center"> | ||
|
||
 | ||
[](https://topology-foundation.github.io/ts-topology/) | ||
[](https://github.com/topology-foundation/ts-topology/blob/main/LICENSE) | ||
[](https://github.com/topology-foundation/ts-topology/issues) | ||
[](https://github.com/topology-foundation/ts-topology/pulls) | ||
|
||
[](https://topology.gg) | ||
[](https://github.com/topology-foundation) | ||
[](https://x.com/topology_gg) | ||
[](https://t.me/topologyfrens) | ||
[](https://discord.gg/GUDGzBP5mn) | ||
</div> | ||
|
||
# Overview | ||
|
||
This is the official TypeScript implementation of the Topology Protocol. The Topology Protocol is a local-first decentralized protocol for real-time applications. It introduces a new concept for Conflict-free Replicated Objects (CRO), that are built on top of libp2p and composed of CRDTs. | ||
|
||
# Specifications | ||
|
||
The specifications of the Topology Protocol are shared across different client implementations and can be found in the [specs repository](https://github.com/topology-foundation/specs). Currently the specifications are starting to be written based on this implementation. | ||
|
||
# Packages | ||
|
||
This repository is a monorepo that contains the following packages: | ||
|
||
| Package | Description | | ||
|---------|--------------------------------------------------| | ||
| crdt | CRDT implementations intended to use as builtins | | ||
| network | Network middleware to abstract libp2p | | ||
| node | Topology Node library and CLI | | ||
| object | CRO objects structure implementation | | ||
|
||
# Examples | ||
|
||
All the examples are located in the `examples` directory. Currently, there is only one example, which is a simple canvas where you can paint pixels. You can also look into the [counter-splash](https://github.com/topology-foundation/counter-splash) (demo for EthCC 2024) repository for a more complex example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Conflict-free Replicated Data Types (CRDTs) | ||
|
||
This package contains the CRDT implementations intended to use as builtins for the Topology Protocol. | ||
|
||
## Usage | ||
|
||
This package is intended to be used as a dependency for the Topology Protocol. However, you can use it as a standalone package. For that, you can install it using: | ||
|
||
```bash | ||
# yarn | ||
yarn add @topology-foundation/crdt | ||
|
||
# npm | ||
npm install @topology-foundation/crdt | ||
``` | ||
|
||
### Build | ||
|
||
To build the package, you can run: | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
### Tests | ||
|
||
To run the tests, you can run: | ||
|
||
```bash | ||
yarn test | ||
``` | ||
|
||
## CRDTs Implementations | ||
- [x] G-Counter | ||
- [x] PN-Counter | ||
- [x] G-Set | ||
- [x] 2P-Set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://typedoc.org/schema.json", | ||
"includeVersion": true, | ||
"entryPoints": ["src/index.ts"], | ||
"readme": "README.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Topology Network Stack | ||
|
||
This package contains the network middleware to abstract libp2p for the Topology Protocol. | ||
|
||
To do so, we define a `TopologyNetworkNode` where we can pass the configs that we want and it "magically" configures libp2p and gives connectivity to the Topology Network. | ||
|
||
## Usage | ||
|
||
This package is intended to be used as a dependency for the Topology Protocol. However, you can use it as a standalone package. For that, you can install it using: | ||
|
||
```bash | ||
# yarn | ||
yarn add @topology-foundation/network | ||
|
||
# npm | ||
npm install @topology-foundation/network | ||
``` | ||
|
||
### Build | ||
|
||
To build the package, you can run: | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
### Tests | ||
|
||
To run the tests, you can run: | ||
|
||
```bash | ||
yarn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://typedoc.org/schema.json", | ||
"includeVersion": true, | ||
"entryPoints": ["src/index.ts"], | ||
"readme": "README.md" | ||
} |
Oops, something went wrong.