private void WebLogMapper(string channel, LogLevel level, string text) { if (gui != null) { switch (level) { case LogLevel.Debug: gui.WriteToChannel(channel, Core.Log.LogEntryKind.Debug, text); break; case LogLevel.Error: gui.WriteToChannel(channel, Core.Log.LogEntryKind.Error, text); break; case LogLevel.Warning: gui.WriteToChannel(channel, Core.Log.LogEntryKind.Warning, text); break; default: gui.WriteToChannel(channel, Core.Log.LogEntryKind.Message, text); break; } return; } switch (level) { case LogLevel.Debug: logger.Debug(text); break; case LogLevel.Error: logger.Error(text); break; case LogLevel.Warning: logger.Warning(text); break; default: logger.Message(text); break; } }
private RocksDbStore(string fileName) { AppDomain.CurrentDomain.ProcessExit += (s, e) => Shutdown(); logger.Message("RocksDBStore: " + fileName); this.fileName = fileName.Replace("\\", "/"); var path = Path.GetDirectoryName(fileName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } //TODO check options var options = new DbOptions() .SetCreateIfMissing(true) .SetCreateMissingColumnFamilies(true); var columnFamilies = new ColumnFamilies { { "default", new ColumnFamilyOptions().OptimizeForPointLookup(256) }, //{ "test", new ColumnFamilyOptions() // //.SetWriteBufferSize(writeBufferSize) // //.SetMaxWriteBufferNumber(maxWriteBufferNumber) // //.SetMinWriteBufferNumberToMerge(minWriteBufferNumberToMerge) // .SetMemtableHugePageSize(2 * 1024 * 1024) // .SetPrefixExtractor(SliceTransform.CreateFixedPrefix((ulong)8)) // .SetBlockBasedTableFactory(bbto) //}, }; try { var partitionList = RocksDb.ListColumnFamilies(options, path); foreach (var partition in partitionList) { columnFamilies.Add(partition, new ColumnFamilyOptions()); } } catch { logger.Warning("Inital start, no partitions created yet!"); } logger.Message("Opening database at: " + path); _db = RocksDb.Open(options, path, columnFamilies); }
private RocksDbStore(string fileName, Logger logger) { AppDomain.CurrentDomain.ProcessExit += (s, e) => Shutdown(); this.logger = logger; logger.Message("RocksDBStore: " + fileName); this.fileName = fileName.Replace("\\", "/"); var path = Path.GetDirectoryName(fileName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } //TODO check options var options = new DbOptions() .SetCreateIfMissing(true) .SetCreateMissingColumnFamilies(true); var columnFamilies = new ColumnFamilies { { "default", new ColumnFamilyOptions().OptimizeForPointLookup(256) }, }; try { var partitionList = RocksDb.ListColumnFamilies(options, path); foreach (var partition in partitionList) { columnFamilies.Add(partition, new ColumnFamilyOptions()); } } catch { logger.Warning("Inital start, no partitions created yet!"); } logger.Message("Opening database at: " + path); _db.Add(fileName, RocksDb.Open(options, path, columnFamilies)); }