Skip to content

Commit

Permalink
Merge pull request #272 from perspect3vism/release-0.2.16
Browse files Browse the repository at this point in the history
Release 0.2.16
  • Loading branch information
lucksus authored Feb 26, 2023
2 parents 7693340 + 8780804 commit 25f37a1
Show file tree
Hide file tree
Showing 19 changed files with 133 additions and 38 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ This project _loosely_ adheres to [Semantic Versioning](https://semver.org/spec/

### Fixed

## [0.2.16] - 25/02/2013
### Added

### Changed
- Main LinkLanguage (Perspective Diff Sync) refactored to replace global/objective latest-revision with a simple gossip algorithm, where agents broadcast their revision and merge in revision of others as they are gossiped. Improves speed and resilience a lot. [PR#12 in PDiff-Sync](https://github.com/perspect3vism/perspective-diff-sync/pull/12) [PR#271](https://github.com/perspect3vism/ad4m/pull/271)

### Deprecated

### Removed

### Fixed
- Perspective Diff Sync: calculation of fast_forward_possible fixed, which prevents merge-loops (PR#13)[https://github.com/perspect3vism/perspective-diff-sync/pull/13]

## [0.2.15] - 23/02/2013

### Added
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ad4m"
version = "0.2.15"
version = "0.2.16"
edition = "2021"
authors = ["Nicolas Luck <nicolas@perspect3vism.org>"]
description = "A command-line interface to AD4M (i.e. the AD4M executor) - https://ad4m.dev"
Expand All @@ -12,7 +12,7 @@ documentation = "https://docs.ad4m.dev"
readme = "README.md"

[dependencies]
ad4m-client = { path = "../rust-client", version = "0.2.15" }
ad4m-client = { path = "../rust-client", version = "0.2.16" }
anyhow = "1.0.65"
clap = { version = "4.0.8", features = ["derive"] }
futures = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion connect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perspect3vism/ad4m-connect",
"version": "0.2.15",
"version": "0.2.16",
"description": "Lib for handling everything needed to setup a connection to a local or remote ad4m-executor",
"license": "CAL-1.0",
"main": "dist/web.js",
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perspect3vism/ad4m",
"version": "0.2.15",
"version": "0.2.16",
"description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network",
"main": "lib/index.cjs",
"module": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion docs-src/book.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"title": "AD4M Documentation",
"author": "Nicolas Luck",
"variables": {
"ad4mVersion": "0.2.15"
"ad4mVersion": "0.2.16"
}
}
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perspect3vism/ad4m-executor",
"version": "0.2.15",
"version": "0.2.16",
"description": "Node.js package that allows the running/interfacing of AD4M Languages & Perspectives.",
"main": "lib/main.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion executor/scripts/get-builtin-test-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const languages = {
bundle: "https://github.com/perspect3vism/local-neighbourhood-persistence/releases/download/0.0.2/bundle.js",
},
"perspective-diff-sync": {
bundle: "https://github.com/perspect3vism/perspective-diff-sync/releases/download/v0.2.2-test/bundle.js",
bundle: "https://github.com/perspect3vism/perspective-diff-sync/releases/download/v0.3.1/bundle.js",
},
"note-ipfs": {
bundle: "https://github.com/perspect3vism/lang-note-ipfs/releases/download/0.0.4/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion executor/src/core/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import * as fs from 'fs';
import { Address, Expression } from '@perspect3vism/ad4m';

export let ad4mExecutorVersion = "0.2.15";
export let ad4mExecutorVersion = "0.2.16";
export let agentLanguageAlias = "did";
export let languageLanguageAlias = "lang";
export let neighbourhoodLanguageAlias = "neighbourhood";
Expand Down
118 changes: 100 additions & 18 deletions executor/src/core/Perspective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,29 @@ export default class Perspective {

if (this.neighbourhood) {
// setup polling loop for Perspectives with a linkLanguage
try {
this.getCurrentRevision().then(revision => {
// if revision is null, then we are not connected to the network yet, so we need to poll fast
if(!revision && this.createdFromJoin) {
this.isFastPolling = true;
this.updatePerspectiveState(PerspectiveState.LinkLanguageInstalledButNotSynced);
this.#pollingInterval = this.setupPolling(3000);
} else {
//Say that we are synced here since we dont have any interface on the link language for deeper gossip information
this.updatePerspectiveState(PerspectiveState.Synced);
this.#pollingInterval = this.setupPolling(30000);
}
})
} catch (e) {
console.error(`Perspective.constructor(): NH [${this.sharedUrl}] (${this.name}): Got error when trying to get current revision and setting polling loop: ${e}`);
this.setupSyncSingals(3000);
//this.setupFullRenderSync(20000);

// Handle join differently so we wait before publishing diffs until we have seen
// a first foreign revision. Otherwise we will never use snaphshots and make the
// diff graph complex.
if(this.createdFromJoin) {
try {
this.getCurrentRevision().then(revision => {
// if revision is null, then we are not connected to the network yet
// Set the state to LinkLanguageInstalledButNotSynced so we will keep
// link additions as pending until we are synced
if(!revision) {
this.setupPendingDiffsPublishing(5000);
} else {
this.updatePerspectiveState(PerspectiveState.Synced);
}
})
} catch (e) {
console.error(`Perspective.constructor(): NH [${this.sharedUrl}] (${this.name}): Got error when trying to get current revision: ${e}`);
}
} else {
this.updatePerspectiveState(PerspectiveState.Synced);
}
}

Expand All @@ -126,6 +134,80 @@ export default class Perspective {
}
}

async setupFullRenderSync(intervalMs: number) {
if(this.state === PerspectiveState.Synced) {
try {
await this.syncWithSharingAdapter();
} catch(e) {
console.error(`Perspective.setupFullRenderSync(): NH [${this.sharedUrl}] (${this.name}): Got error when trying to do full render sync with sharing adapter: ${e}`);
}
} else {
console.log(`Perspective.setupFullRenderSync(): NH [${this.sharedUrl}] (${this.name}): Omitting full render sync since perspective is not synced yet`);
}
await sleep(intervalMs);
this.setupFullRenderSync(intervalMs);
}

async setupSyncSingals(intervalMs: number) {
try {
await this.callLinksAdapter("pull"); // should rename this in the LinksAdapter interface to sync ...
} catch(e) {
console.error(`Perspective.setupSyncSingals(): NH [${this.sharedUrl}] (${this.name}): Got error when sending sync signals: ${e}`);
}
await sleep(intervalMs);
this.setupSyncSingals(intervalMs);
}

async setupPendingDiffsPublishing(intervalMs: number) {
let pendingGotPublished = false;
if(this.state == PerspectiveState.LinkLanguageFailedToInstall) {
try {
await this.getLinksAdapter()
} catch(e) {
console.error(`Perspective.setupPendingDiffsPublishing(): NH [${this.sharedUrl}] (${this.name}): Got error when trying to install link language: ${e}`);
}
}

try {
// If LinkLanguage is connected/synced (otherwise currentRevision would be null)...
if (await this.getCurrentRevision()) {
//TODO; once we have more data information coming from the link language, correctly determine when to mark perspective as synced
this.updatePerspectiveState(PerspectiveState.Synced);
//Let's check if we have unpublished diffs:
const mutations = this.#db.getPendingDiffs(this.uuid);
if(mutations && mutations.length > 0) {
// If we do, collect them...
const batchedMutations = {
additions: [],
removals: []
} as PerspectiveDiff
for(const mutation of mutations) {
for (const addition of mutation.additions) {
batchedMutations.additions.push(addition);
}
for (const removal of mutation.removals) {
batchedMutations.removals.push(removal);
}
}

// ...publish them...
await this.callLinksAdapter('commit', batchedMutations);
// ...and clear the temporary storage
this.#db.clearPendingDiffs(this.uuid)
pendingGotPublished = true;
}
}
} catch (e) {
console.warn(`Perspective.setupPendingDiffsPublishing(): NH [${this.sharedUrl}] (${this.name}): Got error when trying to repulish pending diffs. Error: ${e}`, e);
}

if(!pendingGotPublished) {
await sleep(intervalMs);
this.setupPendingDiffsPublishing(intervalMs);
}
}


setupPolling(intervalMs: number) {
return setInterval(
async () => {
Expand Down Expand Up @@ -381,9 +463,9 @@ export default class Perspective {
return undefined !== list.find(e =>
JSON.stringify(e.author) === JSON.stringify(link.author) &&
e.timestamp === link.timestamp &&
e.source === link.data.source &&
e.target === link.data.target &&
e.predicate === link.data.predicate
e.data.source === link.data.source &&
e.data.target === link.data.target &&
e.data.predicate === link.data.predicate
)
}
let linksToCommit = [];
Expand Down
2 changes: 1 addition & 1 deletion executor/src/tests/bootstrapSeed.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"trustedAgents":["did:key:zQ3shkkuZLvqeFgHdgZgFMUx8VGkgVWsLA83w2oekhZxoCW2n"],"knownLinkLanguages":["QmX6F3iY9X6e9Fy1tdvs4PSqyNmFUqcanMQ8jJjX8u5J8a"],"directMessageLanguage":"QmeHE28cVfSBkSrgwauTpmrb3jhchammCv658oQrP41FT9","agentLanguage":"QmZ16K5HG2RgE6Q8xCC5784HG2KGyKPKtkNmGiDb9YQKZg","perspectiveLanguage":"QmUTkvPcyaUGntqfzi3iR1xomADm5yYC2j8hcPdhMHpTem","neighbourhoodLanguage":"QmT4rtTuguhfiz88Ljxt6MDuKcn1TZBpfeWb5fXGqBwMdK","languageLanguageBundle":""}
{"trustedAgents":["did:key:zQ3shkkuZLvqeFgHdgZgFMUx8VGkgVWsLA83w2oekhZxoCW2n"],"knownLinkLanguages":["QmdR72zo5yCwnw6Ht9RjzbDPfN8sXBXhcRiBFwe3BF6JKG"],"directMessageLanguage":"QmeHE28cVfSBkSrgwauTpmrb3jhchammCv658oQrP41FT9","agentLanguage":"QmZ16K5HG2RgE6Q8xCC5784HG2KGyKPKtkNmGiDb9YQKZg","perspectiveLanguage":"QmUTkvPcyaUGntqfzi3iR1xomADm5yYC2j8hcPdhMHpTem","neighbourhoodLanguage":"QmT4rtTuguhfiz88Ljxt6MDuKcn1TZBpfeWb5fXGqBwMdK","languageLanguageBundle":""}
2 changes: 1 addition & 1 deletion host/mainnet_seed.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"did:key:zQ3sheV6m6sT83woZtVL2PHiz6J1qWRh4FWW2aiJvxy6d2o7S"
],
"knownLinkLanguages": [
"QmeYsEe3UnJXmvAPmnDGvfdjnsUH6hWPwV2rmxcdpeokA7"
"QmdR72zo5yCwnw6Ht9RjzbDPfN8sXBXhcRiBFwe3BF6JKG"
],
"directMessageLanguage": "QmXR4MZqxqdPmSnCNF24f82EkvahwgXW3FKzGWPZrdC8qb",
"agentLanguage": "QmR3gt6cjaSBPV3kiLQxeZtiuJT3ZMFLQ755DMpb8yMK2m",
Expand Down
2 changes: 1 addition & 1 deletion host/oldestSupportedVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.14
0.2.16
2 changes: 1 addition & 1 deletion host/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ad4m-host",
"version": "0.2.15",
"version": "0.2.16",
"description": "Self hosting ad4m service",
"private": true,
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ad4m-monorepo",
"version": "0.2.15",
"version": "0.2.16",
"workspaces": [
"core",
"docs",
Expand Down
2 changes: 1 addition & 1 deletion rust-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ad4m-client"
version = "0.2.15"
version = "0.2.16"
edition = "2021"
authors = ["Nicolas Luck <nicolas@perspect3vism.org>"]
description = "Client library wrapping AD4M's GraphQL interface"
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ad4m-launcher",
"version": "0.2.15",
"version": "0.2.16",
"private": true,
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion ui/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ad4m-launcher"
version = "0.2.15"
version = "0.2.16"
description = "Administration of ad4m services"
authors = ["Kaichao Sun"]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "AD4M",
"version": "0.2.15"
"version": "0.2.16"
},
"build": {
"distDir": "../dist",
Expand Down

0 comments on commit 25f37a1

Please sign in to comment.