Compare commits
No commits in common. "gh-pages" and "main" have entirely different histories.
821 changed files with 343345 additions and 66358 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
17
.github/workflows/advisory-cron.yaml
vendored
Normal file
17
.github/workflows/advisory-cron.yaml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: Advisories
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 18 * * *'
|
||||||
|
jobs:
|
||||||
|
cargo-deny:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
checks:
|
||||||
|
- advisories
|
||||||
|
- bans licenses sources
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
||||||
|
with:
|
||||||
|
command: check ${{ matrix.checks }}
|
177
.github/workflows/ci.yaml
vendored
Normal file
177
.github/workflows/ci.yaml
vendored
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: 1.67.0
|
||||||
|
default: true
|
||||||
|
components: rustfmt
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- run: ./scripts/ci/fmt
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: 1.67.0
|
||||||
|
default: true
|
||||||
|
components: clippy
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- run: ./scripts/ci/lint
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: 1.67.0
|
||||||
|
default: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- name: Build rust docs
|
||||||
|
run: ./scripts/ci/rust-docs
|
||||||
|
shell: bash
|
||||||
|
- name: Install doxygen
|
||||||
|
run: sudo apt-get install -y doxygen
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
cargo-deny:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
checks:
|
||||||
|
- advisories
|
||||||
|
- bans licenses sources
|
||||||
|
continue-on-error: ${{ matrix.checks == 'advisories' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
||||||
|
with:
|
||||||
|
arguments: '--manifest-path ./rust/Cargo.toml'
|
||||||
|
command: check ${{ matrix.checks }}
|
||||||
|
|
||||||
|
wasm_tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install wasm-bindgen-cli
|
||||||
|
run: cargo install wasm-bindgen-cli wasm-opt
|
||||||
|
- name: Install wasm32 target
|
||||||
|
run: rustup target add wasm32-unknown-unknown
|
||||||
|
- name: run tests
|
||||||
|
run: ./scripts/ci/wasm_tests
|
||||||
|
deno_tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: denoland/setup-deno@v1
|
||||||
|
with:
|
||||||
|
deno-version: v1.x
|
||||||
|
- name: Install wasm-bindgen-cli
|
||||||
|
run: cargo install wasm-bindgen-cli wasm-opt
|
||||||
|
- name: Install wasm32 target
|
||||||
|
run: rustup target add wasm32-unknown-unknown
|
||||||
|
- name: run tests
|
||||||
|
run: ./scripts/ci/deno_tests
|
||||||
|
|
||||||
|
js_fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: install
|
||||||
|
run: yarn global add prettier
|
||||||
|
- name: format
|
||||||
|
run: prettier -c javascript/.prettierrc javascript
|
||||||
|
|
||||||
|
js_tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install wasm-bindgen-cli
|
||||||
|
run: cargo install wasm-bindgen-cli wasm-opt
|
||||||
|
- name: Install wasm32 target
|
||||||
|
run: rustup target add wasm32-unknown-unknown
|
||||||
|
- name: run tests
|
||||||
|
run: ./scripts/ci/js_tests
|
||||||
|
|
||||||
|
cmake_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly-2023-01-26
|
||||||
|
default: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- name: Install CMocka
|
||||||
|
run: sudo apt-get install -y libcmocka-dev
|
||||||
|
- name: Install/update CMake
|
||||||
|
uses: jwlawson/actions-setup-cmake@v1.12
|
||||||
|
with:
|
||||||
|
cmake-version: latest
|
||||||
|
- name: Install rust-src
|
||||||
|
run: rustup component add rust-src
|
||||||
|
- name: Build and test C bindings
|
||||||
|
run: ./scripts/ci/cmake-build Release Static
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- 1.67.0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
default: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- run: ./scripts/ci/build-test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: 1.67.0
|
||||||
|
default: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- run: ./scripts/ci/build-test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: 1.67.0
|
||||||
|
default: true
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
- run: ./scripts/ci/build-test
|
||||||
|
shell: bash
|
52
.github/workflows/docs.yaml
vendored
Normal file
52
.github/workflows/docs.yaml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
name: Documentation
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-docs:
|
||||||
|
concurrency: deploy-docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Cache
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
|
- name: Clean docs dir
|
||||||
|
run: rm -rf docs
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Clean Rust docs dir
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clean
|
||||||
|
args: --manifest-path ./rust/Cargo.toml --doc
|
||||||
|
|
||||||
|
- name: Build Rust docs
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: doc
|
||||||
|
args: --manifest-path ./rust/Cargo.toml --workspace --all-features --no-deps
|
||||||
|
|
||||||
|
- name: Move Rust docs
|
||||||
|
run: mkdir -p docs && mv rust/target/doc/* docs/.
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Configure root page
|
||||||
|
run: echo '<meta http-equiv="refresh" content="0; url=automerge">' > docs/index.html
|
||||||
|
|
||||||
|
- name: Deploy docs
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./docs
|
214
.github/workflows/release.yaml
vendored
Normal file
214
.github/workflows/release.yaml
vendored
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check_if_wasm_version_upgraded:
|
||||||
|
name: Check if WASM version has been upgraded
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
wasm_version: ${{ steps.version-updated.outputs.current-package-version }}
|
||||||
|
wasm_has_updated: ${{ steps.version-updated.outputs.has-updated }}
|
||||||
|
steps:
|
||||||
|
- uses: JiPaix/package-json-updated-action@v1.0.5
|
||||||
|
id: version-updated
|
||||||
|
with:
|
||||||
|
path: rust/automerge-wasm/package.json
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish-wasm:
|
||||||
|
name: Publish WASM package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- check_if_wasm_version_upgraded
|
||||||
|
# We create release only if the version in the package.json has been upgraded
|
||||||
|
if: needs.check_if_wasm_version_upgraded.outputs.wasm_has_updated == 'true'
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '16.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- uses: denoland/setup-deno@v1
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
- name: Get rid of local github workflows
|
||||||
|
run: rm -r .github/workflows
|
||||||
|
- name: Remove tmp_branch if it exists
|
||||||
|
run: git push origin :tmp_branch || true
|
||||||
|
- run: git checkout -b tmp_branch
|
||||||
|
- name: Install wasm-bindgen-cli
|
||||||
|
run: cargo install wasm-bindgen-cli wasm-opt
|
||||||
|
- name: Install wasm32 target
|
||||||
|
run: rustup target add wasm32-unknown-unknown
|
||||||
|
- name: run wasm js tests
|
||||||
|
id: wasm_js_tests
|
||||||
|
run: ./scripts/ci/wasm_tests
|
||||||
|
- name: run wasm deno tests
|
||||||
|
id: wasm_deno_tests
|
||||||
|
run: ./scripts/ci/deno_tests
|
||||||
|
- name: build release
|
||||||
|
id: build_release
|
||||||
|
run: |
|
||||||
|
npm --prefix $GITHUB_WORKSPACE/rust/automerge-wasm run release
|
||||||
|
- name: Collate deno release files
|
||||||
|
if: steps.wasm_js_tests.outcome == 'success' && steps.wasm_deno_tests.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
mkdir $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
cp $GITHUB_WORKSPACE/rust/automerge-wasm/deno/* $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
cp $GITHUB_WORKSPACE/rust/automerge-wasm/index.d.ts $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
cp $GITHUB_WORKSPACE/rust/automerge-wasm/README.md $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
cp $GITHUB_WORKSPACE/rust/automerge-wasm/LICENSE $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
sed -i '1i /// <reference types="./index.d.ts" />' $GITHUB_WORKSPACE/deno_wasm_dist/automerge_wasm.js
|
||||||
|
- name: Create npm release
|
||||||
|
if: steps.wasm_js_tests.outcome == 'success' && steps.wasm_deno_tests.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
if [ "$(npm --prefix $GITHUB_WORKSPACE/rust/automerge-wasm show . version)" = "$VERSION" ]; then
|
||||||
|
echo "This version is already published"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
EXTRA_ARGS="--access public"
|
||||||
|
if [[ $VERSION == *"alpha."* ]] || [[ $VERSION == *"beta."* ]] || [[ $VERSION == *"rc."* ]]; then
|
||||||
|
echo "Is pre-release version"
|
||||||
|
EXTRA_ARGS="$EXTRA_ARGS --tag next"
|
||||||
|
fi
|
||||||
|
if [ "$NODE_AUTH_TOKEN" = "" ]; then
|
||||||
|
echo "Can't publish on NPM, You need a NPM_TOKEN secret."
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
npm publish $GITHUB_WORKSPACE/rust/automerge-wasm $EXTRA_ARGS
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
VERSION: ${{ needs.check_if_wasm_version_upgraded.outputs.wasm_version }}
|
||||||
|
- name: Commit wasm deno release files
|
||||||
|
run: |
|
||||||
|
git config --global user.name "actions"
|
||||||
|
git config --global user.email actions@github.com
|
||||||
|
git add $GITHUB_WORKSPACE/deno_wasm_dist
|
||||||
|
git commit -am "Add deno release files"
|
||||||
|
git push origin tmp_branch
|
||||||
|
- name: Tag wasm release
|
||||||
|
if: steps.wasm_js_tests.outcome == 'success' && steps.wasm_deno_tests.outcome == 'success'
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: Automerge Wasm v${{ needs.check_if_wasm_version_upgraded.outputs.wasm_version }}
|
||||||
|
tag_name: js/automerge-wasm-${{ needs.check_if_wasm_version_upgraded.outputs.wasm_version }}
|
||||||
|
target_commitish: tmp_branch
|
||||||
|
generate_release_notes: false
|
||||||
|
draft: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Remove tmp_branch
|
||||||
|
run: git push origin :tmp_branch
|
||||||
|
check_if_js_version_upgraded:
|
||||||
|
name: Check if JS version has been upgraded
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
js_version: ${{ steps.version-updated.outputs.current-package-version }}
|
||||||
|
js_has_updated: ${{ steps.version-updated.outputs.has-updated }}
|
||||||
|
steps:
|
||||||
|
- uses: JiPaix/package-json-updated-action@v1.0.5
|
||||||
|
id: version-updated
|
||||||
|
with:
|
||||||
|
path: javascript/package.json
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish-js:
|
||||||
|
name: Publish JS package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- check_if_js_version_upgraded
|
||||||
|
- check_if_wasm_version_upgraded
|
||||||
|
- publish-wasm
|
||||||
|
# We create release only if the version in the package.json has been upgraded and after the WASM release
|
||||||
|
if: |
|
||||||
|
(always() && ! cancelled()) &&
|
||||||
|
(needs.publish-wasm.result == 'success' || needs.publish-wasm.result == 'skipped') &&
|
||||||
|
needs.check_if_js_version_upgraded.outputs.js_has_updated == 'true'
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '16.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- uses: denoland/setup-deno@v1
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
- name: Get rid of local github workflows
|
||||||
|
run: rm -r .github/workflows
|
||||||
|
- name: Remove js_tmp_branch if it exists
|
||||||
|
run: git push origin :js_tmp_branch || true
|
||||||
|
- run: git checkout -b js_tmp_branch
|
||||||
|
- name: check js formatting
|
||||||
|
run: |
|
||||||
|
yarn global add prettier
|
||||||
|
prettier -c javascript/.prettierrc javascript
|
||||||
|
- name: run js tests
|
||||||
|
id: js_tests
|
||||||
|
run: |
|
||||||
|
cargo install wasm-bindgen-cli wasm-opt
|
||||||
|
rustup target add wasm32-unknown-unknown
|
||||||
|
./scripts/ci/js_tests
|
||||||
|
- name: build js release
|
||||||
|
id: build_release
|
||||||
|
run: |
|
||||||
|
npm --prefix $GITHUB_WORKSPACE/javascript run build
|
||||||
|
- name: build js deno release
|
||||||
|
id: build_deno_release
|
||||||
|
run: |
|
||||||
|
VERSION=$WASM_VERSION npm --prefix $GITHUB_WORKSPACE/javascript run deno:build
|
||||||
|
env:
|
||||||
|
WASM_VERSION: ${{ needs.check_if_wasm_version_upgraded.outputs.wasm_version }}
|
||||||
|
- name: run deno tests
|
||||||
|
id: deno_tests
|
||||||
|
run: |
|
||||||
|
npm --prefix $GITHUB_WORKSPACE/javascript run deno:test
|
||||||
|
- name: Collate deno release files
|
||||||
|
if: steps.js_tests.outcome == 'success' && steps.deno_tests.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
mkdir $GITHUB_WORKSPACE/deno_js_dist
|
||||||
|
cp $GITHUB_WORKSPACE/javascript/deno_dist/* $GITHUB_WORKSPACE/deno_js_dist
|
||||||
|
- name: Create npm release
|
||||||
|
if: steps.js_tests.outcome == 'success' && steps.deno_tests.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
if [ "$(npm --prefix $GITHUB_WORKSPACE/javascript show . version)" = "$VERSION" ]; then
|
||||||
|
echo "This version is already published"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
EXTRA_ARGS="--access public"
|
||||||
|
if [[ $VERSION == *"alpha."* ]] || [[ $VERSION == *"beta."* ]] || [[ $VERSION == *"rc."* ]]; then
|
||||||
|
echo "Is pre-release version"
|
||||||
|
EXTRA_ARGS="$EXTRA_ARGS --tag next"
|
||||||
|
fi
|
||||||
|
if [ "$NODE_AUTH_TOKEN" = "" ]; then
|
||||||
|
echo "Can't publish on NPM, You need a NPM_TOKEN secret."
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
npm publish $GITHUB_WORKSPACE/javascript $EXTRA_ARGS
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
VERSION: ${{ needs.check_if_js_version_upgraded.outputs.js_version }}
|
||||||
|
- name: Commit js deno release files
|
||||||
|
run: |
|
||||||
|
git config --global user.name "actions"
|
||||||
|
git config --global user.email actions@github.com
|
||||||
|
git add $GITHUB_WORKSPACE/deno_js_dist
|
||||||
|
git commit -am "Add deno js release files"
|
||||||
|
git push origin js_tmp_branch
|
||||||
|
- name: Tag JS release
|
||||||
|
if: steps.js_tests.outcome == 'success' && steps.deno_tests.outcome == 'success'
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: Automerge v${{ needs.check_if_js_version_upgraded.outputs.js_version }}
|
||||||
|
tag_name: js/automerge-${{ needs.check_if_js_version_upgraded.outputs.js_version }}
|
||||||
|
target_commitish: js_tmp_branch
|
||||||
|
generate_release_notes: false
|
||||||
|
draft: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Remove js_tmp_branch
|
||||||
|
run: git push origin :js_tmp_branch
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/.direnv
|
||||||
|
perf.*
|
||||||
|
/Cargo.lock
|
||||||
|
build/
|
||||||
|
.vim/*
|
||||||
|
/target
|
19
LICENSE
Normal file
19
LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2019-2021 the Automerge contributors
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
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.
|
147
README.md
Normal file
147
README.md
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
# Automerge
|
||||||
|
|
||||||
|
<img src='./img/sign.svg' width='500' alt='Automerge logo' />
|
||||||
|
|
||||||
|
[![homepage](https://img.shields.io/badge/homepage-published-informational)](https://automerge.org/)
|
||||||
|
[![main docs](https://img.shields.io/badge/docs-main-informational)](https://automerge.org/automerge-rs/automerge/)
|
||||||
|
[![ci](https://github.com/automerge/automerge-rs/actions/workflows/ci.yaml/badge.svg)](https://github.com/automerge/automerge-rs/actions/workflows/ci.yaml)
|
||||||
|
[![docs](https://github.com/automerge/automerge-rs/actions/workflows/docs.yaml/badge.svg)](https://github.com/automerge/automerge-rs/actions/workflows/docs.yaml)
|
||||||
|
|
||||||
|
Automerge is a library which provides fast implementations of several different
|
||||||
|
CRDTs, a compact compression format for these CRDTs, and a sync protocol for
|
||||||
|
efficiently transmitting those changes over the network. The objective of the
|
||||||
|
project is to support [local-first](https://www.inkandswitch.com/local-first/) applications in the same way that relational
|
||||||
|
databases support server applications - by providing mechanisms for persistence
|
||||||
|
which allow application developers to avoid thinking about hard distributed
|
||||||
|
computing problems. Automerge aims to be PostgreSQL for your local-first app.
|
||||||
|
|
||||||
|
If you're looking for documentation on the JavaScript implementation take a look
|
||||||
|
at https://automerge.org/docs/hello/. There are other implementations in both
|
||||||
|
Rust and C, but they are earlier and don't have documentation yet. You can find
|
||||||
|
them in `rust/automerge` and `rust/automerge-c` if you are comfortable
|
||||||
|
reading the code and tests to figure out how to use them.
|
||||||
|
|
||||||
|
If you're familiar with CRDTs and interested in the design of Automerge in
|
||||||
|
particular take a look at https://automerge.org/docs/how-it-works/backend/
|
||||||
|
|
||||||
|
Finally, if you want to talk to us about this project please [join the
|
||||||
|
Slack](https://join.slack.com/t/automerge/shared_invite/zt-e4p3760n-kKh7r3KRH1YwwNfiZM8ktw)
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
This project is formed of a core Rust implementation which is exposed via FFI in
|
||||||
|
javascript+WASM, C, and soon other languages. Alex
|
||||||
|
([@alexjg](https://github.com/alexjg/)]) is working full time on maintaining
|
||||||
|
automerge, other members of Ink and Switch are also contributing time and there
|
||||||
|
are several other maintainers. The focus is currently on shipping the new JS
|
||||||
|
package. We expect to be iterating the API and adding new features over the next
|
||||||
|
six months so there will likely be several major version bumps in all packages
|
||||||
|
in that time.
|
||||||
|
|
||||||
|
In general we try and respect semver.
|
||||||
|
|
||||||
|
### JavaScript
|
||||||
|
|
||||||
|
A stable release of the javascript package is currently available as
|
||||||
|
`@automerge/automerge@2.0.0` where. pre-release verisions of the `2.0.1` are
|
||||||
|
available as `2.0.1-alpha.n`. `2.0.1*` packages are also available for Deno at
|
||||||
|
https://deno.land/x/automerge
|
||||||
|
|
||||||
|
### Rust
|
||||||
|
|
||||||
|
The rust codebase is currently oriented around producing a performant backend
|
||||||
|
for the Javascript wrapper and as such the API for Rust code is low level and
|
||||||
|
not well documented. We will be returning to this over the next few months but
|
||||||
|
for now you will need to be comfortable reading the tests and asking questions
|
||||||
|
to figure out how to use it. If you are looking to build rust applications which
|
||||||
|
use automerge you may want to look into
|
||||||
|
[autosurgeon](https://github.com/alexjg/autosurgeon)
|
||||||
|
|
||||||
|
## Repository Organisation
|
||||||
|
|
||||||
|
- `./rust` - the rust rust implementation and also the Rust components of
|
||||||
|
platform specific wrappers (e.g. `automerge-wasm` for the WASM API or
|
||||||
|
`automerge-c` for the C FFI bindings)
|
||||||
|
- `./javascript` - The javascript library which uses `automerge-wasm`
|
||||||
|
internally but presents a more idiomatic javascript interface
|
||||||
|
- `./scripts` - scripts which are useful to maintenance of the repository.
|
||||||
|
This includes the scripts which are run in CI.
|
||||||
|
- `./img` - static assets for use in `.md` files
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build this codebase you will need:
|
||||||
|
|
||||||
|
- `rust`
|
||||||
|
- `node`
|
||||||
|
- `yarn`
|
||||||
|
- `cmake`
|
||||||
|
- `cmocka`
|
||||||
|
|
||||||
|
You will also need to install the following with `cargo install`
|
||||||
|
|
||||||
|
- `wasm-bindgen-cli`
|
||||||
|
- `wasm-opt`
|
||||||
|
- `cargo-deny`
|
||||||
|
|
||||||
|
And ensure you have added the `wasm32-unknown-unknown` target for rust cross-compilation.
|
||||||
|
|
||||||
|
The various subprojects (the rust code, the wrapper projects) have their own
|
||||||
|
build instructions, but to run the tests that will be run in CI you can run
|
||||||
|
`./scripts/ci/run`.
|
||||||
|
|
||||||
|
### For macOS
|
||||||
|
|
||||||
|
These instructions worked to build locally on macOS 13.1 (arm64) as of
|
||||||
|
Nov 29th 2022.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# clone the repo
|
||||||
|
git clone https://github.com/automerge/automerge-rs
|
||||||
|
cd automerge-rs
|
||||||
|
|
||||||
|
# install rustup
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
# install homebrew
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
|
||||||
|
# install cmake, node, cmocka
|
||||||
|
brew install cmake node cmocka
|
||||||
|
|
||||||
|
# install yarn
|
||||||
|
npm install --global yarn
|
||||||
|
|
||||||
|
# install javascript dependencies
|
||||||
|
yarn --cwd ./javascript
|
||||||
|
|
||||||
|
# install rust dependencies
|
||||||
|
cargo install wasm-bindgen-cli wasm-opt cargo-deny
|
||||||
|
|
||||||
|
# get nightly rust to produce optimized automerge-c builds
|
||||||
|
rustup toolchain install nightly
|
||||||
|
rustup component add rust-src --toolchain nightly
|
||||||
|
|
||||||
|
# add wasm target in addition to current architecture
|
||||||
|
rustup target add wasm32-unknown-unknown
|
||||||
|
|
||||||
|
# Run ci script
|
||||||
|
./scripts/ci/run
|
||||||
|
```
|
||||||
|
|
||||||
|
If your build fails to find `cmocka.h` you may need to teach it about homebrew's
|
||||||
|
installation location:
|
||||||
|
|
||||||
|
```
|
||||||
|
export CPATH=/opt/homebrew/include
|
||||||
|
export LIBRARY_PATH=/opt/homebrew/lib
|
||||||
|
./scripts/ci/run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please try and split your changes up into relatively independent commits which
|
||||||
|
change one subsystem at a time and add good commit messages which describe what
|
||||||
|
the change is and why you're making it (err on the side of longer commit
|
||||||
|
messages). `git blame` should give future maintainers a good idea of why
|
||||||
|
something is the way it is.
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.AutoCommitWithObs.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.AutoCommitWithObs.html">../../automerge/struct.AutoCommitWithObs.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.AutoCommitWithObs.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/type.AutoCommit.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/type.AutoCommit.html">../../automerge/type.AutoCommit.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/type.AutoCommit.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/enum.OnPartialLoad.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/enum.OnPartialLoad.html">../../automerge/enum.OnPartialLoad.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/enum.OnPartialLoad.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.Automerge.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.Automerge.html">../../automerge/struct.Automerge.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.Automerge.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.AutoSerde.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.AutoSerde.html">../../automerge/struct.AutoSerde.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.AutoSerde.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/enum.LoadChangeError.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/enum.LoadChangeError.html">../../automerge/enum.LoadChangeError.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/enum.LoadChangeError.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.Change.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.Change.html">../../automerge/struct.Change.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.Change.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,3 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The object ID for the root map of a document"><meta name="keywords" content="rust, rustlang, rust-lang, ROOT"><title>ROOT in automerge - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In automerge</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Constant <a href="index.html">automerge</a>::<wbr><a class="constant" href="#">ROOT</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/automerge/lib.rs.html#301">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust"><code>pub const ROOT: <a class="enum" href="enum.ObjId.html" title="enum automerge::ObjId">ObjId</a>;</code></pre></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The object ID for the root map of a document</p>
|
|
||||||
</div></details></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/enum.AutomergeError.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/enum.AutomergeError.html">../../automerge/enum.AutomergeError.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/enum.AutomergeError.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.InvalidActorId.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.InvalidActorId.html">../../automerge/struct.InvalidActorId.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.InvalidActorId.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.InvalidChangeHashSlice.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.InvalidChangeHashSlice.html">../../automerge/struct.InvalidChangeHashSlice.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.InvalidChangeHashSlice.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/enum.ObjId.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/enum.ObjId.html">../../automerge/enum.ObjId.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/enum.ObjId.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/enum.ObjIdFromBytesError.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/enum.ObjIdFromBytesError.html">../../automerge/enum.ObjIdFromBytesError.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/enum.ObjIdFromBytesError.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.Keys.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.Keys.html">../../automerge/struct.Keys.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.Keys.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.KeysAt.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.KeysAt.html">../../automerge/struct.KeysAt.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.KeysAt.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.ExpandedChange.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.ExpandedChange.html">../../automerge/struct.ExpandedChange.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.ExpandedChange.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.ListRange.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.ListRange.html">../../automerge/struct.ListRange.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.ListRange.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.ListRangeAt.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.ListRangeAt.html">../../automerge/struct.ListRangeAt.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.ListRangeAt.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.MapRange.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.MapRange.html">../../automerge/struct.MapRange.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.MapRange.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.MapRangeAt.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.MapRangeAt.html">../../automerge/struct.MapRangeAt.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.MapRangeAt.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/op_observer/fn.compose.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/op_observer/fn.compose.html">../../../automerge/op_observer/fn.compose.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/op_observer/fn.compose.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `compose` fn in crate `automerge`."><meta name="keywords" content="rust, rustlang, rust-lang, compose"><title>compose in automerge::op_observer - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In automerge::op_observer</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../index.html">automerge</a>::<wbr><a href="index.html">op_observer</a>::<wbr><a class="fn" href="#">compose</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/op_observer/compose.rs.html#3-8">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust"><code>pub fn compose<'a, O1: <a class="trait" href="trait.OpObserver.html" title="trait automerge::op_observer::OpObserver">OpObserver</a>, O2: <a class="trait" href="trait.OpObserver.html" title="trait automerge::op_observer::OpObserver">OpObserver</a>>(<br> obs1: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&'a mut </a>O1,<br> obs2: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&'a mut </a>O2<br>) -> impl <a class="trait" href="trait.OpObserver.html" title="trait automerge::op_observer::OpObserver">OpObserver</a> + 'a</code></pre></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
|
@ -1,2 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `op_observer` mod in crate `automerge`."><meta name="keywords" content="rust, rustlang, rust-lang, op_observer"><title>automerge::op_observer - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2 class="location"><a href="#">Module op_observer</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">automerge</a>::<wbr><a class="mod" href="#">op_observer</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/op_observer.rs.html#1-392">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.VecOpObserver.html" title="automerge::op_observer::VecOpObserver struct">VecOpObserver</a></div><div class="item-right docblock-short">Capture operations into a <a href="https://doc.rust-lang.org/1.68.0/alloc/vec/struct.Vec.html" title="Vec"><code>Vec</code></a> and store them as patches.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Patch.html" title="automerge::op_observer::Patch enum">Patch</a></div><div class="item-right docblock-short">A notification to the application that something has changed in a document.</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.BranchableObserver.html" title="automerge::op_observer::BranchableObserver trait">BranchableObserver</a></div><div class="item-right docblock-short">An observer which can be branched</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.OpObserver.html" title="automerge::op_observer::OpObserver trait">OpObserver</a></div><div class="item-right docblock-short">An observer of operations applied to the document.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.compose.html" title="automerge::op_observer::compose fn">compose</a></div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
|
@ -1 +0,0 @@
|
||||||
window.SIDEBAR_ITEMS = {"enum":[["Patch","A notification to the application that something has changed in a document."]],"fn":[["compose",""]],"struct":[["VecOpObserver","Capture operations into a [`Vec`] and store them as patches."]],"trait":[["BranchableObserver","An observer which can be branched"],["OpObserver","An observer of operations applied to the document."]]};
|
|
File diff suppressed because one or more lines are too long
|
@ -1,17 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An observer which can be branched"><meta name="keywords" content="rust, rustlang, rust-lang, BranchableObserver"><title>BranchableObserver in automerge::op_observer - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2 class="location"><a href="#">BranchableObserver</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.branch">branch</a></li><li><a href="#tymethod.merge">merge</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-BranchableObserver-for-()">()</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In automerge::op_observer</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">automerge</a>::<wbr><a href="index.html">op_observer</a>::<wbr><a class="trait" href="#">BranchableObserver</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/op_observer.rs.html#127-140">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust"><code>pub trait BranchableObserver {
|
|
||||||
fn <a href="#tymethod.branch" class="fn">branch</a>(&self) -> Self;
|
|
||||||
<span class="item-spacer"></span> fn <a href="#tymethod.merge" class="fn">merge</a>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&</a>Self);
|
|
||||||
}</code></pre></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An observer which can be branched</p>
|
|
||||||
<p>This is used when observing operations in a transaction. In this case <code>branch</code> will be called
|
|
||||||
at the beginning of the transaction to return a new observer and then <code>merge</code> will be called
|
|
||||||
with the branched observer as <code>other</code> when the transaction is comitted.</p>
|
|
||||||
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.branch" class="method has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#132">source</a><h4 class="code-header">fn <a href="#tymethod.branch" class="fn">branch</a>(&self) -> Self</h4></section></summary><div class="docblock"><p>Branch of a new op_observer later to be merged</p>
|
|
||||||
<p>Called when creating a new transaction. Observer branch will be merged on <code>commit()</code> or
|
|
||||||
thrown away on <code>rollback()</code></p>
|
|
||||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.merge" class="method has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#139">source</a><h4 class="code-header">fn <a href="#tymethod.merge" class="fn">merge</a>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&</a>Self)</h4></section></summary><div class="docblock"><p>Merge observed information from a transaction.</p>
|
|
||||||
<p>Called by AutoCommit on <code>commit()</code></p>
|
|
||||||
<ul>
|
|
||||||
<li><code>other</code>: Another Op Observer of the same type</li>
|
|
||||||
</ul>
|
|
||||||
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-BranchableObserver-for-()" class="impl has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#188-191">source</a><a href="#impl-BranchableObserver-for-()" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.BranchableObserver.html" title="trait automerge::op_observer::BranchableObserver">BranchableObserver</a> for <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.unit.html">()</a></h3></section></summary><div class="impl-items"><section id="method.merge" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#189">source</a><a href="#method.merge" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.merge" class="fn">merge</a>(&mut self, _other: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&</a>Self)</h4></section><section id="method.branch" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#190">source</a><a href="#method.branch" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.branch" class="fn">branch</a>(&self) -> Self</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-BranchableObserver-for-VecOpObserver" class="impl has-srclink"><a class="srclink rightside" href="../../src/automerge/op_observer.rs.html#308-316">source</a><a href="#impl-BranchableObserver-for-VecOpObserver" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.BranchableObserver.html" title="trait automerge::op_observer::BranchableObserver">BranchableObserver</a> for <a class="struct" href="struct.VecOpObserver.html" title="struct automerge::op_observer::VecOpObserver">VecOpObserver</a></h3></section></div><script src="../../implementors/automerge/op_observer/trait.BranchableObserver.js" data-ignore-extern-crates="std" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.Parent.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.Parent.html">../../automerge/struct.Parent.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.Parent.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/struct.Parents.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/struct.Parents.html">../../automerge/struct.Parents.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/struct.Parents.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../automerge/trait.ReadDoc.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../automerge/trait.ReadDoc.html">../../automerge/trait.ReadDoc.html</a>...</p>
|
|
||||||
<script>location.replace("../../automerge/trait.ReadDoc.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
window.SIDEBAR_ITEMS = {"constant":[["ROOT","The object ID for the root map of a document"]],"enum":[["AutomergeError",""],["LoadChangeError",""],["ObjId","An identifier for an object in a document"],["ObjIdFromBytesError",""],["ObjType","The type of an object"],["OnPartialLoad","What to do when loading a document partially succeeds"],["OpType",""],["ParseChangeHashError",""],["Prop","A property of an object"],["ScalarValue","A value which is not a composite value"],["TextEncoding","How indexes into text sequeces are calculated"],["Value","The type of values in an automerge document"]],"mod":[["op_observer",""],["sync","Sync Protocol"],["transaction",""]],"struct":[["ActorId","An actor id is a sequence of bytes. By default we use a uuid which can be nicely stack allocated."],["AutoCommitWithObs","An automerge document that automatically manages transactions."],["AutoSerde","A wrapper type which implements [`serde::Serialize`] for a [`ReadDoc`]."],["Automerge","An automerge document which does not manage transactions for you."],["Change",""],["ChangeHash","The sha256 hash of a change."],["ExpandedChange","A change represents a group of operations performed by an actor."],["InvalidActorId",""],["InvalidChangeHashSlice",""],["Keys","An iterator over the keys of an object"],["KeysAt","An iterator over the keys of an object at a particular point in history"],["ListRange","An iterator over the elements of a list object"],["ListRangeAt","An iterator over the elements of a list object at a particular set of heads"],["MapRange","An iterator over the keys and values of a map object"],["MapRangeAt","An iterator over the keys and values of a map object as at a particuar heads"],["Parent","A component of a path to an object"],["Parents","An iterator over the “parents” of an object"],["Values","An iterator over the values in an object"]],"trait":[["ReadDoc","Methods for reading values from an automerge document"]],"type":[["AutoCommit","An autocommit document with no observer"]]};
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/sync/struct.BloomFilter.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/sync/struct.BloomFilter.html">../../../automerge/sync/struct.BloomFilter.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/sync/struct.BloomFilter.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/sync/struct.DecodeBloomError.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/sync/struct.DecodeBloomError.html">../../../automerge/sync/struct.DecodeBloomError.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/sync/struct.DecodeBloomError.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,64 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Sync Protocol"><meta name="keywords" content="rust, rustlang, rust-lang, sync"><title>automerge::sync - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2 class="location"><a href="#">Module sync</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">automerge</a>::<wbr><a class="mod" href="#">sync</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/sync.rs.html#1-963">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="sync-protocol"><a href="#sync-protocol">Sync Protocol</a></h2>
|
|
||||||
<p>The sync protocol is based on this paper:
|
|
||||||
<a href="https://arxiv.org/abs/2012.00472">https://arxiv.org/abs/2012.00472</a>, it assumes a reliable in-order stream
|
|
||||||
between two peers who are synchronizing a document.</p>
|
|
||||||
<p>Each peer maintains a <a href="struct.State.html" title="State"><code>State</code></a> for each peer they are synchronizing with.
|
|
||||||
This state tracks things like what the heads of the other peer are and
|
|
||||||
whether there are in-flight messages. Anything which implements <a href="trait.SyncDoc.html" title="SyncDoc"><code>SyncDoc</code></a>
|
|
||||||
can take part in the sync protocol. The flow goes something like this:</p>
|
|
||||||
<ul>
|
|
||||||
<li>The initiating peer creates an empty <a href="struct.State.html" title="State"><code>State</code></a> and then calls
|
|
||||||
<a href="trait.SyncDoc.html#tymethod.generate_sync_message" title="SyncDoc::generate_sync_message"><code>SyncDoc::generate_sync_message</code></a> to generate new sync message and sends
|
|
||||||
it to the receiving peer.</li>
|
|
||||||
<li>The receiving peer receives a message from the initiator, creates a new
|
|
||||||
<a href="struct.State.html" title="State"><code>State</code></a>, and calls <a href="trait.SyncDoc.html#tymethod.receive_sync_message" title="SyncDoc::receive_sync_message"><code>SyncDoc::receive_sync_message</code></a> on it’s view of the
|
|
||||||
document</li>
|
|
||||||
<li>The receiving peer then calls <a href="trait.SyncDoc.html#tymethod.generate_sync_message" title="SyncDoc::generate_sync_message"><code>SyncDoc::generate_sync_message</code></a> to generate
|
|
||||||
a new sync message and send it back to the initiator</li>
|
|
||||||
<li>From this point on each peer operates in a loop, receiving a sync message
|
|
||||||
from the other peer and then generating a new message to send back.</li>
|
|
||||||
</ul>
|
|
||||||
<h3 id="example"><a href="#example">Example</a></h3>
|
|
||||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>automerge::{transaction::Transactable, sync::{<span class="self">self</span>, SyncDoc}, ReadDoc};
|
|
||||||
<span class="comment">// Create a document on peer1
|
|
||||||
</span><span class="kw">let </span><span class="kw-2">mut </span>peer1 = automerge::AutoCommit::new();
|
|
||||||
peer1.put(automerge::ROOT, <span class="string">"key"</span>, <span class="string">"value"</span>)<span class="question-mark">?</span>;
|
|
||||||
|
|
||||||
<span class="comment">// Create a state to track our sync with peer2
|
|
||||||
</span><span class="kw">let </span><span class="kw-2">mut </span>peer1_state = sync::State::new();
|
|
||||||
<span class="comment">// Generate the initial message to send to peer2, unwrap for brevity
|
|
||||||
</span><span class="kw">let </span>message1to2 = peer1.sync().generate_sync_message(<span class="kw-2">&mut </span>peer1_state).unwrap();
|
|
||||||
|
|
||||||
<span class="comment">// We receive the message on peer2. We don't have a document at all yet
|
|
||||||
// so we create one
|
|
||||||
</span><span class="kw">let </span><span class="kw-2">mut </span>peer2 = automerge::AutoCommit::new();
|
|
||||||
<span class="comment">// We don't have a state for peer1 (it's a new connection), so we create one
|
|
||||||
</span><span class="kw">let </span><span class="kw-2">mut </span>peer2_state = sync::State::new();
|
|
||||||
<span class="comment">// Now receive the message from peer 1
|
|
||||||
</span>peer2.sync().receive_sync_message(<span class="kw-2">&mut </span>peer2_state, message1to2)<span class="question-mark">?</span>;
|
|
||||||
|
|
||||||
<span class="comment">// Now we loop, sending messages from one to two and two to one until
|
|
||||||
// neither has anything new to send
|
|
||||||
|
|
||||||
</span><span class="kw">loop </span>{
|
|
||||||
<span class="kw">let </span>two_to_one = peer2.sync().generate_sync_message(<span class="kw-2">&mut </span>peer2_state);
|
|
||||||
<span class="kw">if let </span><span class="prelude-val">Some</span>(message) = two_to_one.as_ref() {
|
|
||||||
<span class="macro">println!</span>(<span class="string">"two to one"</span>);
|
|
||||||
peer1.sync().receive_sync_message(<span class="kw-2">&mut </span>peer1_state, message.clone())<span class="question-mark">?</span>;
|
|
||||||
}
|
|
||||||
<span class="kw">let </span>one_to_two = peer1.sync().generate_sync_message(<span class="kw-2">&mut </span>peer1_state);
|
|
||||||
<span class="kw">if let </span><span class="prelude-val">Some</span>(message) = one_to_two.as_ref() {
|
|
||||||
<span class="macro">println!</span>(<span class="string">"one to two"</span>);
|
|
||||||
peer2.sync().receive_sync_message(<span class="kw-2">&mut </span>peer2_state, message.clone())<span class="question-mark">?</span>;
|
|
||||||
}
|
|
||||||
<span class="kw">if </span>two_to_one.is_none() && one_to_two.is_none() {
|
|
||||||
<span class="kw">break</span>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<span class="macro">assert_eq!</span>(peer2.get(automerge::ROOT, <span class="string">"key"</span>)<span class="question-mark">?</span>.unwrap().<span class="number">0</span>.to_str(), <span class="prelude-val">Some</span>(<span class="string">"value"</span>));
|
|
||||||
</code></pre></div>
|
|
||||||
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BloomFilter.html" title="automerge::sync::BloomFilter struct">BloomFilter</a></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DecodeBloomError.html" title="automerge::sync::DecodeBloomError struct">DecodeBloomError</a></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Have.html" title="automerge::sync::Have struct">Have</a></div><div class="item-right docblock-short">A summary of the changes that the sender of the message already has.
|
|
||||||
This is implicitly a request to the recipient to send all changes that the
|
|
||||||
sender does not already have.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Message.html" title="automerge::sync::Message struct">Message</a></div><div class="item-right docblock-short">The sync message to be sent.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.State.html" title="automerge::sync::State struct">State</a></div><div class="item-right docblock-short">The state of synchronisation with a peer.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.DecodeStateError.html" title="automerge::sync::DecodeStateError enum">DecodeStateError</a></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ReadMessageError.html" title="automerge::sync::ReadMessageError enum">ReadMessageError</a></div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SyncDoc.html" title="automerge::sync::SyncDoc trait">SyncDoc</a></div><div class="item-right docblock-short">A document which can take part in the sync protocol</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
|
@ -1 +0,0 @@
|
||||||
window.SIDEBAR_ITEMS = {"enum":[["DecodeStateError",""],["ReadMessageError",""]],"struct":[["BloomFilter",""],["DecodeBloomError",""],["Have","A summary of the changes that the sender of the message already has. This is implicitly a request to the recipient to send all changes that the sender does not already have."],["Message","The sync message to be sent."],["State","The state of synchronisation with a peer."]],"trait":[["SyncDoc","A document which can take part in the sync protocol"]]};
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/sync/enum.DecodeStateError.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/sync/enum.DecodeStateError.html">../../../automerge/sync/enum.DecodeStateError.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/sync/enum.DecodeStateError.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/sync/struct.Have.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/sync/struct.Have.html">../../../automerge/sync/struct.Have.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/sync/struct.Have.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/sync/struct.State.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/sync/struct.State.html">../../../automerge/sync/struct.State.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/sync/struct.State.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,15 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A document which can take part in the sync protocol"><meta name="keywords" content="rust, rustlang, rust-lang, SyncDoc"><title>SyncDoc in automerge::sync - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2 class="location"><a href="#">SyncDoc</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.generate_sync_message">generate_sync_message</a></li><li><a href="#tymethod.receive_sync_message">receive_sync_message</a></li><li><a href="#tymethod.receive_sync_message_with">receive_sync_message_with</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In automerge::sync</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">automerge</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="trait" href="#">SyncDoc</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/sync.rs.html#89-112">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><div class="item-decl"><pre class="rust"><code>pub trait SyncDoc {
|
|
||||||
fn <a href="#tymethod.generate_sync_message" class="fn">generate_sync_message</a>(&self, sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a>>;
|
|
||||||
<span class="item-spacer"></span> fn <a href="#tymethod.receive_sync_message" class="fn">receive_sync_message</a>(<br> &mut self,<br> sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>,<br> message: <a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a><br> ) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.unit.html">()</a>, <a class="enum" href="../enum.AutomergeError.html" title="enum automerge::AutomergeError">AutomergeError</a>>;
|
|
||||||
<span class="item-spacer"></span> fn <a href="#tymethod.receive_sync_message_with" class="fn">receive_sync_message_with</a><Obs: <a class="trait" href="../op_observer/trait.OpObserver.html" title="trait automerge::op_observer::OpObserver">OpObserver</a>>(<br> &mut self,<br> sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>,<br> message: <a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a>,<br> op_observer: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&mut </a>Obs<br> ) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.unit.html">()</a>, <a class="enum" href="../enum.AutomergeError.html" title="enum automerge::AutomergeError">AutomergeError</a>>;
|
|
||||||
}</code></pre></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A document which can take part in the sync protocol</p>
|
|
||||||
<p>See the <a href="index.html">module level documentation</a> for more details.</p>
|
|
||||||
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.generate_sync_message" class="method has-srclink"><a class="srclink rightside" href="../../src/automerge/sync.rs.html#95">source</a><h4 class="code-header">fn <a href="#tymethod.generate_sync_message" class="fn">generate_sync_message</a>(&self, sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a>></h4></section></summary><div class="docblock"><p>Generate a sync message for the remote peer represented by <code>sync_state</code></p>
|
|
||||||
<p>If this returns <code>None</code> then there are no new messages to send, either because we are
|
|
||||||
waiting for an acknolwedgement of an in-flight message, or because the remote is up to
|
|
||||||
date.</p>
|
|
||||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.receive_sync_message" class="method has-srclink"><a class="srclink rightside" href="../../src/automerge/sync.rs.html#98-102">source</a><h4 class="code-header">fn <a href="#tymethod.receive_sync_message" class="fn">receive_sync_message</a>(<br> &mut self,<br> sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>,<br> message: <a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.unit.html">()</a>, <a class="enum" href="../enum.AutomergeError.html" title="enum automerge::AutomergeError">AutomergeError</a>></h4></section></summary><div class="docblock"><p>Apply a received sync message to this document and <code>sync_state</code></p>
|
|
||||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.receive_sync_message_with" class="method has-srclink"><a class="srclink rightside" href="../../src/automerge/sync.rs.html#106-111">source</a><h4 class="code-header">fn <a href="#tymethod.receive_sync_message_with" class="fn">receive_sync_message_with</a><Obs: <a class="trait" href="../op_observer/trait.OpObserver.html" title="trait automerge::op_observer::OpObserver">OpObserver</a>>(<br> &mut self,<br> sync_state: &mut <a class="struct" href="struct.State.html" title="struct automerge::sync::State">State</a>,<br> message: <a class="struct" href="struct.Message.html" title="struct automerge::sync::Message">Message</a>,<br> op_observer: <a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.reference.html">&mut </a>Obs<br>) -> <a class="enum" href="https://doc.rust-lang.org/1.68.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.68.0/std/primitive.unit.html">()</a>, <a class="enum" href="../enum.AutomergeError.html" title="enum automerge::AutomergeError">AutomergeError</a>></h4></section></summary><div class="docblock"><p>Apply a received sync message to this document and <code>sync_state</code>, observing any changes with
|
|
||||||
<code>op_observer</code></p>
|
|
||||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-SyncDoc-for-Automerge" class="impl has-srclink"><a class="srclink rightside" href="../../src/automerge/sync.rs.html#116-222">source</a><a href="#impl-SyncDoc-for-Automerge" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SyncDoc.html" title="trait automerge::sync::SyncDoc">SyncDoc</a> for <a class="struct" href="../struct.Automerge.html" title="struct automerge::Automerge">Automerge</a></h3></section></div><script src="../../implementors/automerge/sync/trait.SyncDoc.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.CommitOptions.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.CommitOptions.html">../../../automerge/transaction/struct.CommitOptions.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.CommitOptions.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `transaction` mod in crate `automerge`."><meta name="keywords" content="rust, rustlang, rust-lang, transaction"><title>automerge::transaction - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-93196c7a1c3542a8.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/main-3367e395607fafc1.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../automerge/index.html"><img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../automerge/index.html">
|
|
||||||
<img src="https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg" alt="logo"></a><h2 class="location"><a href="#">Module transaction</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">automerge</a>::<wbr><a class="mod" href="#">transaction</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/automerge/transaction.rs.html#1-16">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CommitOptions.html" title="automerge::transaction::CommitOptions struct">CommitOptions</a></div><div class="item-right docblock-short">Optional metadata for a commit.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Failure.html" title="automerge::transaction::Failure struct">Failure</a></div><div class="item-right docblock-short">The result of a failed, and rolled back, transaction.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Observed.html" title="automerge::transaction::Observed struct">Observed</a></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Success.html" title="automerge::transaction::Success struct">Success</a></div><div class="item-right docblock-short">The result of a successful, and committed, transaction.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Transaction.html" title="automerge::transaction::Transaction struct">Transaction</a></div><div class="item-right docblock-short">A transaction on a document.
|
|
||||||
Transactions group operations into a single change so that no other operations can happen
|
|
||||||
in-between.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.UnObserved.html" title="automerge::transaction::UnObserved struct">UnObserved</a></div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Observation.html" title="automerge::transaction::Observation trait">Observation</a></div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Transactable.html" title="automerge::transaction::Transactable trait">Transactable</a></div><div class="item-right docblock-short">A way of mutating a document within a single change.</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Result.html" title="automerge::transaction::Result type">Result</a></div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="automerge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0 (2c8cc3432 2023-03-06)" data-search-js="search-98d53477a794af0b.js" data-settings-js="settings-c3c521c753752a1a.js" data-settings-css="settings-08ddfdda51b8ee2e.css" ></div></body></html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.Transaction.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.Transaction.html">../../../automerge/transaction/struct.Transaction.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.Transaction.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.Observed.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.Observed.html">../../../automerge/transaction/struct.Observed.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.Observed.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.UnObserved.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.UnObserved.html">../../../automerge/transaction/struct.UnObserved.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.UnObserved.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/trait.Observation.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/trait.Observation.html">../../../automerge/transaction/trait.Observation.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/trait.Observation.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.Failure.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.Failure.html">../../../automerge/transaction/struct.Failure.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.Failure.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0;URL=../../../automerge/transaction/struct.Success.html">
|
|
||||||
<title>Redirection</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Redirecting to <a href="../../../automerge/transaction/struct.Success.html">../../../automerge/transaction/struct.Success.html</a>...</p>
|
|
||||||
<script>location.replace("../../../automerge/transaction/struct.Success.html" + location.search + location.hash);</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
window.SIDEBAR_ITEMS = {"struct":[["CommitOptions","Optional metadata for a commit."],["Failure","The result of a failed, and rolled back, transaction."],["Observed",""],["Success","The result of a successful, and committed, transaction."],["Transaction","A transaction on a document. Transactions group operations into a single change so that no other operations can happen in-between."],["UnObserved",""]],"trait":[["Observation",""],["Transactable","A way of mutating a document within a single change."]],"type":[["Result",""]]};
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue