Skip to content

Commit

Permalink
disk connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Jun 11, 2024
1 parent 92612a6 commit 75464e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: build

env:
v: '2.0.1'
# v: '2.0.2'
v: '2.0.2-pre.1'
av: '2.0.0'

on:
Expand Down
7 changes: 6 additions & 1 deletion docs/release-history.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 2.0.1
## 2.0.2

### New
- Connection string for disk (`disk://`) can be passed without path, in which case the instance is created against entire disk.

## 2.0.1

Local disk file storage provider now implements `ILocalDiskFileStorage` interface, which exposes `ToNativeLocalPath` method returning full path to the file on the local disk, specific to the OS you are running on. This is useful when you need to pass file paths to external tools or libraries that need native OS paths.

Expand Down
6 changes: 6 additions & 0 deletions src/Stowage.Test/Integration/Impl/LocalDiskTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ public async Task ResolveToNativePath() {

Assert.True(nativePath.Length > 0);
}

[Fact]
public async Task CreateFromConnectionString() {
IFileStorage ifs = Files.Of.ConnectionString("disk://");
Assert.NotNull(ifs);
}
}
}
4 changes: 2 additions & 2 deletions src/Stowage/Factories/BuiltInConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace Stowage.Factories {
class BuiltInConnectionFactory : IConnectionFactory {
public IFileStorage? Create(ConnectionString connectionString) {
if(connectionString.Prefix == "disk") {
connectionString.GetRequired("path", true, out string path);
string? path = connectionString.Get("path");

return new LocalDiskFileStorage(path);
return path == null ? Files.Of.EntireLocalDisk(): Files.Of.LocalDisk(path);
}

if(connectionString.Prefix == "inmemory") {
Expand Down

0 comments on commit 75464e1

Please sign in to comment.