Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
49 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace OrigoDB.Core.Storage | ||
{ | ||
public class FileSnapshot : Snapshot | ||
{ | ||
public string Name { get { return ToString(); } } | ||
|
||
|
||
public FileSnapshot(DateTime created, ulong lastEntryId) : base(created, lastEntryId) | ||
{ | ||
|
||
} | ||
|
||
const string Pattern = @"^(?<entryNr>\d{9}).snapshot$"; | ||
|
||
readonly private static Regex _parser = new Regex(Pattern); | ||
|
||
public static FileSnapshot FromFileInfo(string fileName, DateTime created) | ||
{ | ||
Match m = _parser.Match(fileName); | ||
if (!m.Success) throw new ArgumentException("Invalid snapshot filename"); | ||
ulong entryNr = m.Groups["entryNr"].Value.ParsePadded(); | ||
return new FileSnapshot(created, entryNr); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return String.Format("{0:000000000}.snapshot", LastEntryId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters