-
Notifications
You must be signed in to change notification settings - Fork 0
Export checkpoint! and rewind! for Manual Pool Management
#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Enable manual pool management by exporting checkpoint!/rewind! functions and adding direct TypedPool access methods. Changes: - Export checkpoint! and rewind! in public API - Add checkpoint!(tp::TypedPool) and rewind!(tp::TypedPool) for low-level access - Refactor type-specific methods to delegate to TypedPool methods (DRY principle) - Add comprehensive tests for TypedPool direct usage and delegation This allows users to manually manage pool state without importing, while maintaining clean implementation through method delegation. Generic no-arg methods were intentionally omitted to avoid namespace pollution. Related: #feat/cache_nd_view
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3 +/- ##
==========================================
+ Coverage 95.63% 95.65% +0.02%
==========================================
Files 6 6
Lines 412 414 +2
==========================================
+ Hits 394 396 +2
Misses 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR exports checkpoint! and rewind! functions to make them part of the public API and adds direct TypedPool access methods for advanced manual pool state management. The changes support both high-level pool management and low-level, performance-critical scenarios where users have direct TypedPool references.
- Exports
checkpoint!andrewind!(previously required explicit import) - Adds new
checkpoint!(tp::TypedPool)andrewind!(tp::TypedPool)methods for direct TypedPool access - Refactors type-specific methods to delegate to TypedPool methods, following DRY principle
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/AdaptiveArrayPools.jl | Exports checkpoint! and rewind! functions, removing prior comment about minimal API |
| src/core.jl | Adds TypedPool-specific checkpoint/rewind methods with documentation and refactors existing type-specific methods to delegate |
| test/test_state.jl | Adds comprehensive tests for direct TypedPool checkpoint/rewind functionality, nested state management, and delegation verification |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update checkpoint!(tp::TypedPool) and rewind!(tp::TypedPool) docstrings to clearly mark them as internal implementation details and guide users to the public checkpoint!(pool, Type) API instead. This resolves documentation confusion where users might try to use get_typed_pool! (which requires explicit import) instead of the exported type-specific checkpoint!/rewind! methods. Changes: - Add "Internal API" warning admonition to TypedPool method docs - Replace get_typed_pool! example with public API recommendation - Remove get_typed_pool! from "See also" references - Guide users to checkpoint!(pool, Type) for manual management
UpdateThe following is the correct pattern using public APIs: using AdaptiveArrayPools
# Public API - no import needed
pool = AdaptiveArrayPool()
checkpoint!(pool)
# ... work ...
rewind!(pool)
# Type-specific (less overhead, only for specific types)
checkpoint!(pool, Float64)
# ... work ...
rewind!(pool, Float64) |
Summary
Exports
checkpoint!/rewind!functions and adds directTypedPoolaccess for users who need manual pool state management.Changes
checkpoint!andrewind!are now part of the public APITypedPoolaccess viacheckpoint!(tp::TypedPool)andrewind!(tp::TypedPool)TypedPoolmethods (DRY principle)Usage
Design Decisions
checkpoint!()/rewind!()omitted to avoid namespace pollutionTesting
All 435 tests pass, including 12 new tests for: