Rename ResourcePool to ReferenceCountedCache — Closes #151#169
Open
conradbzura wants to merge 3 commits into
Open
Rename ResourcePool to ReferenceCountedCache — Closes #151#169conradbzura wants to merge 3 commits into
conradbzura wants to merge 3 commits into
Conversation
63b7f3d to
c256550
Compare
The class name now accurately describes the data structure's behavior: a reference-counted cache with TTL-based cleanup, not a generic resource pool. The module is also renamed from resourcepool.py to cache.py to match. Closes wool-labs#151
c256550 to
c1bfe94
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rename the internal
ResourcePoolclass toReferenceCountedCacheand its companionResourceclass toReference. Rename the module fromresourcepool.pytocache.py. The previous names implied a pre-allocated pool of homogeneous resources (like a connection pool), but the actual abstraction is a lazily-created, keyed, reference-counted cache with TTL-based idle eviction. Similarly,Resourcewas a single-use acquisition handle rather than a resource in the traditional sense --Referencebetter describes its role as a reference-counted handle into the cache. All internal references -- imports, type annotations, variable names, docstrings, and test mocks -- are updated accordingly. No behavioral changes.Closes #151
Proposed changes
Rename module and classes
Rename
src/wool/runtime/resourcepool.pytosrc/wool/runtime/cache.py, rename theResourcePoolclass toReferenceCountedCache, and rename theResourceclass toReference. TheCacheEntrynested dataclass retains its name since it already describes its purpose accurately.Update all internal references
Update every import, type annotation, variable name, docstring cross-reference, and mock patch target across the codebase to reference the new module path (
wool.runtime.cache) and class names (ReferenceCountedCache,Reference). Affected modules span the runtime core (__init__.py), discovery layer (discovery/__init__.py,discovery/local.py,discovery/pool.py), worker layer (worker/connection.py,worker/process.py,worker/service.py), and internal documentation (worker/README.md).Update test references
Rename
tests/runtime/test_resourcepool.pytotests/runtime/test_cache.py. Rename test classes:TestResourcePooltoTestReferenceCountedCacheandTestResourcetoTestReference. Update all imports, mock patch targets, dependency markers, and docstring references within the test suite. No test logic is changed.Test cases
All test changes are mechanical renames with no behavioral modifications. The existing test suite validates the same invariants under the new names.
TestReferenceCountedCacheget()is called with a keyReferenceinstanceTestReferenceCountedCacheTestReferenceCountedCacheTestReferenceCountedCacheTestReferenceCountedCacheclear()is calledTestReferenceCountedCacheclear(key)is calledTestReferenceCountedCachestatsis accessedTestReferenceCountedCacheTestReferenceCountedCacheTestReferenceReferencefrom a cacheTestReferenceReferencethat has already been enteredRuntimeErrorTestReferenceReferencefrom a pool that fails during acquireTestReferenceReferencethat was never acquiredRuntimeErrorTestReferenceReferencethat was already releasedRuntimeErrorTestSubscriberMetaReferenceCountedCacheis set in the ContextVar