massa icon indicating copy to clipboard operation
massa copied to clipboard

ledger-db restructuring

Open Ben-PH opened this issue 2 years ago • 3 comments

  • [ ] document all added functions
  • [ ] try in sandbox /simulation/labnet
  • [ ] unit tests on the added/changed features
    • [ ] make tests compile
    • [ ] make tests pass
  • [ ] add logs allowing easy debugging in case the changes caused problems
  • [ ] if the API has changed, update the API specification

Ben-PH avatar Jan 18 '23 12:01 Ben-PH

I've been looking into making the results of the getters return a byte-slice instead of a vec as well. The issue is that the library uses the DBPinnableSlice struct to manage the lifetime of the data-pinning. When it goes out of scope, a rocksdb defined ffi function is used to unpin (free up) the data. Fundamentally, the question seems to be this:

How to make the v-table containing the drop method available outside of massa-ledger-worker library, without making our other libraries also dependent on rocksdb (which leads to longer compile times. like, really long)

Ben-PH avatar Jan 18 '23 16:01 Ben-PH

We usually employ "refactor" when dealing with major behavioral changes of a module, I changed the title to restructuring to avoid misleading anyone. Also I'm not a big fan of the ledger_db subdir, I don't feel there is a need for that as the module is entirely related to the the ledger_db file anyway, feels weird to have a file and a directory with the same name too, I'd rather we keep everything at the root. Otherwise lgtm.

Eitu33 avatar Jan 20 '23 15:01 Eitu33

I'll revert file separation, then merge on monday.

I'll also raise a discussion in github about that (I personally prefer not to have mod.rs files, but I'll raise it in the discussion)

Ben-PH avatar Jan 20 '23 19:01 Ben-PH