Holochain Forum

Why everything inside Elemental Chat is being sorted inside the client?

In this commit for example I can see that the sort of messages is being made inside the client

What if we have a chat with something like 50k+ messages? And this sort happens at every new signal? And this implies that pagination is not a feature of RSM yet?

see if you can do what you need with granularity of Path rather than pagination

path trees represent a more general approach than ‘page’

see this conversation for an example - https://forum.holochain.org/t/how-to-structure-implement-a-sorted-linked-list-on-the-dht/4478/12

1 Like

Hi @thedavidmeister, thanks for your answer, I tried to access the link but it gives me a 404

Oops! Looks like I’d have to make that conversation public,
Give me a min.

1 Like

Quoting David,

So you can sort-of have your DNA programmed such that messages follow a time-ordered BST (Binary Search Tree) branch (not the whole tree, just a branch, or you may call it a linked-list; https://appliedgo.net/media/balancedtree/BinTreeShapes.png).

So for a simple scenario, the full-parsed-path may look like this:
public_posts.post_xxx(the-entry-hash-of-the-post-you’re-interested-in-reading).messages.msg_xxx(the-entry-hash-of-the-latest-message; if you follow the hash, you’ll find the message “Thank you so much; issue resolved”).msg_xxx(the-previous-post; follow to discover “Try rebooting the system”)… and so on…

It works great for messages, 'cause you’re mostly interested in the latest messages and don’t have to follow a long trail just to read the latest ones. Linking a new post is trivial; only takes a few calls to create_link() and delete_link(). Moreover, it mimics the order in which messenger clients have to call get_previous_message() when the user keeps scrolling up to reach and read some arbitrarily old message.

However, I generally don’t like using the pure-path method in which the full-traversed-path may look like:

Though I prefer the linked-list workaround hack.

Anyways, that’s all I have to add…

1 Like

blogs pretty commonly create urls like posts/2020/01/06/my-blog-post and a similar thing happens for the media files they save on the file system to prevent the scenario where you end up with 50k images in a single directory

Path tackles two problems:

  • ‘hot spots’ where the base of all links in a collection falls unfairly on a few agents
  • more efficient lookups than fetching all data in a collection

the first is solved by just doing something with hashes but the second needs something domain specific


  • dates like 2020.01.07
  • longitude/latitude
  • usernames

the limitation of pagination is that you need to page over some field


e.g. twitter uses since_id

so the question for me is that after you solve the hot spot problem, which implies data is being spread across many agents, how would ‘pages’ be created

1 Like