Repository navigation
Share memoized iostat supplier across disk instances; cache pluggable hardware in HAL - #3443
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (27)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (25)
📜 Recent review details⏰ Context from checks skipped due to timeout. (11)
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThe common hardware abstraction layer now memoizes display enumeration through platform-specific creation hooks and standardizes cached hardware-list providers. OpenBSD disk stores share one expiring memoized iostat supplier across JNA and FFM implementations. ChangesHardware enumeration caching
Shared OpenBSD iostat supplier
Release documentation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Caller
participant AbstractHardwareAbstractionLayer
participant PlatformHAL
participant DisplayProvider
Caller->>AbstractHardwareAbstractionLayer: getDisplays()
AbstractHardwareAbstractionLayer->>PlatformHAL: createDisplays()
PlatformHAL->>DisplayProvider: enumerate displays
DisplayProvider-->>PlatformHAL: List<Display>
PlatformHAL-->>AbstractHardwareAbstractionLayer: List<Display>
AbstractHardwareAbstractionLayer-->>Caller: cached List<Display>
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3443 +/- ##
============================================
+ Coverage 74.43% 74.44% +0.01%
Complexity 76 76
============================================
Files 580 580
Lines 21947 21969 +22
Branches 3668 3670 +2
============================================
+ Hits 16336 16355 +19
+ Misses 3579 3576 -3
- Partials 2032 2038 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cbae4fa to
1053292
Compare
1053292 to
69c16fe
Compare
…de (#3447) Third subsystem in the cross-OS consistency audit. Three coordinated changes: - Merge WindowsUsbDeviceJNA/FFM into a single WindowsUsbDevice (oshi-common). The WinAPI device tree is already abstracted in the DeviceTree/DeviceTreeFFM drivers, so the merged class takes the query as a Supplier passed by the HAL (the AixUsbDevice pattern); each Windows HAL passes its JNA/FFM driver + GUID. - Simplify getUsbDevices() across every platform. Since #3443 moved the tree/flat derivation into AbstractHardwareAbstractionLayer (which always calls the platform method with tree=true and flattens itself), the boolean tree parameter and the identical flatten branch in each platform static method were dead. Drop them: each returns the controller tree; the HAL derives flat. Updated all HAL createUsbDevices() callers. - Dedup the flatten helper: AbstractHardwareAbstractionLayer's private addDevicesToList duplicated AbstractUsbDevice.addDevicesToList; reuse the latter (same package). No user-facing change: the public HardwareAbstractionLayer.getUsbDevices(tree) is unchanged. Linux/Mac JNA/FFM twins keep their classes; their udev/IORegistry native abstraction is a careful follow-up.
Summary
iostatsupplier through the constructor (same pattern as NetBSD in Convert static memoized suppliers to instance fields for memory reclaim #3442). All disk instances from the samegetDisks()batch share onesystat -ab iostatcall, but the supplier is GC-eligible when unreachable.Memoizer.slowExpiration()(3 seconds) and use it inAbstractHardwareAbstractionLayerto cache displays, sound cards, graphics cards, and USB devices. These rarely change but involve expensive native/command-line queries. Thecreate*()pattern matches the existingcreateProcessor()/createMemory()/createSensors()model.Test plan
mvn compilepasses for oshi-common, oshi-core, oshi-core-ffmmvn testpasses for oshi-common, oshi-core-ffm, oshi-benchmarkmvn checkstyle:check,forbiddenapis:check,javadoc:javadocall passSummary by CodeRabbit