public void TestArchiveWriter() { Random r = new Random(3); _ = new EncodingDefinition(EncodingDefinition.FixedSizeIndividualGuid, EncodingDefinition.FixedSizeIndividualGuid); AdvancedServerDatabaseConfig <AmiKey, AmiKey> config = new AdvancedServerDatabaseConfig <AmiKey, AmiKey>("KV2CPQ", "C:\\Temp\\AMI", true); using (SnapServer server = new SnapServer(config)) { using (SnapClient client = SnapClient.Connect(server)) using (ClientDatabaseBase <AmiKey, AmiKey> db = client.GetDatabase <AmiKey, AmiKey>("KV2CPQ")) { int count = 10000000; Stopwatch sw = new Stopwatch(); sw.Start(); AmiKey key = new AmiKey(); AmiKey value = new AmiKey(); for (int x = count; x >= 0; x--) { key.Timestamp = (ulong)r.Next(); key.TableId = r.Next(); db.Write(key, value); } sw.Stop(); Console.WriteLine(count / sw.Elapsed.TotalSeconds / 1000000); Console.WriteLine(count); } } }
/// <summary> /// Gets a database config. /// </summary> public HistorianServerDatabaseConfig(string databaseName, string mainPath, bool supportsWriting) { m_config = new AdvancedServerDatabaseConfig<HistorianKey, HistorianValue>(databaseName, mainPath, supportsWriting); m_config.ArchiveEncodingMethod = HistorianFileEncodingDefinition.TypeGuid; m_config.StreamingEncodingMethods.Add(HistorianStreamEncodingDefinition.TypeGuid); m_config.StreamingEncodingMethods.Add(EncodingDefinition.FixedSizeCombinedEncoding); m_config.IntermediateFileExtension = ".d2i"; m_config.FinalFileExtension = ".d2"; m_config.DirectoryMethod = ArchiveDirectoryMethod.YearThenMonth; }
/// <summary> /// Gets a database config. /// </summary> public HistorianServerDatabaseConfig(string databaseName, string mainPath, bool supportsWriting) { m_config = new AdvancedServerDatabaseConfig <HistorianKey, HistorianValue>(databaseName, mainPath, supportsWriting); m_config.ArchiveEncodingMethod = HistorianFileEncodingDefinition.TypeGuid; m_config.StreamingEncodingMethods.Add(HistorianStreamEncodingDefinition.TypeGuid); m_config.StreamingEncodingMethods.Add(EncodingDefinition.FixedSizeCombinedEncoding); m_config.IntermediateFileExtension = ".d2i"; m_config.FinalFileExtension = ".d2"; m_config.DirectoryMethod = ArchiveDirectoryMethod.YearThenMonth; }