NPipeline.StorageProviders
0.16.0
dotnet add package NPipeline.StorageProviders --version 0.16.0
NuGet\Install-Package NPipeline.StorageProviders -Version 0.16.0
<PackageReference Include="NPipeline.StorageProviders" Version="0.16.0" />
<PackageVersion Include="NPipeline.StorageProviders" Version="0.16.0" />
<PackageReference Include="NPipeline.StorageProviders" />
paket add NPipeline.StorageProviders --version 0.16.0
#r "nuget: NPipeline.StorageProviders, 0.16.0"
#:package NPipeline.StorageProviders@0.16.0
#addin nuget:?package=NPipeline.StorageProviders&version=0.16.0
#tool nuget:?package=NPipeline.StorageProviders&version=0.16.0
NPipeline.StorageProviders
Core storage provider abstractions for NPipeline connectors, enabling unified access to filesystems, cloud storage, and custom backends through a common interface.
Overview
NPipeline.StorageProviders provides the foundational abstractions that all NPipeline connectors depend on for storage operations. This separation allows
connectors to work with any storage backend without code changes.
Key Features
- Unified Storage Interface: Single
IStorageProviderinterface for read, write, list, and metadata operations - URI-Based Resolution:
StorageUriclass normalizes storage locations across different backends - Provider Discovery:
IStorageResolverdiscovers appropriate providers for given URIs - Thread-Safe Factory:
StorageProviderFactorycreates resolvers with error collection - Extensible Design: Implement custom providers for specialized storage systems
Installation
<PackageReference Include="NPipeline.StorageProviders" Version="*" />
Or via .NET CLI:
dotnet add package NPipeline.StorageProviders
Core Components
IStorageProvider
Primary interface defining storage operations:
OpenReadAsync: Open stream for readingOpenWriteAsync: Open stream for writingListAsync: Enumerate items in a locationGetMetadataAsync: Retrieve file metadataExistsAsync: Check if an item existsDeleteAsync: Remove an item (optional)
StorageUri
Represents storage locations with scheme-based routing:
// Local file
var fileUri = StorageUri.Parse("file:///path/to/data.csv");
// Cloud storage (requires provider implementation)
var s3Uri = StorageUri.Parse("s3://bucket/key.csv");
// Custom scheme
var customUri = StorageUri.Parse("custom://location/data.csv");
StorageResolver
Resolves providers based on URI scheme:
var resolver = StorageProviderFactory.CreateResolver(
new StorageResolverOptions
{
IncludeFileSystem = true
}
);
var provider = resolver.ResolveProvider(uri);
Usage Patterns
Basic File Operations
using NPipeline.StorageProviders;
var resolver = StorageProviderFactory.CreateResolver();
var uri = StorageUri.FromFilePath("./data.csv");
var provider = resolver.ResolveProvider(uri)
?? throw new InvalidOperationException("No provider registered for the URI scheme.");
// Check existence
bool exists = await provider.ExistsAsync(uri);
// Read stream
await using var stream = await provider.OpenReadAsync(uri);
// Write stream
await using var writeStream = await provider.OpenWriteAsync(uri);
Custom Provider Registration
using NPipeline.StorageProviders;
var resolver = new StorageResolver();
resolver.RegisterProvider(new CustomStorageProvider());
var provider = resolver.ResolveProvider(customUri);
Error Collection
var (resolver, errors) = StorageProviderFactory.CreateResolverWithErrors(
new StorageResolverOptions { CollectErrors = true }
);
if (errors.Count > 0)
{
foreach (var (name, details) in errors)
{
Console.WriteLine($"{name}: {string.Join(", ", details)}");
}
}
Configuration
StorageResolverOptions
Controls resolver behavior:
IncludeFileSystem: Include built-in filesystem providerConfiguration: Provider configuration from app settingsAdditionalProviders: Custom provider instancesCollectErrors: Capture provider creation errors
ConnectorConfiguration
Defines provider settings for application configuration:
var config = new ConnectorConfiguration
{
Providers = new Dictionary<string, StorageProviderConfig>
{
["S3"] = new StorageProviderConfig
{
ProviderType = "S3StorageProvider",
Enabled = true,
Settings = new Dictionary<string, string>
{
["Region"] = "us-east-1"
}
}
}
};
Architecture
The storage provider system follows dependency inversion principles:
- Abstractions Layer: Interfaces and models in
NPipeline.StorageProviders - Implementation Layer: Concrete providers (FileSystem, S3, etc.)
- Connector Layer: Connectors depend only on abstractions
This design enables:
- Swapping storage backends without connector changes
- Testing connectors with mock providers
- Adding new storage systems without modifying existing code
Thread Safety
StorageResolver: Thread-safe registration and resolutionStorageProviderRegistry: Thread-safe alias registrationStorageProviderFactory: Static methods, stateless
Supported Providers
- FileSystem: Built-in support for local and network file systems
- AWS S3: Available via
NPipeline.StorageProviders.Aws - Custom: Implement
IStorageProviderfor any backend
Documentation
License
Part of the NPipeline project. See main project LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- NPipeline (>= 0.16.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- NPipeline (>= 0.16.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- NPipeline (>= 0.16.0)
NuGet packages (11)
Showing the top 5 NuGet packages that depend on NPipeline.StorageProviders:
| Package | Downloads |
|---|---|
|
NPipeline.Connectors
Extensible storage abstraction layer for NPipeline - supports pluggable storage providers (file system, cloud storage, etc.) |
|
|
NPipeline.Connectors.Csv
CSV source and sink nodes for NPipeline using CsvHelper - read and write CSV files with configurable options |
|
|
NPipeline.Connectors.Excel
Excel source and sink nodes for NPipeline using ExcelDataReader - read and write Excel files (XLS, XLSX) with configurable options |
|
|
NPipeline.Connectors.PostgreSQL
PostgreSQL source and sink nodes for NPipeline using Npgsql - read from and write to PostgreSQL databases with configurable options |
|
|
NPipeline.Connectors.SqlServer
SQL Server source and sink nodes for NPipeline using Microsoft.Data.SqlClient - read from and write to SQL Server databases with configurable options |
GitHub repositories
This package is not used by any popular GitHub repositories.