-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pr for demo alternate store #7521
Conversation
This is the very barebones beginnings of a demo implementation of an alternate tiddler store. It is not functional. If using the Vercel builds, open developer tools in the browser to see it failing due to the absence of basic wiki methods. The plan is to build it up into the smallest possible plain JS wiki store implementation, sharing as much implementation as possible with the existing core implementation with as little code duplication as possible. It could then serve as the basis for future experiments with wiki stores based on SQLite (@linonetwo), or a custom append only database (@yaisog).
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@joshuafontany you may need to rebase the PR, currently it is shown a lot of unrelated commits which makes it difficult to review. |
Thanks @saq. That helps, as now the demo code is clearly readable. |
What's the purpose of this PR? |
I know, but what's the purpose of this implementation. Is it just an experiment? |
We do not have an existing working implementation of an alternate store and this furthers the so far incomplete work in #7329. Yes, this might be more suitable as a draft PR at this time. However I would hope that we could endeavour to request clarification on such things in a manner that would be less prone to coming across as hostile to contributors. |
It is meant as a question. I wanted to get more information about the plugin. That's it. No pun intended. |
Hi @pmario @saqimtiaz. Thanks for clarifying. Yes, this has taken the changes that @Jermolene made in his PR in |
Thank you @joshuafontany this is exactly what I was planning to do in #7329 before I got distracted. Could you retarget this PR to target the branch for #7329? I think that would make the history easier to follow. |
By the way @joshuafontany would you be interested in working on an SQLite implementation? It was that idea that triggered #7329. |
Latest prerelease of TidGi https://github.com/tiddly-gittly/TidGi-Desktop/releases/tag/v0.8.0-prerelease11 has a better-sqlite3 instance at And there is a predefined table https://github.com/tiddly-gittly/TidGi-Desktop/blob/5651ea70c6301bbabacf45126b84a60b630b3a4b/src/services/database/index.ts#L47-L59 CREATE TABLE IF NOT EXISTS tiddlers (
title TEXT PRIMARY KEY,
text TEXT,
type TEXT,
created INTEGER,
modified INTEGER,
tags TEXT,
fields TEXT,
creator TEXT,
modifier TEXT
); You can try this from wiki frontent using zx script https://talk.tiddlywiki.org/t/interactive-code-executing-in-tiddlygit-like-ipython-notebook/780 Usage is like // pure nodejs context
console.log(`## Hi!`);
let aaa = 3;
/** tw */
// now in worker_thread with $tw wiki access
let filterExample = $tw.wiki.filterOperators.sum((callback) => {callback({}, String(aaa));callback({}, String(aaa))})
console.log(filterExample)
// use Sqlite
const db = $tw.utils.Sqlite
const stmt = db.prepare('SELECT title, text FROM tiddlers');
const result = stmt.pluck().all()
console.log(result) click this icon to execute zx script See |
|
||
(function() { | ||
|
||
// Need to initialise these because we run before bootprefix.js and boot.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do these in bootprefix.js or boot.js, seems you init them but not used.
} | ||
} | ||
}, | ||
hop = function(object,property) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we redefining too many things? I thought we just need to define some hooks to do "hydration"
}; | ||
|
||
// Add a tiddler to the store | ||
this.addTiddler = function(tiddler) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we only need to define these fuctions in the plugin?
Hi @joshuafontany – are you in a position to be able to retarget this PR to the branch |
And make the demo storage areas switchable @joshuafontany's implementation was in #7521
Hi @joshuafontany I hope you don't mind, but I've merged your updated plain JS wiki implementation in 1d0b928 |
Not sure if I should have merged main into demo-alternate-store before working, but this is the result.
The actual changes are in:
plugins/tiddlywiki/demo-alternate-store/rawmarkup.js
I just pulled the bare minimum functions from boot.js into here to test. serves tw5.com-server and can write tiddlers back to disk, but many of the tests in ./bin/test.sh are failing (not sure why atm).
Mahalo (thanks) for starting this.