[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. dongcarl added this to the "WIP PRs" column in a project

  13. Remove leveldb reference from CDBIterator ctor as well 43eb4d7cc9
  14. Manage Iterator::piter's memory with unique_ptr 5c596f42ce
  15. CDBBatch: Create CDataStream as needed instead of having members 3662432607
  16. Factor out leveldb specific parts 6315852015
  17. Move all dbbatch impl to cpp becf58e0bf
  18. pimpl CDBBatch
    Remove need to ship leveldb/write_batch.h
    f164451b6e
  19. Move HandleError to cpp da69dcefa9
  20. Remove all leveldb references from header tree 47ccacd647
  21. dongcarl force-pushed on Mar 25, 2022
  22. DrahtBot added the label UTXO Db and Indexes on Mar 25, 2022
  23. DrahtBot commented at 4:35 PM on March 27, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    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.

  24. DrahtBot cross-referenced this on Mar 28, 2022 from issue assumeutxo: add init and completion logic by jamesob
  25. DrahtBot cross-referenced this on Mar 28, 2022 from issue dbwrapper: properly destroy objects in case CDBWrapper ctor throws by Crypt-iQ
  26. laanwj commented at 12:10 PM on April 6, 2022: member

    Concept ACK.

  27. DrahtBot cross-referenced this on Apr 8, 2022 from issue refactor: only use explicit reinterpret/const casts, not implicit by PastaPastaPasta
  28. DrahtBot cross-referenced this on Apr 10, 2022 from issue refactor: Split ArgsManager out of util/system by Empact
  29. DrahtBot cross-referenced this on Apr 19, 2022 from issue Isolate the storage abstraction layer from the application/serialization layer by TheQuantumPhysicist
  30. DrahtBot cross-referenced this on Apr 23, 2022 from issue refactor: Prepare for moving ArgsManager out of util/system by Empact
  31. DrahtBot cross-referenced this on May 13, 2022 from issue tidy: add modernize-use-default-member-init by fanquake
  32. DrahtBot added the label Needs rebase on May 18, 2022
  33. DrahtBot commented at 5:38 PM on May 18, 2022: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

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

    <sub>Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".</sub>

  34. dongcarl commented at 6:51 PM on September 26, 2022: contributor

    Closing, @TheCharlatan will follow up with a PR that's simpler

  35. dongcarl closed this on Sep 26, 2022

  36. 8498549767 commented at 10:44 AM on January 24, 2023: none

    Excente

  37. 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: 2026-05-20 06:53 UTC