[WIP] [kernelheaders 1/n] Cleave LevelDB headers from our header tree #24676

pull dongcarl wants to merge 18 commits into bitcoin:master from dongcarl:2022-03-kernelheaders-dbwrapper changing 3 files +434 −158
  1. dongcarl commented at 9:25 pm on March 25, 2022: contributor

    This PR is not based on anything other than master.

    We #include LevelDB headers in dbwrapper.h, which means that anything that #include’s or transitively #include’s dbwrapper.h will also pull in the LevelDB headers:

    https://github.com/bitcoin/bitcoin/blob/2f0f056e08cd5a1435120592a9ecd212fcdb915b/src/dbwrapper.h#L16-L17

    This PR’s changes allow us to remove these LevelDB header #include’s in dbwrapper.h and have them be in dbwrapper.cpp instead. We achieve this mainly by:

    • Using private non-virtual interfaces (private doFoo’s) to:
      • Move LevelDB-specific code out of the header,
      • While keeping templatized serialization logic in the header
    • Using the pimpl idiom to move LevelDB-specific member variables out of the header

    Coincidentally, this PR also makes obfuscation an implementation detail of the database, as described in this code comment:

    https://github.com/bitcoin/bitcoin/blob/2f0f056e08cd5a1435120592a9ecd212fcdb915b/src/dbwrapper.h#L39-L42

  2. Split Get, Exists eaf33135ae
  3. Split EstimateSize, CompactRange 0287411553
  4. Move Wrapper::NewIterator to .cpp 0dc1e67431
  5. pimpl CDBWrapper 41d09a58c3
  6. Remove CreateObfuscateKey from CDBWrapper iface 7105adf964
  7. Remove temporary doRawGet from CDBWrapper iface 35966e39e9
  8. unique_ptr NewIterator 73172af4d8
  9. CDBIterator: Factor out leveldb specific parts from templated methods 048cd955dd
  10. Move all dbiterator impl to cpp da42535430
  11. pimpl CDBIterator fd849a4c8d
  12. Remove leveldb reference from CDBIterator ctor as well 43eb4d7cc9
  13. Manage Iterator::piter's memory with unique_ptr 5c596f42ce
  14. CDBBatch: Create CDataStream as needed instead of having members 3662432607
  15. Factor out leveldb specific parts 6315852015
  16. Move all dbbatch impl to cpp becf58e0bf
  17. pimpl CDBBatch
    Remove need to ship leveldb/write_batch.h
    f164451b6e
  18. Move HandleError to cpp da69dcefa9
  19. Remove all leveldb references from header tree 47ccacd647
  20. dongcarl force-pushed on Mar 25, 2022
  21. DrahtBot added the label UTXO Db and Indexes on Mar 25, 2022
  22. DrahtBot commented at 4:35 pm on March 27, 2022: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #25108 (tidy: add modernize-use-default-member-init by fanquake)
    • #24922 (Isolate the storage abstraction layer from the application/serialization layer by TheQuantumPhysicist)
    • #24232 (assumeutxo: add init and completion logic by jamesob)
    • #22663 (dbwrapper: properly destroy objects in case CDBWrapper ctor throws by Crypt-iQ)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  23. laanwj commented at 12:10 pm on April 6, 2022: member
    Concept ACK.
  24. DrahtBot added the label Needs rebase on May 18, 2022
  25. DrahtBot commented at 5:38 pm on May 18, 2022: contributor

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  26. dongcarl commented at 6:51 pm on September 26, 2022: contributor
    Closing, @TheCharlatan will follow up with a PR that’s simpler
  27. dongcarl closed this on Sep 26, 2022

  28. 8498549767 commented at 10:44 am on January 24, 2023: none
    Excente
  29. bitcoin locked this on Jan 24, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me