What is the difference between bag and recipe?

83 views
Skip to first unread message

Tristan Kohl

unread,
Feb 18, 2018, 11:33:10 AM2/18/18
to TiddlyWikiDev
Hey guys,

as I have a little problem with my memory occupied by to many wikis, I started digging into the sync adaptors to write my own serving multiple wikis.

One thing I stumbled upon was there seems to be a "bag" field and a "recipe" for the tiddlyweb adaptor to rely on. I tried to get my head around this but failed to see what is the difference between those, as the bag-field seems only to be used when a tiddler should be deleted from the storage endpoint. Since I want to comply to the way TW handles the server backend and I do not have to rewrite so much stuff maybe someone can help me out here.

When a tiddler is stored or loaded a call is made to
URL/recipes/{recipe}/tiddlers/{title}

But when I delete a tiddler suddenly there is no recipe whatsoever but
URL/bags/{bag}/tiddlers/{title}

So my questions are:
  1. Why is there a difference? They both seem to do the same thing (set the target "server" for the tiddler).
  2. Who is setting this bag-field? The server just to show the tiddlyweb adaptor that it has seen it or the browser?


I did not find anything in the dev wiki about either of those fields so I am left with no clue.


Thanks in advance for any help,

Tristan

PMario

unread,
Feb 18, 2018, 12:15:20 PM2/18/18
to TiddlyWikiDev

Tristan Kohl

unread,
Feb 19, 2018, 2:14:25 AM2/19/18
to TiddlyWikiDev
Hello Mario,

thank you for the hint, seems like I was looking at the wrong place :)
It seems to be somewhat of a official documentation, is that the case?

Cheers,
Tristan

PMario

unread,
Feb 19, 2018, 10:04:31 AM2/19/18
to tiddly...@googlegroups.com
On Monday, February 19, 2018 at 8:14:25 AM UTC+1, Tristan Kohl wrote:
thank you for the hint, seems like I was looking at the wrong place :)

How should you know :)
 
It seems to be somewhat of a official documentation, is that the case?

Kind of. ... TiddlyWeb is a reference implementation for a tiddler based data store, where every resource is uniquely reachable with an URI.

It was used as the basis for tiddlyspace, which sadly was closed down early last year.

Recipes and bags are basically a "concept" to manage multiple tiddler stores ... aka bags

If a recipe contains several bags, the contained tiddlers are "stacked".
The further down in the list, the higher the priority.
So the last bag will overwrite tiddlers from bags above it.
This concept is very powerful.

Eg: Having a bag, that contains your standard plugins, which is included into all of your recipes.
So changing this bag will update all your recipes ....


As you can see, a recipe is a list of bags with filters. At tank.peermore.com you can get a list of all public recipes like this:

https://tank.peermore.com/recipes.txt
or
https://tank.peermore.com/recipes.json

There is a test-tw5 recipe, https://tank.peermore.com/recipes/test-tw5.txt that contains

desc: test tiddlywiki 5
policy: {"read": [], "create": [], "manage": ["pmario"], "accept": [], "write": [], "owner": "pmario", "delete": []}

and 2 bags.

/bags/tw5/tiddlers
/bags/test-tw5/tiddlers

--------------

The bag: test-tw5 can be seen with: https://tank.peermore.com/bags/test-tw5/tiddlers.txt

So it lists my public tiddlers.

A bag has a policy too, which can only be seen as json like this: https://tank.peermore.com/bags/test-tw5.json

If you use https://tank.peermore.com/bags/test-tw5  ... you'll get an html representation of a bag, with limited interaction. Just check it out.

===================

The sad thing is: the nodejs server doesn't know anything about this mechanisms, except "default" recipe and "default" bag, to be able to re-use an existing tiddlyWeb adapter.
It only implements the most basic interaction between TW and a rudimentary file based datastore.

It was designed to be a test-server only, and nobody should have used it for production.

have fun!
mario





PMario

unread,
Feb 19, 2018, 10:10:45 AM2/19/18
to TiddlyWikiDev

On Monday, February 19, 2018 at 4:04:31 PM UTC+1, PMario wrote:
It seems to be somewhat of a official documentation, is that the case?

Kind of. ... TiddlyWiki is a reference implementation for a tiddler based data store, where every resource is uniquely reachable with an URI.

Fixed a typo: TiddlyWiki -> TiddlyWeb in the OP

-m

Tristan Kohl

unread,
Feb 22, 2018, 5:07:51 AM2/22/18
to TiddlyWikiDev
Thank you Mario for explaining things :)

I will try and dig into this (and checkout remoteStorage as well)

Cheers,
Tristan


On Monday, February 19, 2018 at 4:04:31 PM UTC+1, PMario wrote:
Reply all
Reply to author
Forward
0 new messages