本文整理汇总了C#中Manifest.CurrentVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Manifest.CurrentVersion方法的具体用法?C# Manifest.CurrentVersion怎么用?C# Manifest.CurrentVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest.CurrentVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KeyValueStore
// Initializes a new instance of the KeyValueStore.
public KeyValueStore(string baseFileName, RazorCache cache)
{
if (!Directory.Exists (baseFileName))
Directory.CreateDirectory (baseFileName);
_manifest = new Manifest (baseFileName);
_manifest.Logger = RazorDBx.C5.Logger.Log;
int memTableVersion = _manifest.CurrentVersion (0);
CheckForIncompleteJournalRotation (baseFileName, memTableVersion); // Check for a previously aborted journal rotation.
_currentJournaledMemTable = new JournaledMemTable (_manifest.BaseFileName, memTableVersion); // Create new journal for this run (and potentially load from disk, if there was data loaded previously).
_cache = cache == null ? new RazorCache () : cache;
}
示例2: Truncate
public void Truncate() {
_currentJournaledMemTable.Close();
TableManager.Default.Close(this);
foreach (var pair in _secondaryIndexes) {
pair.Value.Close(FastClose);
}
string basePath = Path.GetFullPath(Manifest.BaseFileName);
foreach (string file in Directory.GetFiles(basePath, "*.*", SearchOption.AllDirectories)) {
Helper.DeleteFile(file, false, (msg) => { Manifest.LogMessage(msg); });
}
foreach (string dir in Directory.GetDirectories(basePath, "*.*", SearchOption.AllDirectories)) {
Helper.DeleteFolder(dir, false, (msg) => { Manifest.LogMessage(msg); });
}
_manifest = new Manifest(basePath);
_currentJournaledMemTable = new JournaledMemTable(_manifest.BaseFileName, _manifest.CurrentVersion(0));
_cache = new RazorCache();
_secondaryIndexes = new Dictionary<string, KeyValueStore>(StringComparer.OrdinalIgnoreCase);
Manifest.LogMessage("Database Truncated.");
}
示例3: WriteAndReadManifestMany
public void WriteAndReadManifestMany()
{
var path = Path.GetFullPath ("TestData\\WriteAndReadManifestMany");
if (!Directory.Exists (path)) Directory.CreateDirectory (path);
// Remove the file if it exists
var filename = Config.ManifestFile (path);
if (File.Exists (filename)) File.Delete (filename);
var mf = new Manifest (path);
Assert.AreEqual (0, mf.CurrentVersion (0));
var timer = new Stopwatch ();
timer.Start ();
for (int i = 0; i < 1100; i++) Assert.AreEqual (i + 1, mf.NextVersion (0));
timer.Stop ();
Console.WriteLine ("Committed manifest update in average of {0} ms", (double)timer.ElapsedMilliseconds / 1100.0);
var mf2 = new Manifest (path);
Assert.AreEqual (1100, mf2.CurrentVersion (0));
}
示例4: WriteAndReadManifestThreaded
public void WriteAndReadManifestThreaded()
{
var path = Path.GetFullPath ("TestData\\WriteAndReadManifestMulti");
if (!Directory.Exists (path)) Directory.CreateDirectory (path);
// Remove the file if it exists
var filename = Config.ManifestFile (path);
if (File.Exists (filename)) File.Delete (filename);
var mf = new Manifest (path);
Assert.AreEqual (0, mf.CurrentVersion (0));
int num_threads = 11;
List<Thread> threads = new List<Thread> ();
for (int t = 0; t < num_threads; t++) threads.Add (new Thread (() => { for (int i = 0; i < 100; i++) mf.NextVersion (0); }));
var timer = new Stopwatch ();
timer.Start ();
threads.ForEach ((t) => t.Start ());
threads.ForEach ((t) => t.Join ());
timer.Stop ();
Console.WriteLine ("Committed manifest update in average of {0} ms", (double)timer.ElapsedMilliseconds / 1100.0);
var mf2 = new Manifest (path);
Assert.AreEqual (1100, mf2.CurrentVersion (0));
}
示例5: WriteAndReadManifest
public void WriteAndReadManifest()
{
var path = Path.GetFullPath ("TestData\\WriteAndReadManifest");
if (!Directory.Exists (path)) Directory.CreateDirectory (path);
// Remove the file if it exists
var filename = Config.ManifestFile (path);
if (File.Exists (filename))
File.Delete (filename);
var mf = new Manifest (path);
Assert.AreEqual (path, mf.BaseFileName);
Assert.AreEqual (0, mf.CurrentVersion (0));
Assert.AreEqual (1, mf.NextVersion (0));
Assert.AreEqual (1, mf.CurrentVersion (0));
Assert.AreEqual (1, mf.ManifestVersion);
var mf2 = new Manifest (path);
Assert.AreEqual (0, mf2.ManifestVersion);
Assert.AreEqual (1, mf2.CurrentVersion (0));
Assert.AreEqual (2, mf2.NextVersion (0));
Assert.AreEqual (2, mf2.CurrentVersion (0));
Assert.AreEqual (1, mf2.ManifestVersion);
}