-
Notifications
You must be signed in to change notification settings - Fork 26
Implement Virtual FileSystem abstraction over ManagedCode.Storage #107
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@KSemenenko 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
@copilot use vnext branch as a base |
@copilot install dotnet 9 , use vnext brash as base, and write file with instruction for copilot |
Co-authored-by: KSemenenko <[email protected]>
✅ Completed all requested tasks:
The environment is now configured with .NET 9 and includes detailed instructions to help Copilot provide better assistance. Commit: 93223f4 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: KSemenenko <[email protected]>
I've successfully implemented the Virtual FileSystem as requested in issue #106. The implementation includes: Core Features:
Key Components:
The solution now builds successfully with .NET 9 and integrates seamlessly with the existing ManagedCode.Storage architecture. Ready for testing and usage! Commit: ab47a4d Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this 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 implements a comprehensive Virtual FileSystem (VFS) abstraction layer over ManagedCode.Storage blob providers, enabling filesystem-like operations across different cloud storage providers (Azure, AWS, GCP, FileSystem). The VFS provides a unified interface for file and directory operations with filesystem semantics, performance optimizations including caching and streaming, and advanced features like progress reporting and multi-mount support.
Key Changes
- Added VFS core interfaces and implementations with filesystem abstraction over blob storage
- Implemented metadata management system for storing VFS-specific information in blob metadata
- Added comprehensive options system for configuring VFS behavior including caching, directory strategies, and concurrency control
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
ManagedCode.Storage.sln | Added new VFS project and additional build configurations for x64/x86 platforms |
ManagedCode.Storage.VirtualFileSystem/ManagedCode.Storage.VirtualFileSystem.csproj | Project file defining VFS package with .NET 9.0 target and required dependencies |
ManagedCode.Storage.VirtualFileSystem/Core/*.cs | Core interfaces defining VFS abstractions (IVirtualFileSystem, IVirtualFile, IVirtualDirectory, etc.) |
ManagedCode.Storage.VirtualFileSystem/Options/VfsOptions.cs | Configuration classes for VFS behavior including caching, directory strategies, and operation options |
ManagedCode.Storage.VirtualFileSystem/Implementations/*.cs | Concrete implementations of VFS interfaces with caching, metadata management, and blob storage integration |
ManagedCode.Storage.VirtualFileSystem/Metadata/IMetadataManager.cs | Metadata management system for storing VFS information in blob metadata with provider abstraction |
ManagedCode.Storage.VirtualFileSystem/Streaming/VfsWriteStream.cs | Write stream implementation that buffers data and uploads on dispose for VFS file operations |
ManagedCode.Storage.VirtualFileSystem/Exceptions/VfsExceptions.cs | VFS-specific exception types for error handling including concurrency, not found, and operation exceptions |
ManagedCode.Storage.VirtualFileSystem/Extensions/ServiceCollectionExtensions.cs | Dependency injection extensions for registering VFS services with default metadata manager implementation |
.github/copilot-instructions.md | Development guidelines and context for the ManagedCode.Storage project |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
try | ||
{ | ||
// Upload the buffered data | ||
UploadBufferedDataAsync().GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling GetAwaiter().GetResult() in a synchronous dispose method can cause deadlocks. Consider using ConfigureAwait(false) or implementing only the async dispose pattern for this scenario.
Copilot uses AI. Check for mistakes.
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, "Error uploading data during stream dispose: {BlobKey}", _blobKey); | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rethrowing the exception in DisposeAsync after logging it may not be appropriate. Consider swallowing the exception or providing a different error handling strategy since dispose operations typically should not throw.
throw; | |
// Swallow the exception to avoid throwing from DisposeAsync |
Copilot uses AI. Check for mistakes.
if (patternIndex < pattern.Length && (pattern[patternIndex] == '?' || | ||
string.Equals(pattern[patternIndex].ToString(), input[inputIndex].ToString(), comparison))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting individual characters to strings for comparison is inefficient. Use direct character comparison with case sensitivity handling instead: char.ToLowerInvariant(pattern[patternIndex]) == char.ToLowerInvariant(input[inputIndex])
for case-insensitive comparison.
if (patternIndex < pattern.Length && (pattern[patternIndex] == '?' || | |
string.Equals(pattern[patternIndex].ToString(), input[inputIndex].ToString(), comparison))) | |
if (patternIndex < pattern.Length && ( | |
pattern[patternIndex] == '?' || | |
(comparison == StringComparison.OrdinalIgnoreCase | |
? char.ToLowerInvariant(pattern[patternIndex]) == char.ToLowerInvariant(input[inputIndex]) | |
: pattern[patternIndex] == input[inputIndex]))) |
Copilot uses AI. Check for mistakes.
ManagedCode.Storage.VirtualFileSystem/Implementations/VirtualFileSystem.cs
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
return "/" + string.Join("/", segments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When all segments are removed (e.g., path with only '.' and '..' components), this will return '/' which is correct for root. However, if segments is empty but the original path was not root, this could be problematic. Consider adding a check for this edge case.
Copilot uses AI. Check for mistakes.
…ileSystem.cs Co-authored-by: Copilot <[email protected]>
This PR implements a comprehensive Virtual FileSystem (VFS) that provides filesystem-like operations over any ManagedCode.Storage blob provider (Azure, AWS, GCP, FileSystem). The VFS addresses the need for a unified, high-level interface for file and directory operations across different cloud storage providers.
Key Features
Filesystem Abstraction
Performance Optimizations
ValueTask
for cache-friendly operations (file existence checks, metadata access)Concurrency & Safety
Advanced Capabilities
Usage Example
Architecture
The VFS is built on top of the existing ManagedCode.Storage layer and maintains full compatibility with all storage providers. It uses native blob metadata for storing VFS-specific information without creating additional files, ensuring optimal performance and storage efficiency.
The implementation follows the established patterns in the codebase and integrates seamlessly with the existing dependency injection and configuration systems.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.