public static bool Configuration(PlyClient plyClient, string sqlConnection) { if (plyClient == null) { throw new ArgumentNullException($"PlyClient is Null"); } if (string.IsNullOrEmpty(sqlConnection)) { throw new ArgumentNullException($"SQL Connection value is NullOrEmpty"); } _plyClient = plyClient; var sql_activation = SQLProvider.Initialized(sqlConnection); return(sql_activation); }
private static void MediumInsert(PlyClient plyClient) { var output = plyClient.Insert(Guid.NewGuid().ToString(), DataGenerator.CreateMediumDocument(), "Medium").GetPlyCode(); Console.WriteLine($"Medium: {output}"); }
private static void SmallInsert(PlyClient plyClient) { var output = plyClient.Insert(Guid.NewGuid().ToString(), DataGenerator.CreateSmallDocument(), "Small").GetPlyCode(); Console.WriteLine($"Small: {output}"); }
private static void NanoInsert(PlyClient plyClient) { var output = plyClient.Insert(Guid.NewGuid().ToString(), DataGenerator.CreateNanoDocument(), "Nano").GetPlyCode(); Console.WriteLine($"Nano: {output}"); }
public static void Execute() { PlyClient plyClient = new PlyClient( Configuration.ClientUrl, Configuration.ClientContainer, Configuration.ClientToken); // nano var totalNanoRequests = Configuration.NanoCount; List <Task> plyClientTasks = new List <Task>(); for (int request = 0; request < totalNanoRequests; request++) { plyClientTasks.Add(new Task(() => NanoInsert(plyClient))); } Parallel.ForEach(plyClientTasks, (t) => { t.Start(); }); Task.WaitAll(plyClientTasks.ToArray()); // micro plyClientTasks.Clear(); var totalMicroRequests = Configuration.MicroCount; for (int request = 0; request < totalMicroRequests; request++) { plyClientTasks.Add(new Task(() => MicroInsert(plyClient))); } Parallel.ForEach(plyClientTasks, (t) => { t.Start(); }); Task.WaitAll(plyClientTasks.ToArray()); // small plyClientTasks.Clear(); var totalSmallRequests = Configuration.SmallCount; for (int request = 0; request < totalSmallRequests; request++) { plyClientTasks.Add(new Task(() => SmallInsert(plyClient))); } Parallel.ForEach(plyClientTasks, (t) => { t.Start(); }); Task.WaitAll(plyClientTasks.ToArray()); // medium plyClientTasks.Clear(); var totalMediumRequests = Configuration.MediumCount; for (int request = 0; request < totalMediumRequests; request++) { plyClientTasks.Add(new Task(() => MediumInsert(plyClient))); } Parallel.ForEach(plyClientTasks, (t) => { t.Start(); }); Task.WaitAll(plyClientTasks.ToArray()); // large plyClientTasks.Clear(); var totalLargeRequests = Configuration.LargeCount; for (int request = 0; request < totalLargeRequests; request++) { plyClientTasks.Add(new Task(() => LargeInsert(plyClient))); } Parallel.ForEach(plyClientTasks, (t) => { t.Start(); }); Task.WaitAll(plyClientTasks.ToArray()); }
public static void Execute() { Console.WriteLine($"Starting Client Audit"); // build client PlyClient plyClient = new PlyClient( Configuration.ClientUrl, Configuration.ClientContainer, Configuration.ClientToken); // setup var key_1 = Guid.NewGuid().ToString(); var key_2 = Guid.NewGuid().ToString(); var key_3 = Guid.NewGuid().ToString(); var data_2 = Guid.NewGuid().ToString(); List <string> tags = new List <string>(); tags.Add("Update"); tags.Add("V2Operation"); List <string> tags_2 = new List <string>(); tags_2.Add("UpdateThisTag1"); tags_2.Add("DeleteThisTag2"); tags_2.Add("DeleteThisTag3"); // insert var output = plyClient.Insert(key_1, Guid.NewGuid().ToString(), tags).GetPlyData(); Console.WriteLine($"InsertKey: {output}"); // testing duplicate insert -- should fail output = plyClient.Insert(key_1, Guid.NewGuid().ToString(), tags).GetPlyRecord(); Console.WriteLine($"InsertKey: {output}"); output = plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne").GetPlyData(); Console.WriteLine($"InsertKey: {output}"); output = plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne", "TagTwo").GetPlyData(); Console.WriteLine($"InsertKey: {output}"); output = plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne", "TagTwo", "TagThree").GetPlyData(); Console.WriteLine($"InsertKey: {output}"); output = plyClient.InsertTag(key_1, "TestTag").GetPlyData(); Console.WriteLine($"InsertTag: {output}"); output = plyClient.Insert(key_3, Guid.NewGuid().ToString(), tags_2).GetPlyTrace(); Console.WriteLine($"InsertKey: {output}"); // select output = plyClient.Select(key_1).GetPlyData(); Console.WriteLine($"SelectKey: {output}"); var output_2 = plyClient.SelectTags().GetPlyData().GetPlyList(); output_2.ForEach(i => Console.WriteLine($"SelectTags: {i}")); output = plyClient.SelectCount("Update").GetPlyData(); Console.WriteLine($"SelectTagCount: {output}"); output_2 = plyClient.Select("TagOne", 3).GetPlyList(); output_2.ForEach(i => Console.WriteLine($"SelectKeyList: {i}")); output_2 = plyClient.SelectTags(key_1).GetPlyData().GetPlyList(); output_2.ForEach(i => Console.WriteLine($"SelectTagsByKey: {i}")); // update output = plyClient.Update(key_1, key_2).GetPlyData(); Console.WriteLine($"UpdateKey: {output}"); output = plyClient.UpdateData(key_2, data_2).GetPlyData(); Console.WriteLine($"UpdateData: {output}"); output = plyClient.UpdateTag(key_2, "TestTag", "TestTagV2").GetPlyData(); Console.WriteLine($"UpdateTagByKey: {output}"); output = plyClient.UpdateTag("UpdateThisTag1", "UpdateThisTag2").GetPlyData(); Console.WriteLine($"UpdateTag: {output}"); // delete output = plyClient.DeleteTag(key_2, "TestTagV2").GetPlyRecord(); Console.WriteLine($"DeleteTagByKey: {output}"); output = plyClient.Delete(key_2).GetPlyStatus().ToString(); Console.WriteLine($"DeleteKey: {output}"); output = plyClient.DeleteTag("DeleteThisTag2").GetPlyData(); Console.WriteLine($"DeleteTag: {output}"); output = plyClient.DeleteTags(key_3).GetPlyCode(); Console.WriteLine($"DeleteTagsByKey: {output}"); }
public void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, ILogger log) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); Initializer.Execute(); // build client PlyClient plyClient = new PlyClient( Configuration.Url, Configuration.Container, Configuration.Token); // setup var key_1 = Guid.NewGuid().ToString(); var key_2 = Guid.NewGuid().ToString(); var key_3 = Guid.NewGuid().ToString(); var data_2 = Guid.NewGuid().ToString(); List <string> tags = new List <string>(); tags.Add("Update"); tags.Add("V2Operation"); List <string> tags_2 = new List <string>(); tags_2.Add("UpdateThisTag1"); tags_2.Add("DeleteThisTag2"); tags_2.Add("DeleteThisTag3"); // insert plyClient.Insert(key_1, Guid.NewGuid().ToString(), tags); plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne"); plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne", "TagTwo"); plyClient.Insert(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "TagOne", "TagTwo", "TagThree"); plyClient.InsertTag(key_1, "TestTag"); plyClient.Insert(key_3, Guid.NewGuid().ToString(), tags_2); // select plyClient.Select(key_1); plyClient.SelectTags(); plyClient.SelectCount("TagTwo"); plyClient.Select("TagOne", 3); plyClient.SelectTags(key_1); // update plyClient.Update(key_1, key_2); plyClient.UpdateData(key_2, data_2); plyClient.UpdateTag(key_2, "TestTag", "TestTagV2"); plyClient.UpdateTag("UpdateThisTag1", "UpdateThisTag2"); // delete plyClient.DeleteTag(key_2, "TestTagV2"); plyClient.Delete(key_2); plyClient.DeleteTag("DeleteThisTag2"); plyClient.DeleteTags(key_3); }