private void InitializePerviouslyStoredCollections()
        {
            //needed to ensure that internalMetadataCollection exists so that argument exception is not thrown by LMDB.
            _collectionTable[METADATA_COLLECTION] = new LMDBCollection(CreateCollectionInternal(METADATA_COLLECTION, typeof(string)));
            //ITransaction transaction = BeginTransaction(null, true);
            StorageResult <byte[]> result = GetDocument <string, byte[]>(METADATA_COLLECTION, "collections");

            if (result.Document != null)
            {
                Dictionary <string, LMDBCollection> collectionList;
                using (ClusteredMemoryStream ms = new ClusteredMemoryStream(result.Document))
                {
                    using (CompactReader reader = new CompactBinaryReader(ms))
                    {
                        collectionList = SerializationUtility.DeserializeDictionary <string, LMDBCollection>(reader);
                    }
                }
                foreach (var col in collectionList)
                {
                    CreateCollection(col.Key, null, null);
                    if (LoggerManager.Instance.StorageLogger != null && LoggerManager.Instance.StorageLogger.IsInfoEnabled)
                    {
                        LoggerManager.Instance.StorageLogger.Info("LMDB.Initialize", "Previously stored collection :" + col.Key + " initialized successfully. ");
                    }
                    _collectionTable[col.Key].Stats.DataSize      = col.Value.Stats.DataSize;
                    _collectionTable[col.Key].Stats.DocumentCount = col.Value.Stats.DocumentCount;
                }
            }
        }
Exemple #2
0
        public object Clone()
        {
            LMDBCollection collection = new LMDBCollection(null);

            collection.Stats.DataSize      = _stats.DataSize;
            collection.Stats.DocumentCount = _stats.DocumentCount;
            return(collection);
        }