Code Monkey home page Code Monkey logo

Comments (3)

SebastianStehle avatar SebastianStehle commented on May 28, 2024

This is tricky. The actual state is a binary representation, e.g. see our Mongo implementation: https://github.com/y-crdt/ydotnet/blob/main/YDotNet.Server.MongoDB/DocumentEntity.cs

It is not readable and searchable. if you want that, you need another field and convert the document to JSON whenever you write it. There are a few methods for it: https://github.com/y-crdt/ydotnet/blob/main/YDotNet.Extensions/YDotNetExtensions.cs

If you have a single server I would keep the document in memory and evict it when it is not used anymore. This is what we do in the server project: https://github.com/y-crdt/ydotnet/blob/main/YDotNet.Server/Internal/DocumentCache.cs

If you have a workload with relatively few interactions (not a text editor), you can just load and store it for each request. Perhaps with optimistic concurrency and a few retries.

from ydotnet.

vdurante avatar vdurante commented on May 28, 2024

@SebastianStehle any reason why both MongoDB and Redis have an expiration date then? If they are the final persistence layers, than shouldn't they be persisted forever? Or do you expect the client to save it somewhere else?

Also, reading MongoDB implementation it seems like you are not really deleting the expired entities? Is the expiration stored there only as an example then?

from ydotnet.

SebastianStehle avatar SebastianStehle commented on May 28, 2024

MongoDB is doing the deletion for you (https://github.com/y-crdt/ydotnet/blob/main/YDotNet.Server.MongoDB/MongoDocumentStorage.cs#L30).

I have a use case, where the data is not stored forever, so I added it basically for myself.

from ydotnet.

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.