Esempio n. 1
0
        void DoInEvent(string name, Action <IObjectDBTransaction> consume)
        {
            _eventSw.Restart();
            var tr = _odb.StartWritingTransaction().GetAwaiter().GetResult();

            _eventSw.Stop();

            consume(tr);
        }
Esempio n. 2
0
        public PersistentBuildCache(string dir)
        {
            var cacheIndex = 0;

            while (cacheIndex < 100)
            {
                _mutex = new Mutex(false, @"Global\bbcoreCache" + cacheIndex);
                if (_mutex.WaitOne(10))
                {
                    break;
                }
                _mutex.Dispose();
                _mutex = null;
                cacheIndex++;
            }
            if (_mutex == null)
            {
                return;
            }
            _dir = dir + "/cache" + (cacheIndex == 0 ? "" : cacheIndex.ToString());
            if (!new DirectoryInfo(_dir).Exists)
            {
                Directory.CreateDirectory(_dir);
            }

            _diskFileCollection = new OnDiskFileCollection(_dir);
            _kvdb = new KeyValueDB(new KeyValueDBOptions
            {
                FileCollection = _diskFileCollection,
                Compression    = new SnappyCompressionStrategy(),
                FileSplitSize  = 100000000
            });
            _odb = new ObjectDB();
            _odb.Open(_kvdb, false);
            using (var tr = _odb.StartWritingTransaction().Result)
            {
                _tsConfiguration = tr.InitRelation <ITSConfigurationTable>("tsconf");
                _tsRelation      = tr.InitRelation <ITSFileBuildCacheTable>("ts");
                _tsHashedContent = tr.InitRelation <IHashedContentTable>("hashedContent");
                tr.Commit();
            }
        }
Esempio n. 3
0
 void Initialize()
 {
     _dbdir = Path.GetTempPath() + "/deleteMeDB";
     Directory.Delete(_dbdir, true);
     Directory.CreateDirectory(_dbdir);
     _fc   = new OnDiskFileCollection(_dbdir);
     _kvdb = new KeyValueDB(new KeyValueDBOptions
     {
         Compression    = new SnappyCompressionStrategy(),
         FileSplitSize  = 100 * 1024 * 1024,
         FileCollection = _fc
     });
     _kvdb.Logger = this;
     _odb         = new ObjectDB();
     _odb.Open(_kvdb, false);
     using (var tr = _odb.StartWritingTransaction().GetAwaiter().GetResult())
     {
         _personRelation = tr.InitRelation <IPersonTable>("Person");
         tr.Commit();
     }
 }
Esempio n. 4
0
        public PersistentBuildCache(string dir)
        {
            _dir = dir + "/cache";
            if (!new DirectoryInfo(_dir).Exists)
            {
                Directory.CreateDirectory(_dir);
            }

            _diskFileCollection = new OnDiskFileCollection(_dir);
            _kvdb = new KeyValueDB(new KeyValueDBOptions {
                FileCollection = _diskFileCollection,
                Compression    = new SnappyCompressionStrategy(),
                FileSplitSize  = 100000000
            });
            _odb = new ObjectDB();
            _odb.Open(_kvdb, false);
            using (var tr = _odb.StartWritingTransaction().Result)
            {
                _tsConfiguration = tr.InitRelation <ITSConfigurationTable>("tsconf");
                _tsRelation      = tr.InitRelation <ITSFileBuildCacheTable>("ts");
                tr.Commit();
            }
        }