Coder Social home page Coder Social logo

v1 about dnote HOT 5 CLOSED

dnote avatar dnote commented on May 17, 2024
v1

from dnote.

Comments (5)

sungwoncho avatar sungwoncho commented on May 17, 2024

@michielboekhoff what do you think?

from dnote.

michielboekhoff avatar michielboekhoff commented on May 17, 2024

@sungwoncho - this is not a bad attempt. One question about this approach: if a backup is made, and if the computer is offline, can new entries still be made in the backup file? If so, we'll have to do some form of synchronization still.

We'll have to provide some form of graceful fallback - e.g. if no network connection is detected, to automatically read from the backup file. Otherwise, this sort of online-first functionality risks making life more difficult (and backwards-incompatible) for users without a (stable) network connection.

I don't quite see the problem having local changes and then uploading these to the mainline (server). If multiple machines have changes from mainline, the server can insert these into a tree as per their creation time. Mind you, that is with immutable entries. Mutable entries would make it more difficult (e.g. Git merge conflicts).

from dnote.

sungwoncho avatar sungwoncho commented on May 17, 2024

Thanks for your idea. I thought about it and agree that making dnote online-first is too much.

the server can insert these into a tree as per their creation time

Sounds like a good plan. How do you feel about the following for dnote sync?

  1. compress local copy
  2. POST to server
  3. server decompresses payload
  4. compare and get new entries and entries that client is missing
  5. write new entries to db
  6. send missing entries to client
  7. client inserts payload from 6 to local copy

But the entries might be mutable in the future (editing through web client, api, etc.). My solution is when pulling from the server, we treat the server's data as source of truth and overwrite any conflicts. But I think this requires diffing all the notes while syncing and might be too slow. Any ideas welcome.

@YiiKuoChong

from dnote.

sungwoncho avatar sungwoncho commented on May 17, 2024

@YiiKuoChong yes, the content of .dnote file is like the following:

{
  ...
  "linux": [

    {
      "UID": "4ac4h6h5",
      "Content": "$0 is the name of the running process",
      "AddedOn": 1506231335
    }
  ],
  "react": [
    {
      "UID": "94i3zquv",
      "Content": "React Element is an object representation of a DOM node",
      "AddedOn": 1499835562
    },
    {
      "UID": "c24bbcd6",
      "Content": "React Component is a function or a class which accepts input and returns React Element",
      "AddedOn": 1499835860
    }
  ]
}

from dnote.

sungwoncho avatar sungwoncho commented on May 17, 2024

@michielboekhoff @YiiKuoChong thanks for the input. I solved the problem in #51.

In short, every time a note or a book is mutated, an action is recorded locally. dnote sync will push those actions to the server. Server will process those actions, respond with actions that have not been synced with the client yet. And the cli will process those actions to bring the local copy up-to-date with the server copy.

Sync is much efficient this way because we don't POST the entire note and loop through it on the server.

Preview is available on an alpha release. If you have feedback or questions let me know.

from dnote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.