refactor: extract lib.rs, remove club module, add bounded concurrency
- Extract shared types (Car, BestCarRecord, AnalysisContext) into src/lib.rs - Replace global static BEST_CARS with injected AnalysisContext for testability - Add semaphore-bounded concurrency (limit 20) in parse_all_times() - Replace hardcoded track name match with track_names.json loaded via include_str! - Replace magic number 115 with const MAX_RQ: u8 = 113 - Improve floating-point tie comparison with TIME_TOLERANCE (5ms) constant - Remove src/club.rs binary (topdrives.club no longer maintained) - Remove scraper dependency from Cargo.toml - Remove tracks.txt (replaced by track_names.json) - Remove empty/placeholder test bodies - Improve error handling in get_file() for response body read - Add load_my_cars_data() combining owned + wishlist extraction in one I/O - Update CHANGELOG, README, and all docs to reflect changes
This commit is contained in:
parent
6a68469239
commit
89fa69e3c8
14 changed files with 874 additions and 2037 deletions
60
CHANGELOG.md
60
CHANGELOG.md
|
|
@ -14,17 +14,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- User guide with command examples and troubleshooting
|
||||
- Data structures documentation for JSON formats
|
||||
- Development setup guide with dependency explanations
|
||||
- `track_names.json` — external config file mapping track codes to human-readable names (loaded at compile time via `include_str!`)
|
||||
- `full_script` command for running fetch + all analysis commands in sequence
|
||||
- Daily workflow documentation with output file descriptions (`best.csv`, `details.csv`, `add.csv`, `remove.csv`, `trash.csv`, `sorted.csv`, `very_best.csv`, `wishlist.csv`)
|
||||
|
||||
### Improved
|
||||
### Changed
|
||||
- `translate_track_name()` in `lib.rs` now loads track name mappings from `track_names.json` instead of a hardcoded match statement
|
||||
- Magic number 115 replaced with `const MAX_RQ: u8 = 113` in `records.rs` for clarity and maintainability
|
||||
- `parse_all_times()` now uses a semaphore (limit 20) for bounded concurrency instead of unbounded task spawning
|
||||
- Empty test bodies removed from `records.rs`
|
||||
- Enhanced error handling throughout the application
|
||||
- Better progress reporting during data fetching
|
||||
- More descriptive command-line help text
|
||||
- Improved CSV output formatting
|
||||
|
||||
### Removed
|
||||
- **Club Module**: Removed `src/club.rs` binary (topdrives.club is no longer maintained)
|
||||
- **scraper dependency**: Removed `scraper` crate from `Cargo.toml` (was only used by club module)
|
||||
- **tracks.txt**: Removed track definitions file (only used by club binary)
|
||||
- Club module `Car` struct (separate struct with `class`, `upgrade` fields)
|
||||
|
||||
## [0.2.0] - 2024-12-XX
|
||||
|
||||
### Added
|
||||
- **Club Module**: Alternative data source using web scraping from topdrives.club
|
||||
- **Track-Specific Analysis**: New `track` command for targeted recommendations
|
||||
- **Enhanced Output**: CSV file generation for analysis results
|
||||
- **Improved Concurrency**: Better handling of multiple simultaneous downloads
|
||||
|
|
@ -64,33 +76,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Data Processing
|
||||
- **[0.1.0]** Basic JSON parsing and analysis
|
||||
- **[0.2.0]** Enhanced error handling and data validation
|
||||
- **[Unreleased]** Improved caching and incremental updates
|
||||
- **[Unreleased]** Track name mappings externalized to `track_names.json`
|
||||
|
||||
### Performance
|
||||
- **[0.1.0]** Single-threaded processing
|
||||
- **[0.2.0]** Concurrent downloads with rate limiting
|
||||
- **[Unreleased]** Memory optimization and streaming processing
|
||||
- **[Unreleased]** Bounded concurrency via semaphore (limit 20); `MAX_RQ` constant replaces magic number
|
||||
|
||||
### User Interface
|
||||
- **[0.1.0]** Basic command-line interface
|
||||
- **[0.2.0]** Enhanced output formatting and CSV export
|
||||
- **[Unreleased]** Comprehensive documentation and help system
|
||||
- **[Unreleased]** `full_script` command for complete daily workflow
|
||||
|
||||
### Data Sources
|
||||
- **[0.1.0]** JSON-based records from community repository
|
||||
- **[0.2.0]** Added HTML scraping from topdrives.club
|
||||
- **[Unreleased]** Multiple data source integration
|
||||
- **[Unreleased]** Removed club scraping (topdrives.club no longer maintained)
|
||||
|
||||
## Migration Guide
|
||||
|
||||
### Upgrading to Unreleased from 0.2.0
|
||||
|
||||
**Breaking Changes:**
|
||||
1. **Club module removed**: `cargo run --bin club` is no longer available
|
||||
2. **`scraper` dependency removed**: No longer needed without club module
|
||||
3. **`tracks.txt` removed**: Track names now in `track_names.json`
|
||||
4. **`translate_track_name()` changed**: Now loads from `track_names.json` instead of hardcoded match
|
||||
5. **Magic number 115 → `MAX_RQ` (113)**: RQ range analysis now uses `MAX_RQ = 113` constant
|
||||
|
||||
**New Features Available:**
|
||||
1. **`full_script` command**: Run fetch + all analysis in one command
|
||||
2. **Additional output files**: `add.csv`, `remove.csv`, `sorted.csv`, `very_best.csv`, `wishlist.csv`
|
||||
3. **External track name config**: `track_names.json` can be updated without code changes
|
||||
|
||||
### Upgrading from 0.1.0 to 0.2.0
|
||||
|
||||
**No breaking changes** - the upgrade is fully backwards compatible.
|
||||
|
||||
**New Features Available:**
|
||||
1. **Club Module**: Alternative data source with `cargo run --bin club`
|
||||
2. **Track Command**: Specific track analysis with `cargo run --bin records -- track`
|
||||
3. **CSV Output**: Automatic generation of analysis files
|
||||
1. **Track Command**: Specific track analysis with `cargo run --bin records -- track`
|
||||
2. **CSV Output**: Automatic generation of analysis files
|
||||
|
||||
**Performance Improvements:**
|
||||
- Faster data fetching with concurrent downloads
|
||||
|
|
@ -99,8 +124,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## Deprecation Notices
|
||||
|
||||
### Future Removals
|
||||
- **None currently planned**
|
||||
### Removed in Unreleased
|
||||
- **Club Module**: `src/club.rs` and `cargo run --bin club` — topdrives.club is no longer maintained
|
||||
- **`scraper` dependency**: Removed from `Cargo.toml`
|
||||
- **`tracks.txt`**: Replaced by `track_names.json`
|
||||
|
||||
### Deprecated Features
|
||||
- **None currently deprecated**
|
||||
|
|
@ -122,7 +149,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Data Processing Speed
|
||||
- **Initial Load**: ~2-3 minutes (downloads 1000+ files)
|
||||
- **Subsequent Runs**: <30 seconds (uses cached data)
|
||||
- **Concurrent Operations**: 20 simultaneous downloads
|
||||
- **Concurrent Operations**: 20 simultaneous downloads (semaphore bounded)
|
||||
|
||||
### Memory Usage
|
||||
- **Base Application**: ~50MB
|
||||
|
|
@ -132,7 +159,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Network Efficiency
|
||||
- **Compression**: Efficient HTTP compression
|
||||
- **Connection Reuse**: Persistent HTTP connections
|
||||
- **Rate Limiting**: Respects server constraints
|
||||
- **Rate Limiting**: Semaphore-bounded concurrency (limit 20)
|
||||
|
||||
## Known Issues and Limitations
|
||||
|
||||
|
|
@ -150,15 +177,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## Future Roadmap
|
||||
|
||||
### Planned Features (Unreleased)
|
||||
- **Web Interface**: Browser-based GUI for non-technical users
|
||||
- **Historical Analysis**: Track performance changes over time
|
||||
- **Mobile App**: iOS/Android companion application
|
||||
- **Cloud Sync**: Synchronize collection across devices
|
||||
- **Advanced Analytics**: Statistical analysis and trend detection
|
||||
|
||||
### Potential Enhancements
|
||||
- **Real-time Updates**: Live data synchronization
|
||||
- **Social Features**: Share collections and recommendations
|
||||
- **Customization**: User-defined analysis parameters
|
||||
- **Export Options**: Multiple file formats (PDF, Excel)
|
||||
|
||||
|
|
@ -184,11 +207,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Data Sources
|
||||
- **Top Drives Community**: Primary timing data source
|
||||
- **topdrives.club**: Alternative data source
|
||||
- **GitHub Contributors**: Track and car database maintenance
|
||||
|
||||
---
|
||||
|
||||
**Changelog Format**: Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format
|
||||
**Versioning**: Follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) principles
|
||||
**Last Updated**: 2024-12-XX
|
||||
**Last Updated**: 2026-05-06
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue