Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: separate Node class into FileNode and DirNode classes#1182

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Copilot wants to merge2 commits intomaster
base:master
Choose a base branch
Loading
fromcopilot/fix-1181

Conversation

Copy link
Contributor

CopilotAI commentedSep 10, 2025
edited
Loading

This PR separates the monolithicNode class into specializedFileNode andDirNode classes that inherit from a common abstractNode base class, improving code organization and type safety.

Changes Made

  • AbstractNode base class: Contains common functionality like timestamps, permissions, mode, uid/gid, symlink support, and permission checks
  • FileNode class: ExtendsNode with file-specific operations (getString(),setString(),getBuffer(),setBuffer(),write(),read(),truncate(), and thebuf property)
  • DirNode class: ExtendsNode for directories (no buffer operations needed)
  • Smart node creation: UpdatedSuperblock.createNode() to instantiate the appropriate node type based on file mode (S_IFDIRDirNode, otherwise →FileNode)
  • Updated exports: AddedFileNode andDirNode to module exports alongside the baseNode class

Benefits

  • Better separation of concerns: File-specific operations are now isolated toFileNode
  • Type safety: Abstract base class prevents direct instantiation of the genericNode class
  • Backward compatibility: All existing APIs continue to work exactly as before
  • Memory efficiency: Directory nodes no longer carry unnecessary buffer-related properties

Testing

  • All existing tests pass without modification (except updating the node-specific test to useFileNode)
  • Manual verification confirms both node types work correctly with their respective operations
  • Build and linter checks pass successfully

The implementation maintains full backward compatibility while providing a cleaner, more maintainable codebase structure.

Fixes#1181.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
CopilotAI changed the title[WIP] SeparateNode class for files and directoriesfeat: separate Node class into FileNode and DirNode classesSep 10, 2025
Copilot finished work on behalf ofstreamichSeptember 10, 2025 13:56
@streamichstreamich marked this pull request as ready for reviewSeptember 10, 2025 14:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@streamichstreamichAwaiting requested review from streamich

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

SeparateNode class for files and directories

2 participants

@streamich

[8]ページ先頭

©2009-2025 Movatter.jp