Replies: 7 comments 14 replies
-
Had another thought: I think document bodies with rich text should use "rich text facets" like Bluesky does, by default, though obviously you can totally make other formats, and just specify different metadata so the client knows what to do with it. https://www.pfrazee.com/blog/why-facets I think the docs mentioned that facets couldn't overlap each-other, which seems wrong to me, though. Like what if you want bold italic bold? I haven't looked deep into it, but the important part is being able to specify the formatting/annotations etc, separate from the content, and allow clients to independently make decisions on markup, WYSIWYG, etc., and even make their own custom annotations. The other reason I think facets is a good idea is because it lets us easily extract all of the links to other documents that are in the body of the document. For example, if we have an embed facet, then you can instantly parse out all of the embeds in a post, without having to parse out markdown or something. The data is just there. |
Beta Was this translation helpful? Give feedback.
-
Regarding the document format, it might be simplest to just represent each document as an Object in the graph, that has a I think we might not need the document's links as a separate concept, links, by being built on the graph protocol, are just automatically supported in Objects. So for instance, a could just be: {
"comment_on": ["namespaceid", "pathtopost"], // this is a link
"body": "Cool stuff!",
} I really like how simple this is. We should probably standardize on some other common metadata, though, like headers in HTTP. We'll at the very least want a |
Beta Was this translation helpful? Give feedback.
-
Just got the first working example of an Iroh Graph API. In the example below the I've iterated on the idea a little bit and removed the concept of lists. Being built on a key-value store, lists are not worth implementing properly, and you might as well just use a map, and iterate over the keys, and use ULID/UUID for the keys if you don't "care" about a key being semantically meaningful. |
Beta Was this translation helpful? Give feedback.
-
Right now the one thing about our data model that is bugging me slightly is the This leads me to an idea to replace the This could allow you to automatically validate and load into Rust structs that could do type-checked Needs a little more thought, but think it makes sense. |
Beta Was this translation helpful? Give feedback.
-
I wonder if its better to refer to Resources instead of Documents in a way that is similar to how we refer to Web resources. Then a Resource has Metadata and Content, which is defined by its Content Type. And it can be represented in a Document. I feel Resource fits the abstraction better and aligns well to existing uses of this terminology. |
Beta Was this translation helpful? Give feedback.
-
Extending on #32 (reply in thread), I had some important thoughts on how to represent For example, if we have some data that has a Another consideration, good or bad, is that everything under a single key has to be updated at the same time. For example, if you have Name and Description under the same key, then if you update the name on one computer, and the description on another computer, they won't be merged natively. Whichever change was made most recently will apply, taking both the name and the description together. This actually might be a good thing in many cases, because otherwise it's impossible to make sure two pieces of data are definitely updated at the same time. Anyway, initially I kept all pieces of data separate because it was the simplest way to start out, and I wanted to allow multiple services to be able to add their own data to objects. With the Entity Component model, though, I think components give us a good way to break things up into appropriately sized pieces that will be updated together. So, instead I think we should store each component's data serialized together under the same key. That means the structure of an entity in the key-value store will look like:
Notice that the key to the component, under the entity, is actually the hash of it's schema. So by reading the key of the component, we can retrieve the schema, and then deserialize the binary component data according to the schema. I think this is quite simple and elegant. If we are serializing multiple values into the component data now, we have to think about the serialization format. Because the value of components that are stored in Iroh are actually hashed and stored in the blob store, it would be great to take advantage of automatic de-duplication for components that have the same value. To get the best de-duplication it's best to have the serializer always produce a canonical set of bytes for any given object. That means that if an object has the same data, it always has the same bytes. That made me think about Borsh for serializing and deserializing. It's very fast, simple, and designed to always use a canonical byte representation. It also already has an ( unstable but working ) schema system in the Rust implementation: Borsh also has libraries for many languages already, which is good: Rust, TypeScript, JavaScript, Java, Kotlin, Scala, Clojure, Go, Python, AssemblyScript, C#, C++, C++20, and Elixr. The Borsh schema can also be serialized using Borsh, which is perfect for our use-case of storing the schema itself in the Iroh store. Finally, it's so simple that if we needed to make our own implementation or fork the specification for whatever reason, then we could do so. I'm really liking the way this feels. I want to give it some more time to settle, but I think it accomplishes our goals very well. |
Beta Was this translation helpful? Give feedback.
-
Starting a thread on Encryption: Continuing from this idea: #32 (reply in thread), copied from what I posted in chat. I think there's a reasonable way to handle encryption suitable for most use-cases without having to encrypt keys. I think usually you want to use key paths for grouping and discovering entities, not for describing the entities, which should be done with components. So, for instnace, the filename wouldn't be in the key, it would be in a component, and the key should be somehting like a ULID, or if you want to avoid any semantic relationship to time, a UUID. So then keys are always used as a way to group things under prefixes for the sake of public visibility or permissions like in combination with meadowcap. Having taken care of that, all we have to worry about is encrypting the components. @mikebryant I like your idea of supporting different encryptions, so I'm thinking that we have each component prefixed with an encryption ID. For unencrypted content, that could literally be prefixing the component with a null byte, if it's prefixed with 0x01 instead we could read like a ULID that represents the ID of some encryption standard, kind of similar in concept to the "multihash" in IPFS or even DIDs except it'd be a "multiencrypt", and we could use ULIDs to avoid having to register encryption ids with a centralized authority. Anyway, that allows you to optionally encrypt each component individually. And since the schema hashes are enceded with the component data, they are encrypted to, so you avoid exposing any metadata except for the key of the entity. Another cool thing about this is that it allows you to put encrypted components on an entity and unencrypted components, on a component-by-component basis. This is great for storing things like private contact information on Weird profiles. We can start by just prefixing all our components with a null byte to indicate that it's unencrypted, and then flesh out the rest of our encryption standard later, without having to do anything about it now. |
Beta Was this translation helpful? Give feedback.
-
This was some quick thoughts posted the Commune Discord. I'm cross-posting here for link/search/persist-ability.
So, along the lines of a next-gen federation protocol on top of Iroh, after comparing Weird's needs, my own thoughts for a note-taking/garden/zettelkasten tool, some ideas I was talking to @mp about, and everything that we've just thrown around here, I think I'm coming to the idea of two layers on top of Iroh that we want, that could be shared between all these ideas.
These layers could be made into a libraries/specifications that I think would be good building blocks for other projects.
This is all super rough draft idea, so it needs more thought, but I wanted to share.
Graph Layer
The graph layer would be a very simple standard for storing graph data on top of the existing key-value store in Iroh.
Something roughly like:
Linked Documents
The linked document layer would be a standard built on top of the graph store.
It's built around storing documents.
Each document would have:
The idea is that the linked document layer can be used to build a kind of "internet".
But it's built not on HTML, but on all of these different kinds of documents we create, whether they be chats or forum topics or whatever.
They should all be able to be linked to each-other, having different kinds of relationships with each-other.
Similar to links between our web pages.
By standardizing on a document format, and a way to distribute documents, in a way that gives ownership over those documents, I think we build lots of different apps, that can still have a good chance of inter-operating with each-other.
I should be able to post this wall of chat in my own notes, and then later link that same document into this chat room, and then later link the same thing into a different chat room, without copy-and-pasting and duplicating my document.
And each person should be able to comment in those different spaces with their own documents, that if we want to collect later into, like a wiki page or an archive, should be easy to do without losing the authorship of all the individual contributions, and the links that it has to the other spaces.
Each app can develop their own protocols on top of the linked documents, which could be read into other clients, such as clients that might want to combine or give you an overview over multiple apps that all use linked documents.
And bridging between apps using linked documents would be almost as easy as adding links to a webpage.
Anyway, that's the thoughts in my head.
I think that building these layers, is a good approach, though, similar to how Iroh is already built in layers.
Maybe some apps will not fit will with linked documents for some reason, and it can just use the graph layer, or maybe they need to go below the graph layer, and even the iroh key-value layer, and just use Iroh net to create something, but at least we can have the layers there for higher-level projects, so that we can re-use stuff between apps, and get more compatibility, without sacrificing on control.
Also I'd like to get name ideas for these layers. 🙂
Beta Was this translation helpful? Give feedback.
All reactions