]> git.ipfire.org Git - thirdparty/squid.git/commit - src/Transients.cc
Store API and layout polishing. No functionality changes intended.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Nov 2015 05:46:36 +0000 (22:46 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Nov 2015 05:46:36 +0000 (22:46 -0700)
commit2745fea5af27ea60a6172f38846c82d16f54c4ba
tree19edeb1a2ea5444a4152eb2ca89e2d7fb83af7a9
parent3a0ace1d91cd018400f0c3bf48f6488397f08b6e
Store API and layout polishing. No functionality changes intended.

This first step towards bug #7 fix focuses on fixing "any Store is a
Root" API that forced us to bloat the base Store class with methods
needed only in Store::Root() Controller.

We resolved about 15 XXXs and 10 TODOs (although these counts are
inflated by many duplicated/repeated problems). We added a few new
XXXs and TODOs as well, but they are just marking already problematic
code, not adding more problems or genuinely new work.

Class renaming and source file movement map:

  src/SwapDir.h => src/store/Disk.h (and Controller.h)
  src/SwapDir.cc => src/store/Disk.cc
  src/StoreHashIndex.h => src/store/Disks.h (and LocalSearch.h)
  src/store_dir.cc => src/store/Controller.cc (and Disks.cc, LocalSearch.cc)
  src/disk.* => src/fs_io.*

The code movement to files in parenthesis is not tracked by bzr
because bzr cannot track file splits, and most of the moved code had
to be split across multiple files to untangle various messes. When
deciding what to tell "bzr mv", we picked file pairs that would allow
us to track the most complex, most voluminous code but there is
probably no single correct way to do that.

src/disk.* files were renamed to src/fs_io.* to avoid "src/foo
conflicts with src/store/Foo" problems expected on some case-
insensitive platforms.

The Store namespace hierarchy now looks like this:

* Storage: Any storage. Similar to the old Store class, but leaner.
* Controller: Combined memory/disks caches and transients. Root API.
* Controlled: Memory cache, disk(s) cache, or transient Storage.
* Disks: All disk caches combined.
* Disk: A single cache_dir Storage.
* Memory: A memory cache.
* Transients: Entries capable of being collapsed for CF.

The last two are not moved/finalized yet, but it should not be too
difficult to do that later because there are few direct references to
them from the high-level code.

Related polishing touches:

Moved a lot of misplaced code into the right class and/or source file.

Simplified Store::search() interface to match the actual code that
does not support any search parameters. Removed the search API from
all other stores because the code did not really support store-
specific searches. Resisted the temptation to rename parameterless
search() to iterate() or similar because the actual future of this API
is murky. We may add search parameters or even remove the method
completely. This could quickly snowball into a separate project.

Removed Store::get(x,y,z) API as unused and unsupported.

Removed FreeObject() template as unused (and possibly technically
flawed).

Simplified default Store initialization/cleanup sequence. Removed
empty disk_init(). The non-default Store::Init() parameter is used by
the unit testing code only.

Simplified Store::dereference() API by moving the second parameter to
dedicated Controller::dereferenceIdle() method that is the only ones
using that parameter.
85 files changed:
configure.ac
src/DiskIO/AIO/AIODiskFile.cc
src/DiskIO/Blocking/BlockingFile.cc
src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc
src/DiskIO/IpcIo/IpcIoFile.cc
src/DiskIO/Mmapped/MmappedFile.cc
src/FileMap.h
src/Makefile.am
src/MemStore.cc
src/MemStore.h
src/SBuf.h
src/SquidConfig.h
src/Store.h
src/StoreFileSystem.h
src/StoreHashIndex.h [deleted file]
src/StoreIOState.h
src/StoreSwapLogData.h
src/SwapDir.h [deleted file]
src/Transients.cc
src/Transients.h
src/cache_cf.cc
src/errorpage.cc
src/fatal.cc
src/fs/rock/RockDbCell.h
src/fs/rock/RockRebuild.cc
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/fs/rock/forward.h
src/fs/ufs/RebuildState.cc
src/fs/ufs/UFSStoreState.cc
src/fs/ufs/UFSSwapDir.cc
src/fs/ufs/UFSSwapDir.h
src/fs_io.cc [moved from src/disk.cc with 93% similarity]
src/fs_io.h [moved from src/disk.h with 76% similarity]
src/icmp/net_db.cc
src/icp_v2.cc
src/ipc/MemMap.h
src/ipc/StoreMap.h
src/ipc/Strand.cc
src/ipc/mem/Pages.cc
src/log/ModStdio.cc
src/log/ModUdp.cc
src/main.cc
src/mem/old_api.cc
src/mime.cc
src/send-announce.cc
src/ssl/helper.cc
src/stat.cc
src/store.cc
src/store/Controlled.h [new file with mode: 0644]
src/store/Controller.cc [new file with mode: 0644]
src/store/Controller.h [new file with mode: 0644]
src/store/Disk.cc [moved from src/SwapDir.cc with 72% similarity]
src/store/Disk.h [new file with mode: 0644]
src/store/Disks.cc [new file with mode: 0644]
src/store/Disks.h [new file with mode: 0644]
src/store/LocalSearch.cc [new file with mode: 0644]
src/store/LocalSearch.h [new file with mode: 0644]
src/store/Makefile.am [new file with mode: 0644]
src/store/Storage.h [new file with mode: 0644]
src/store/forward.h [new file with mode: 0644]
src/store_digest.cc
src/store_dir.cc [deleted file]
src/store_io.cc
src/store_key_md5.h
src/store_rebuild.cc
src/store_swapout.cc
src/tests/TestSwapDir.cc
src/tests/TestSwapDir.h
src/tests/stub_MemStore.cc
src/tests/stub_SwapDir.cc
src/tests/stub_store.cc
src/tests/stub_store_rebuild.cc
src/tests/stub_store_search.cc [moved from src/fs/forward.h with 59% similarity]
src/tests/testDiskIO.cc
src/tests/testPackableStream.cc
src/tests/testRock.cc
src/tests/testStore.cc
src/tests/testStore.h
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc
src/tests/testUfs.cc
src/tools.cc
src/unlinkd.cc
src/wccp2.cc