You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would add links to the $metadata (proposed in #4 ), which would simply be the above object with multiple tags.
Working with Links
The first thing we would need is an api for adding/removing links:
// Add a link to obj1 from obj1 to obj2 with the tag 'tag'.dustbin.link(obj1,'tag',obj2);// Add a link to obj1 from obj1 to the object at bucket/key with the tag 'tag'.dustbin.link(obj1,'tag','bucket','key');// Adds links to obj1 from ob1 to obj2, obj3 and obj4 with the tag 'tag'.dustbin.addLinks(obj1,'tag',obj2,obj3,obj4);// Adds links to obj1 from ob1 to the objects at 'bucket/ket1' and 'bucket/key2' with the tag 'tag'.dustbin.addLinks(obj1,'tag',["bucket","key1"],["bucket","key2"]);// Remove a link from obj1 with the tag 'tag', that points to obj2.dustbin.unlink(obj1,'tag',obj2);// Remove a link from obj1 with the tag 'tag', that points to the object 'bucket/key'.dustbin.unlink(obj1,'tag','bucket','key');// Sets the links on object obj1 to the `link` object passed in.dustbin.setLinks(obj1,{tag: [{bucket: "bucket",key: "someKey"}]});
These should cover most of the use cases. We still need the ability to work with the links:
// Get all links associated with the given tag. Returns a list of resolved objects.dustbin.getLinks(obj1,'tag');// Link walk object 1dustbin.walk(obj1,["bucket","tag"],[undefined,"someTag",true]);// Link walk object 1, verbose syntaxdustbin.walk(obj1,{bucket: "bucket",tag: "tag"},{tag: "someTag",keep: true});
This is pretty much the exact same link walking as Riak, with the exception that instead of using "_", I'm using undefined to mean "any". I believe that simply not specifying one of the options is more straightforward than an arbitrary (if commonly used) string convention.
In the end, the API is less important than answering the question, "Will this be useful?". While I can see use cases, I'm not certain that they're worth adding this support in.
If we're not sure if we want this, but thing it might be useful in some places, I'd like to write it as an extension to Dustbin; i.e. if you include dustbin.js and dustbin-links.js the DustBin object would have it's prototype extended to support links. This way, only the people who want them will need to include the additional code, and any overhead it might induce.
The text was updated successfully, but these errors were encountered:
I'm proposing we add support for links between objects in Dustbin. This could be very useful to managing data relationships.
Link Format:
A link would be an object of this structure:
We would add
links
to the $metadata (proposed in #4 ), which would simply be the above object with multiple tags.Working with Links
The first thing we would need is an api for adding/removing links:
These should cover most of the use cases. We still need the ability to work with the links:
This is pretty much the exact same link walking as Riak, with the exception that instead of using "_", I'm using
undefined
to mean "any". I believe that simply not specifying one of the options is more straightforward than an arbitrary (if commonly used) string convention.In the end, the API is less important than answering the question, "Will this be useful?". While I can see use cases, I'm not certain that they're worth adding this support in.
If we're not sure if we want this, but thing it might be useful in some places, I'd like to write it as an extension to Dustbin; i.e. if you include
dustbin.js
anddustbin-links.js
the DustBin object would have it's prototype extended to support links. This way, only the people who want them will need to include the additional code, and any overhead it might induce.The text was updated successfully, but these errors were encountered: