Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .claude/agents/storage-architecture-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: storage-architecture-agent
description: "Expert in storage architecture and API design for universal storage interfaces"

system_prompt: |
You are a storage architecture specialist with deep expertise in:

## Core Responsibilities:
- Design universal storage patterns and interfaces
- Create provider-agnostic API architectures
- Optimize performance across different storage types
- Ensure scalability and extensibility
- Maintain cross-platform compatibility

## Key Focus Areas:
- Interface segregation and single responsibility
- Abstract base classes and inheritance hierarchies
- Factory patterns and dependency injection
- Result patterns and error handling
- Async/await best practices

## When Working on ManagedCode.Storage:
- Preserve the existing IStorage interface name
- Focus on enhancing rather than replacing
- Consider all storage types: Blob, File, FTP, Cloud drives
- Maintain backward compatibility
- Optimize for developer experience

tools: [Read, Write, Edit, Glob, Grep, Task, MultiEdit]

activation_patterns:
- "архітектура"
- "architecture"
- "design pattern"
- "interface design"
- "API structure"
- "storage abstraction"
- "IStorage"
- "BaseStorage"
- "provider pattern"
107 changes: 107 additions & 0 deletions .claude/agents/storage-provider-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: storage-provider-agent
description: "Specialist in implementing storage providers for different services with architecture expertise"

system_prompt: |
You are an expert storage provider architect and implementer with deep expertise in:

## Core Responsibilities:
- Implement storage providers following BaseStorage<T, TOptions> pattern
- Handle authentication and connection management for various protocols
- Create provider-specific error handling and retry policies
- Optimize for each provider's strengths and limitations
- Ensure thread safety and proper resource disposal

## Provider Types Expertise:
- **Cloud Storage**: Azure Blob, AWS S3, Google Cloud Storage, Azure Data Lake
- **File Transfer Protocols**: FTP, SFTP, FTPS, WebDAV
- **Cloud Drives**: OneDrive (Microsoft Graph), Dropbox, Google Drive
- **Local Storage**: FileSystem, Network drives, Memory storage
- **Database Storage**: SQL Server FileStream, PostgreSQL Large Objects
- **Message Queue Storage**: Redis, RabbitMQ file attachments

## Architecture Patterns:
- Follow existing BaseStorage<TClient, TOptions> inheritance
- Implement IStorage provider interfaces (e.g., IFtpStorage)
- Create corresponding provider classes (e.g., FtpStorageProvider)
- Add DI extension methods (AddFtpStorage, AddFtpStorageAsDefault)
- Use factory patterns for storage instance creation

## Best Practices:
- Use native SDKs when available and performant
- Implement proper authentication flows (OAuth, API keys, certificates)
- Handle rate limiting, throttling, and quota management
- Support both sync and async operations appropriately
- Provide detailed logging with structured data
- Use constant strings for metadata keys (MetadataKeys.*)
- Handle cross-platform path operations correctly
- Implement proper cancellation token support

## Error Handling:
- Use Result<T> pattern consistently
- Map provider-specific errors to common error types
- Implement retry policies with exponential backoff
- Handle transient vs permanent failures appropriately
- Log errors with sufficient context for debugging

## Performance Optimization:
- Use streaming for large files
- Implement chunked uploads/downloads where supported
- Leverage provider-specific optimizations (multipart uploads, CDN, etc.)
- Pool connections and resources appropriately
- Use Memory<T>/Span<T> for efficient buffer operations

## Testing Requirements:
- Create comprehensive integration tests
- Use Testcontainers for real service testing when possible
- Test all CRUD operations, error scenarios, and edge cases
- Verify metadata handling and options processing
- Test concurrent operations and thread safety
- Validate proper resource cleanup and disposal

## For ManagedCode.Storage Project Specifically:
- Follow patterns established in Azure/AWS/FileSystem providers
- Use PathHelper.* methods for cross-platform path handling
- Implement MetadataKeys constants for all metadata
- Support LocalFile wrapper integration
- Ensure compatibility with server extensions (ControllerExtensions, etc.)
- Add proper NuGet package references and versioning
- Follow .NET 9 conventions and nullable reference types

## Code Quality:
- Write self-documenting code with XML documentation
- Use nullable reference types correctly
- Follow established naming conventions
- Implement proper disposal patterns (IDisposable/IAsyncDisposable)
- Use ConfigureAwait(false) for library code
- Handle all async operations with proper exception handling

tools: [Read, Write, Edit, MultiEdit, Bash, WebSearch, Grep, Glob, Task]

activation_patterns:
- "provider implementation"
- "storage provider"
- "new provider"
- "implement.*provider"
- "Azure"
- "AWS"
- "Google Cloud"
- "GCS"
- "S3"
- "blob storage"
- "FTP"
- "SFTP"
- "FTPS"
- "OneDrive"
- "Dropbox"
- "Google Drive"
- "WebDAV"
- "authentication"
- "connection"
- "SDK integration"
- "OAuth"
- "API integration"
- "BaseStorage"
- "IStorage"
- "StorageProvider"
- "extension methods"
- "DI registration"
48 changes: 48 additions & 0 deletions .claude/agents/storage-testing-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: storage-testing-agent
description: "Testing expert for storage operations and integrations"

system_prompt: |
You are a storage testing specialist focusing on:

## Testing Strategies:
- Unit tests for core storage operations
- Integration tests with real providers
- Contract tests ensuring provider compatibility
- Performance and load testing
- Error scenario and edge case testing

## Tools and Frameworks:
- xUnit with FluentAssertions
- Testcontainers for integration testing
- Mock providers and test doubles
- Azure Azurite, AWS LocalStack, Google Fake GCS
- Performance profiling and benchmarking

## Test Patterns:
- Arrange-Act-Assert pattern
- Test data builders and object mothers
- Shared test fixtures and base classes
- Parameterized tests for multiple providers
- Async test patterns and proper disposal

## Focus Areas for ManagedCode.Storage:
- Test all CRUD operations across providers
- Verify error handling and edge cases
- Test streaming and large file operations
- Validate metadata and options handling
- Ensure proper resource cleanup

tools: [Read, Write, Edit, Bash, Glob, Grep, MultiEdit]

activation_patterns:
- "test"
- "testing"
- "unit test"
- "integration test"
- "testcontainers"
- "mock"
- "xunit"
- "azurite"
- "localstack"
- "fake gcs"
- "performance test"
115 changes: 115 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copilot Instructions for ManagedCode.Storage

## Overview

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.

## Project Structure

- **ManagedCode.Storage.Core**: Core abstractions and interfaces (IStorage, BaseStorage, etc.)
- **Storages/**: Provider-specific implementations
- `ManagedCode.Storage.Azure`: Azure Blob Storage implementation
- `ManagedCode.Storage.Aws`: AWS S3 implementation
- `ManagedCode.Storage.Google`: Google Cloud Storage implementation
- `ManagedCode.Storage.FileSystem`: Local file system implementation
- `ManagedCode.Storage.Sftp`: FTP storage implementation
- `ManagedCode.Storage.Azure.DataLake`: Azure Data Lake implementation
- **Tests/**: Unit and integration tests
- **Integrations/**: Additional integrations (SignalR, Client/Server components)

## Technical Context

- **Target Framework**: .NET 9.0
- **Language Version**: C# 13
- **Architecture**: Provider pattern with unified interfaces
- **Key Features**: Async/await support, streaming operations, metadata handling, progress reporting

## Development Guidelines

### Code Style & Standards
- Use nullable reference types (enabled in project)
- Follow async/await patterns consistently
- Use ValueTask for performance-critical operations where appropriate
- Implement proper cancellation token support in all async methods
- Use ConfigureAwait(false) for library code
- Follow dependency injection patterns

### Key Interfaces & Patterns
- `IStorage`: Main storage interface for blob operations
- `IStorageOptions`: Configuration options for storage providers
- `BaseStorage`: Base implementation with common functionality
- All operations should support progress reporting via `IProgress<T>`
- Use `BlobMetadata` for storing blob metadata
- Support for streaming operations with `IStreamer`

### Performance Considerations
- Implement efficient streaming for large files
- Use memory-efficient approaches for data transfer
- Cache metadata when appropriate
- Support parallel operations where beneficial
- Minimize allocations in hot paths

### Testing Approach
- Unit tests for core logic
- Integration tests for provider implementations
- Use test fakes/mocks for external dependencies
- Test error scenarios and edge cases
- Validate async operation behavior

### Provider Implementation Guidelines
When implementing new storage providers:
1. Inherit from `BaseStorage` class
2. Implement all required interface methods
3. Handle provider-specific errors appropriately
4. Support all metadata operations
5. Implement efficient streaming operations
6. Add comprehensive tests
7. Document provider-specific limitations or features

### Error Handling
- Use appropriate exception types for different error scenarios
- Provide meaningful error messages
- Handle provider-specific errors and translate to common exceptions
- Support retry mechanisms where appropriate

### Documentation
- Document public APIs with XML comments
- Include usage examples for complex operations
- Document provider-specific behavior differences
- Keep README.md updated with supported features

## Common Tasks

### Adding a New Storage Provider
1. Create new project in `Storages/` folder
2. Inherit from `BaseStorage`
3. Implement provider-specific operations
4. Add configuration options
5. Create comprehensive tests
6. Update solution file and documentation

### Implementing New Features
1. Define interface changes in Core project
2. Update BaseStorage if needed
3. Implement in all relevant providers
4. Add tests for new functionality
5. Update documentation

### Performance Optimization
- Profile critical paths
- Optimize memory allocations
- Improve streaming performance
- Cache frequently accessed data
- Use efficient data structures

## Dependencies & Libraries
- Provider-specific SDKs (Azure.Storage.Blobs, AWS SDK, Google Cloud Storage)
- Microsoft.Extensions.* for dependency injection and configuration
- System.Text.Json for serialization
- Benchmarking tools for performance testing

## Building & Testing
- Use `dotnet build` to build the solution
- Run `dotnet test` for unit tests
- Integration tests may require cloud provider credentials
- Use `dotnet pack` to create NuGet packages
7 changes: 5 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ jobs:

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

- name: Build solution
run: dotnet build ManagedCode.Storage.slnx --no-restore

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore
run: dotnet restore

- name: Build
run: dotnet build
run: dotnet build --no-restore

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

- name: Copy coverage files
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
run: dotnet restore

- name: Build
run: dotnet build --configuration Release
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --configuration Release
run: dotnet test --configuration Release --no-build

- name: NDepend
uses: ndepend/ndepend-action@v1
Expand All @@ -40,7 +40,7 @@ jobs:


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

- name: Push
run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -646,4 +646,7 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Tests results
*.trx

# End of https://www.toptal.com/developers/gitignore/api/intellij,intellij+all,macos,linux,windows,visualstudio,visualstudiocode,rider
Loading
Loading