Coder Social home page Coder Social logo

Comments (13)

wi1dcard avatar wi1dcard commented on August 27, 2024 3

Personally, I prefer to use a database, or at least use a JSON file and write the data to the file periodically. Here are some of my thoughts:

  1. There's one major issue that you have to take much care about in a public client instead of a private project - the compatibility. What if sometime in the future we add, let's say, a feature that includes more complex data that has to persist on disk, how should you store them into a text-based lock file? If we decide to use a DB or something else at that time, will the migration workload be too much for us?

  2. Also, as @wuminzhe mentioned, there could be a chance that the program exits without any signal came out like it crashes, or even you did receive the signal, but it can't be properly caught or handled, for example the SIGKILL.

  3. Another thing you'd have to think about is - you can't write data to disk synchronously, but periodically. Otherwise, the disk IO can be too high.

  4. The bridger is not a binary-size-sensitive software in most common cases, I don't think there will be many users running it on a device that has little disk spaces.

In my opinion, all the issues above have already been taken care of by almost every common database engine.

Although using a DB looks unnecessary at the moment, it can save lots of "Engineers' time" for a longer-term plan. To put much more costs of engineering on reducing sizes of final binaries for just several MB, I'd rather choosing importing these dependencies.

from bridger.

clearloop avatar clearloop commented on August 27, 2024 2

It's not about the future thing, it's about what can solve problems exactly, clean, efficient, and elegant.

For example, if we are riding on the land, why should we spend time building our motorcycle can ride on the ocean, in the future? The core problem is riding on the land more safely and stable, not thinking of adding an air cushion to it to avoid dropping into the water.

And in a word, using a database or a file is not an arch problem, it is a very little thing, and It could be converted from file to DB or DB to file in 10mins, anytime, easily.

I can't understand why we spending time thinking about using DB or file instead of checking the logic of bridger.

It is sync all the time.

It is only a binary.

from bridger.

clearloop avatar clearloop commented on August 27, 2024

File IO can handle this, the database solution is dirty.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

How to solve the problem of the need to change the configuration after a restart?

from bridger.

clearloop avatar clearloop commented on August 27, 2024

How to solve the problem of the need to change the configuration after a restart?

Listen to the exit signal and updates the config file, or a redeem.lock file.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

dirtier!

from bridger.

clearloop avatar clearloop commented on August 27, 2024

dirtier!

Using a database to store a number is like buying a house to store a cigarette, all we need is a cigarette case.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

not a number, but a tx list. you store the list in memory now. and you can do more things based on the list in the future like show a ui to the user more stable.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

and, maybe there is no exit signal.

from bridger.

clearloop avatar clearloop commented on August 27, 2024

not a number, but a tx list. you store the list in memory now.

It's a FIFO queue, first in and first out.

and you can do more things based on the list in the future like show a ui to the user more stable.

We don't have a specified UI plan now, so we don't need the database.

For SQLite, it requires the sqlite3 link library for UNIX, for Rocksdb, it is too big(including link library), Sled is okay but still unnecessary.


And storing the queue is unnecessary as well because whatever happens we always have the first request to the Ethereum, the queue is temporary all the time, it should be placed in memory.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

and, easy to debug data from the user's machine.

from bridger.

wuminzhe avatar wuminzhe commented on August 27, 2024

easy, just a suggestion

from bridger.

hackfisher avatar hackfisher commented on August 27, 2024

#32 bridger's ethereum block start will need a data store for persistence, agree with @wi1dcard opinion, local light db is better than file.

from bridger.

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.