Skip to content

Commit

Permalink
Merge pull request #43 from koculu/feature/extend--filestreamprovider…
Browse files Browse the repository at this point in the history
…-methods

Add GetDirectories and CombinePaths to the file stream provider interface.
  • Loading branch information
koculu committed Aug 18, 2023
2 parents 8e210c6 + 0153d53 commit 58a5dcf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/ZoneTree/AbstractFileStream/IFileStreamProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ IFileStream CreateFileStream(
FileOptions options = FileOptions.None);

bool FileExists(string path);

bool DirectoryExists(string path);

void CreateDirectory(string path);

void DeleteFile(string path);

void DeleteDirectory(string path, bool recursive);

string ReadAllText(string path);
Expand All @@ -34,4 +34,8 @@ void Replace(
string destinationBackupFileName);

DurableFileWriter GetDurableFileWriter();

IReadOnlyList<string> GetDirectories(string path);

string CombinePaths(string path1, string path2);
}
18 changes: 14 additions & 4 deletions src/ZoneTree/AbstractFileStream/LocalFileStreamProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ public sealed class LocalFileStreamProvider : IFileStreamProvider
{
public IFileStream CreateFileStream(
string path,
FileMode mode,
FileAccess access,
FileShare share,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize = 4096,
FileOptions options = FileOptions.None)
{
Expand Down Expand Up @@ -49,7 +49,7 @@ public byte[] ReadAllBytes(string path)
}

public void Replace(
string sourceFileName,
string sourceFileName,
string destinationFileName,
string destinationBackupFileName)
{
Expand All @@ -62,4 +62,14 @@ public DurableFileWriter GetDurableFileWriter()
{
return new DurableFileWriter(this);
}

public IReadOnlyList<string> GetDirectories(string path)
{
return Directory.GetDirectories(path);
}

public string CombinePaths(string path1, string path2)
{
return Path.Combine(path1, path2);
}
}
4 changes: 2 additions & 2 deletions src/ZoneTree/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<Authors>Ahmed Yasin Koculu</Authors>
<PackageId>ZoneTree</PackageId>
<Title>ZoneTree</Title>
<ProductVersion>1.6.5.0</ProductVersion>
<Version>1.6.5.0</Version>
<ProductVersion>1.6.6.0</ProductVersion>
<Version>1.6.6.0</Version>
<Authors>Ahmed Yasin Koculu</Authors>
<AssemblyTitle>ZoneTree</AssemblyTitle>
<Description>ZoneTree is a persistent, high-performance, transactional, ACID-compliant ordered key-value database for NET. It can operate in memory or on local/cloud storage.</Description>
Expand Down

0 comments on commit 58a5dcf

Please sign in to comment.