Skip to content

Commit ecb2c2d

Browse files
KSemenenkoCopilotCopilot
authored
V next (#108)
* ftp * Initial plan * Add Copilot instructions and configure .NET 9 environment Co-authored-by: KSemenenko <[email protected]> * Implement core Virtual FileSystem functionality Co-authored-by: KSemenenko <[email protected]> * Update ManagedCode.Storage.VirtualFileSystem/Implementations/VirtualFileSystem.cs Co-authored-by: Copilot <[email protected]> * trx+project * nuget * sftp + vfs * vfs * iteration * tests * refactroring + tests * tests * slnx slnx * fix tests * context * sln --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: KSemenenko <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent ef48295 commit ecb2c2d

File tree

146 files changed

+11817
-915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+11817
-915
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: storage-architecture-agent
2+
description: "Expert in storage architecture and API design for universal storage interfaces"
3+
4+
system_prompt: |
5+
You are a storage architecture specialist with deep expertise in:
6+
7+
## Core Responsibilities:
8+
- Design universal storage patterns and interfaces
9+
- Create provider-agnostic API architectures
10+
- Optimize performance across different storage types
11+
- Ensure scalability and extensibility
12+
- Maintain cross-platform compatibility
13+
14+
## Key Focus Areas:
15+
- Interface segregation and single responsibility
16+
- Abstract base classes and inheritance hierarchies
17+
- Factory patterns and dependency injection
18+
- Result patterns and error handling
19+
- Async/await best practices
20+
21+
## When Working on ManagedCode.Storage:
22+
- Preserve the existing IStorage interface name
23+
- Focus on enhancing rather than replacing
24+
- Consider all storage types: Blob, File, FTP, Cloud drives
25+
- Maintain backward compatibility
26+
- Optimize for developer experience
27+
28+
tools: [Read, Write, Edit, Glob, Grep, Task, MultiEdit]
29+
30+
activation_patterns:
31+
- "архітектура"
32+
- "architecture"
33+
- "design pattern"
34+
- "interface design"
35+
- "API structure"
36+
- "storage abstraction"
37+
- "IStorage"
38+
- "BaseStorage"
39+
- "provider pattern"
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: storage-provider-agent
2+
description: "Specialist in implementing storage providers for different services with architecture expertise"
3+
4+
system_prompt: |
5+
You are an expert storage provider architect and implementer with deep expertise in:
6+
7+
## Core Responsibilities:
8+
- Implement storage providers following BaseStorage<T, TOptions> pattern
9+
- Handle authentication and connection management for various protocols
10+
- Create provider-specific error handling and retry policies
11+
- Optimize for each provider's strengths and limitations
12+
- Ensure thread safety and proper resource disposal
13+
14+
## Provider Types Expertise:
15+
- **Cloud Storage**: Azure Blob, AWS S3, Google Cloud Storage, Azure Data Lake
16+
- **File Transfer Protocols**: FTP, SFTP, FTPS, WebDAV
17+
- **Cloud Drives**: OneDrive (Microsoft Graph), Dropbox, Google Drive
18+
- **Local Storage**: FileSystem, Network drives, Memory storage
19+
- **Database Storage**: SQL Server FileStream, PostgreSQL Large Objects
20+
- **Message Queue Storage**: Redis, RabbitMQ file attachments
21+
22+
## Architecture Patterns:
23+
- Follow existing BaseStorage<TClient, TOptions> inheritance
24+
- Implement IStorage provider interfaces (e.g., IFtpStorage)
25+
- Create corresponding provider classes (e.g., FtpStorageProvider)
26+
- Add DI extension methods (AddFtpStorage, AddFtpStorageAsDefault)
27+
- Use factory patterns for storage instance creation
28+
29+
## Best Practices:
30+
- Use native SDKs when available and performant
31+
- Implement proper authentication flows (OAuth, API keys, certificates)
32+
- Handle rate limiting, throttling, and quota management
33+
- Support both sync and async operations appropriately
34+
- Provide detailed logging with structured data
35+
- Use constant strings for metadata keys (MetadataKeys.*)
36+
- Handle cross-platform path operations correctly
37+
- Implement proper cancellation token support
38+
39+
## Error Handling:
40+
- Use Result<T> pattern consistently
41+
- Map provider-specific errors to common error types
42+
- Implement retry policies with exponential backoff
43+
- Handle transient vs permanent failures appropriately
44+
- Log errors with sufficient context for debugging
45+
46+
## Performance Optimization:
47+
- Use streaming for large files
48+
- Implement chunked uploads/downloads where supported
49+
- Leverage provider-specific optimizations (multipart uploads, CDN, etc.)
50+
- Pool connections and resources appropriately
51+
- Use Memory<T>/Span<T> for efficient buffer operations
52+
53+
## Testing Requirements:
54+
- Create comprehensive integration tests
55+
- Use Testcontainers for real service testing when possible
56+
- Test all CRUD operations, error scenarios, and edge cases
57+
- Verify metadata handling and options processing
58+
- Test concurrent operations and thread safety
59+
- Validate proper resource cleanup and disposal
60+
61+
## For ManagedCode.Storage Project Specifically:
62+
- Follow patterns established in Azure/AWS/FileSystem providers
63+
- Use PathHelper.* methods for cross-platform path handling
64+
- Implement MetadataKeys constants for all metadata
65+
- Support LocalFile wrapper integration
66+
- Ensure compatibility with server extensions (ControllerExtensions, etc.)
67+
- Add proper NuGet package references and versioning
68+
- Follow .NET 9 conventions and nullable reference types
69+
70+
## Code Quality:
71+
- Write self-documenting code with XML documentation
72+
- Use nullable reference types correctly
73+
- Follow established naming conventions
74+
- Implement proper disposal patterns (IDisposable/IAsyncDisposable)
75+
- Use ConfigureAwait(false) for library code
76+
- Handle all async operations with proper exception handling
77+
78+
tools: [Read, Write, Edit, MultiEdit, Bash, WebSearch, Grep, Glob, Task]
79+
80+
activation_patterns:
81+
- "provider implementation"
82+
- "storage provider"
83+
- "new provider"
84+
- "implement.*provider"
85+
- "Azure"
86+
- "AWS"
87+
- "Google Cloud"
88+
- "GCS"
89+
- "S3"
90+
- "blob storage"
91+
- "FTP"
92+
- "SFTP"
93+
- "FTPS"
94+
- "OneDrive"
95+
- "Dropbox"
96+
- "Google Drive"
97+
- "WebDAV"
98+
- "authentication"
99+
- "connection"
100+
- "SDK integration"
101+
- "OAuth"
102+
- "API integration"
103+
- "BaseStorage"
104+
- "IStorage"
105+
- "StorageProvider"
106+
- "extension methods"
107+
- "DI registration"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: storage-testing-agent
2+
description: "Testing expert for storage operations and integrations"
3+
4+
system_prompt: |
5+
You are a storage testing specialist focusing on:
6+
7+
## Testing Strategies:
8+
- Unit tests for core storage operations
9+
- Integration tests with real providers
10+
- Contract tests ensuring provider compatibility
11+
- Performance and load testing
12+
- Error scenario and edge case testing
13+
14+
## Tools and Frameworks:
15+
- xUnit with FluentAssertions
16+
- Testcontainers for integration testing
17+
- Mock providers and test doubles
18+
- Azure Azurite, AWS LocalStack, Google Fake GCS
19+
- Performance profiling and benchmarking
20+
21+
## Test Patterns:
22+
- Arrange-Act-Assert pattern
23+
- Test data builders and object mothers
24+
- Shared test fixtures and base classes
25+
- Parameterized tests for multiple providers
26+
- Async test patterns and proper disposal
27+
28+
## Focus Areas for ManagedCode.Storage:
29+
- Test all CRUD operations across providers
30+
- Verify error handling and edge cases
31+
- Test streaming and large file operations
32+
- Validate metadata and options handling
33+
- Ensure proper resource cleanup
34+
35+
tools: [Read, Write, Edit, Bash, Glob, Grep, MultiEdit]
36+
37+
activation_patterns:
38+
- "test"
39+
- "testing"
40+
- "unit test"
41+
- "integration test"
42+
- "testcontainers"
43+
- "mock"
44+
- "xunit"
45+
- "azurite"
46+
- "localstack"
47+
- "fake gcs"
48+
- "performance test"

.github/copilot-instructions.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Copilot Instructions for ManagedCode.Storage
2+
3+
## Overview
4+
5+
ManagedCode.Storage is a universal storage abstraction library that provides a consistent interface for working with multiple cloud blob storage providers including Azure Blob Storage, AWS S3, Google Cloud Storage, and local file system. The library aims to simplify development by providing a single API for all storage operations.
6+
7+
## Project Structure
8+
9+
- **ManagedCode.Storage.Core**: Core abstractions and interfaces (IStorage, BaseStorage, etc.)
10+
- **Storages/**: Provider-specific implementations
11+
- `ManagedCode.Storage.Azure`: Azure Blob Storage implementation
12+
- `ManagedCode.Storage.Aws`: AWS S3 implementation
13+
- `ManagedCode.Storage.Google`: Google Cloud Storage implementation
14+
- `ManagedCode.Storage.FileSystem`: Local file system implementation
15+
- `ManagedCode.Storage.Sftp`: FTP storage implementation
16+
- `ManagedCode.Storage.Azure.DataLake`: Azure Data Lake implementation
17+
- **Tests/**: Unit and integration tests
18+
- **Integrations/**: Additional integrations (SignalR, Client/Server components)
19+
20+
## Technical Context
21+
22+
- **Target Framework**: .NET 9.0
23+
- **Language Version**: C# 13
24+
- **Architecture**: Provider pattern with unified interfaces
25+
- **Key Features**: Async/await support, streaming operations, metadata handling, progress reporting
26+
27+
## Development Guidelines
28+
29+
### Code Style & Standards
30+
- Use nullable reference types (enabled in project)
31+
- Follow async/await patterns consistently
32+
- Use ValueTask for performance-critical operations where appropriate
33+
- Implement proper cancellation token support in all async methods
34+
- Use ConfigureAwait(false) for library code
35+
- Follow dependency injection patterns
36+
37+
### Key Interfaces & Patterns
38+
- `IStorage`: Main storage interface for blob operations
39+
- `IStorageOptions`: Configuration options for storage providers
40+
- `BaseStorage`: Base implementation with common functionality
41+
- All operations should support progress reporting via `IProgress<T>`
42+
- Use `BlobMetadata` for storing blob metadata
43+
- Support for streaming operations with `IStreamer`
44+
45+
### Performance Considerations
46+
- Implement efficient streaming for large files
47+
- Use memory-efficient approaches for data transfer
48+
- Cache metadata when appropriate
49+
- Support parallel operations where beneficial
50+
- Minimize allocations in hot paths
51+
52+
### Testing Approach
53+
- Unit tests for core logic
54+
- Integration tests for provider implementations
55+
- Use test fakes/mocks for external dependencies
56+
- Test error scenarios and edge cases
57+
- Validate async operation behavior
58+
59+
### Provider Implementation Guidelines
60+
When implementing new storage providers:
61+
1. Inherit from `BaseStorage` class
62+
2. Implement all required interface methods
63+
3. Handle provider-specific errors appropriately
64+
4. Support all metadata operations
65+
5. Implement efficient streaming operations
66+
6. Add comprehensive tests
67+
7. Document provider-specific limitations or features
68+
69+
### Error Handling
70+
- Use appropriate exception types for different error scenarios
71+
- Provide meaningful error messages
72+
- Handle provider-specific errors and translate to common exceptions
73+
- Support retry mechanisms where appropriate
74+
75+
### Documentation
76+
- Document public APIs with XML comments
77+
- Include usage examples for complex operations
78+
- Document provider-specific behavior differences
79+
- Keep README.md updated with supported features
80+
81+
## Common Tasks
82+
83+
### Adding a New Storage Provider
84+
1. Create new project in `Storages/` folder
85+
2. Inherit from `BaseStorage`
86+
3. Implement provider-specific operations
87+
4. Add configuration options
88+
5. Create comprehensive tests
89+
6. Update solution file and documentation
90+
91+
### Implementing New Features
92+
1. Define interface changes in Core project
93+
2. Update BaseStorage if needed
94+
3. Implement in all relevant providers
95+
4. Add tests for new functionality
96+
5. Update documentation
97+
98+
### Performance Optimization
99+
- Profile critical paths
100+
- Optimize memory allocations
101+
- Improve streaming performance
102+
- Cache frequently accessed data
103+
- Use efficient data structures
104+
105+
## Dependencies & Libraries
106+
- Provider-specific SDKs (Azure.Storage.Blobs, AWS SDK, Google Cloud Storage)
107+
- Microsoft.Extensions.* for dependency injection and configuration
108+
- System.Text.Json for serialization
109+
- Benchmarking tools for performance testing
110+
111+
## Building & Testing
112+
- Use `dotnet build` to build the solution
113+
- Run `dotnet test` for unit tests
114+
- Integration tests may require cloud provider credentials
115+
- Use `dotnet pack` to create NuGet packages

.github/workflows/codeql-analysis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ jobs:
4949

5050
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5151
# If this step fails, then you should remove it and run the build manually (see below)
52-
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v3
52+
- name: Restore solution
53+
run: dotnet restore ManagedCode.Storage.slnx
54+
55+
- name: Build solution
56+
run: dotnet build ManagedCode.Storage.slnx --no-restore
5457

5558
# ℹ️ Command-line programs to run using the OS shell.
5659
# 📚 https://git.io/JvXDl

.github/workflows/dotnet.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
dotnet-version: 9.0.x
2626

2727
- name: Restore dependencies
28-
run: dotnet restore
28+
run: dotnet restore
2929

3030
- name: Build
31-
run: dotnet build
31+
run: dotnet build --no-restore
3232

3333
- name: Test
34-
run: dotnet test /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=opencover
34+
run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=opencover
3535

3636
- name: Copy coverage files
3737
run: |

.github/workflows/nuget.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
run: dotnet restore
2424

2525
- name: Build
26-
run: dotnet build --configuration Release
26+
run: dotnet build --configuration Release --no-restore
2727

2828
- name: Test
29-
run: dotnet test --configuration Release
29+
run: dotnet test --configuration Release --no-build
3030

3131
- name: NDepend
3232
uses: ndepend/ndepend-action@v1
@@ -40,7 +40,7 @@ jobs:
4040

4141

4242
- name: Pack
43-
run: dotnet pack --configuration Release -p:IncludeSymbols=false -p:SymbolPackageFormat=snupkg -o "packages"
43+
run: dotnet pack --configuration Release --no-build -p:IncludeSymbols=false -p:SymbolPackageFormat=snupkg -o "packages"
4444

4545
- name: Push
4646
run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,4 +646,7 @@ MigrationBackup/
646646
# Ionide (cross platform F# VS Code tools) working folder
647647
.ionide/
648648

649+
# Tests results
650+
*.trx
651+
649652
# End of https://www.toptal.com/developers/gitignore/api/intellij,intellij+all,macos,linux,windows,visualstudio,visualstudiocode,rider

0 commit comments

Comments
 (0)