这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@u5surf
Copy link
Owner

@u5surf u5surf commented Sep 19, 2025

Summary

  • Refactor src/lib.rs by moving functions to specialized modules as specified in ISSUE7.md
  • Create src/shm.rs for shared memory operations (vts_init_shm_zone, vts_rbtree_insert_value, VtsSharedContext)
  • Move utility functions to src/prometheus.rs (generate_vts_status_content, get_hostname, get_current_time)
  • Update imports and remove code duplication

Test plan

  • All existing tests pass (35 tests)
  • Nginx integration verified - build, start, and curl tests successful
  • Clippy warnings resolved with -D warnings flag
  • Code formatting verified with cargo fmt --check
  • Functions properly moved to correct modules with appropriate visibility

🤖 Generated with Claude Code

…zed modules

- Create src/shm.rs for shared memory and red-black tree operations
  - Move vts_init_shm_zone and vts_rbtree_insert_value functions
  - Move VtsSharedContext struct definition
- Move utility functions to src/prometheus.rs
  - Move generate_vts_status_content, get_hostname, and get_current_time
- Update lib.rs imports and remove duplicated code
- Fix all clippy warnings and maintain proper formatting
- Verify nginx integration continues to work correctly

This refactoring improves code organization and maintainability while
preserving all existing functionality as specified in ISSUE7.md.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@u5surf u5surf requested a review from Copilot September 19, 2025 07:57
Copy link
Contributor

Copilot AI left a 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 reorganizes the code structure by extracting shared memory operations and utility functions from the main lib.rs file into specialized modules. The refactoring improves code organization and maintainability by separating concerns.

Key changes:

  • Creates a new shm.rs module for shared memory operations including VTS initialization and red-black tree functionality
  • Moves utility functions (generate_vts_status_content, get_hostname, get_current_time) to the existing prometheus.rs module
  • Updates imports and module declarations to maintain functionality after the restructuring

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/shm.rs New module containing VtsSharedContext struct and shared memory initialization functions moved from lib.rs
src/prometheus.rs Extended with utility functions for VTS status generation and system information retrieval
src/lib.rs Refactored to remove moved code and update imports to use the new module structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@u5surf u5surf merged commit d0970c3 into main Sep 19, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants