share / share/sharedb

Lazy loading

Open
#167 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

In #145 I discussed the possibility of implementing a filesystem. What I'm wondering now is how I could support lazy loading, i.e. build a collection where each document contains only the filename at the beginning and, when a file's contents are requested, they would be read from disk and stored in the corresponding document.
I tried sharedb.use('receive', callback) to intercept all requests to the database, and inside the callback doc.fetch(...) and doc.submitOp(...) to populate the missing data, but the callback is called for each of these two calls. How can I distinguish if the callback is called because it was triggered by a client or the server? Is there a more convenient way to do this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue #145 and the Sharedb receive hook described here, then inspect how doc.fetch(...) and doc.submitOp(...) trigger the callback. Determine whether client- and server-triggered requests can be distinguished and how lazy loading should populate a document from disk. Done means the approach and its expected behavior are established clearly enough to implement.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.