当前位置: 首页>>代码示例>>C#>>正文


C# Manifest.CurrentVersion方法代码示例

本文整理汇总了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;
        }
开发者ID:T145,项目名称:razordbx,代码行数:15,代码来源:KeyValueStore.cs

示例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.");
        }
开发者ID:gnoso,项目名称:razordb,代码行数:22,代码来源:KeyValueStore.cs

示例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));
        }
开发者ID:T145,项目名称:razordbx,代码行数:22,代码来源:ManifestTests.cs

示例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));
        }
开发者ID:T145,项目名称:razordbx,代码行数:27,代码来源:ManifestTests.cs

示例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);
        }
开发者ID:T145,项目名称:razordbx,代码行数:24,代码来源:ManifestTests.cs


注:本文中的Manifest.CurrentVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。