refactor: simplify feature flags to lib/server/cli#110
Merged
Conversation
BREAKING CHANGE: Replace 6-tier feature system with 3 simple features: - lib: Complete library (database + all lenses + display) - server: WebSocket server (implies lib) - cli: Full CLI binary (implies lib and server) Changes: - Remove database, lens-core, lens-bgpkit, lens-full, display features - Move country.rs to country/mod.rs for consistency - Remove all #[cfg(feature = display)] gates (now always included) - Update all documentation (ARCHITECTURE.md, AGENTS.md, lens/README.md, examples/README.md) - Update example feature requirements in Cargo.toml All tests pass, clippy clean.
Add clear 'need X? use Y' guidance to documentation: - ARCHITECTURE.md: Quick guide at top of feature section - src/lens/mod.rs: Quick guide in module documentation - examples/README.md: Quick guide in feature tiers section - CHANGELOG.md: Document feature flag simplification as breaking change All examples use 'lib' feature, making it simple for users to understand.
Simplify all examples to be more concise and practical: **Standalone:** - time_parsing.rs: Reduced from 9 examples to 1 focused example - output_formats.rs: Reduced from 8 examples to essential formats only **Database:** - Merged database_basics.rs, as2rel_queries.rs, pfx2as_search.rs into single database.rs - Focus on practical database operations **BGPKIT:** - country_lookup.rs: Reduced from 13 examples to 2 focused examples - rpki_validation.rs: Reduced from 12 examples to practical validation use cases - mrt_parsing.rs: Reduced from 8 examples to focused parsing demo - search_bgp_messages.rs: Simplified to core search functionality **Full:** - inspect_unified.rs → inspect.rs: Simplified to core inspection features - Removed progress_callbacks.rs (too verbose) **Documentation:** - Updated examples/README.md with cleaner organization - Updated Cargo.toml with new example list All examples now use feature exclusively. All tests pass, clippy clean.
Restructure examples directory to have one example per lens: **New structure (flat, with _lens suffix):** - time_lens.rs - TimeLens - country_lens.rs - CountryLens - ip_lens.rs - IpLens (NEW) - parse_lens.rs - ParseLens - search_lens.rs - SearchLens - rpki_lens.rs - RpkiLens - pfx2as_lens.rs - Pfx2asLens (NEW) - as2rel_lens.rs - As2relLens (NEW) - inspect_lens.rs - InspectLens - database.rs - Database operations - ws_client_all.rs - WebSocket client **Changes:** - Removed subdirectories (standalone/, database/, bgpkit/, full/) - Removed output_formats.rs (redundant) - Added 3 new lens examples for IpLens, Pfx2asLens, As2relLens - Updated Cargo.toml with new example names - Updated examples/README.md with table-based documentation All examples use lib feature exclusively. All tests pass, clippy clean.
Standardize the database interface for updating/refreshing data: **New consistent API:** - needs_*_refresh(ttl) - Check if data needs refresh (all repositories) - refresh_*() - Load from default URL - refresh_*_from(path) - Load from custom path - RefreshResult - Consistent return type for refresh operations **Changes:** - Added RefreshResult struct with records_loaded, source, timestamp, details - Renamed bootstrap_asinfo() to refresh_asinfo() (with deprecated alias) - Renamed update_as2rel() to refresh_as2rel() (with deprecated alias) - Added refresh_asinfo_from() for loading ASInfo from custom path - Added refresh_rpki() and refresh_pfx2as() methods to MonocleDatabase - Removed hardcoded should_update() from AS2Rel (use needs_refresh(ttl)) - Removed SEVEN_DAYS_SECS constant from AS2Rel - Added load_from_path() to ASInfo repository - Updated all lenses to use new API - Updated all CLI commands to use new API - Updated tests to use new API **Benefits:** - Consistent naming across all repositories (refresh_* pattern) - Consistent return type (RefreshResult) - Configurable TTL for all data sources - No hardcoded TTL values - All repositories have both URL and path loading methods All tests pass, clippy clean.
- Add database API standardization changes to CHANGELOG - Add examples reorganization changes to CHANGELOG - Add CHANGELOG update requirement to AGENTS.md guidelines
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
This PR simplifies the feature flag system from 6 complex tiers to 3 clear options:
Before (6 tiers)
database→lens-core→lens-bgpkit→lens-full+display→cliAfter (3 tiers)
lib- Complete library (database + all lenses + display)server- WebSocket server (implies lib)cli- Full CLI binary (implies lib and server)Changes
Feature Flag Refactoring
display(tabled) now always included withlibExamples Reorganization
time_lens.rs,rpki_lens.rs, etc.)liborserverfeaturesDatabase API Standardization
RefreshResultstruct for all data sourcesneeds_*_refresh(ttl)patternbootstrap_asinfo()→refresh_asinfo(),update_as2rel()→refresh_as2rel()Configurable Cache TTLs
~/.monocle/monocle.tomlor environment variablesBreaking Changes
--no-refreshrenamed to--no-updatedb-prefix (db-refresh→update)Testing
All tests pass with new feature flags:
cargo build --all-featurescargo test --all-featurescargo clippy --all-features -- -D warnings