Entity Content


How do I figure out what content to include in my Entity? How do I figure out when larger things need to be broken into multiple entities and not mixup what should be stored as links?


From @artbrock: Holochain DHT and chain entries are Content Addressable Spaces. The key MUST be the hash of the content. This is part of what ensures tamper-proof data integrity, and so you always know you got back the unaltered content that you requested – Self-integrity check. If you want to address something by name, you make an Anchor.

This still leaves lots of room for flexibility based on your specific use cases. A larger entity can be made smaller by breaking it into multiple entities with relationships between them, but you must then include these foreign keys in the entity so that it will be unique. Since the entire entity must be added, updated, or deleted as a single operation, try to design the data structure to minimize the net total of entries to the DHT.



What about data that isn’t necessary to uniquely identify an entity? Should this always be stored separately?

Related Patterns

Use the Anchor to find your entities.

I wonder about the complete opposite to this pattern - an entity as a transaction that might span multiple types and relationships. It would be optimizing the store for writes with the assumption that larger chunks of data would be pulled into an in-memory and/or local database for faster reads/calculations. It’s a data-oriented app where there will be lots of changes and I won’t be able to rely on a fixed data-model with strong verification. This won’t be appropriate for things like public financial transactions, but for my small business and integration apps I need to flexibly and dynamically evolve the data and my processing of it. I can see how this turns my DNA into a much simpler data pipeline and simple transactions would be impossible. Is this just an antipattern or is there some modified approach which makes this viable?