public void Add(NotificationLog notificationLog) { m_logger.Info($"{notificationLog}"); m_repository.Add(notificationLog); Added?.Invoke(notificationLog); }
public void CouldRotateNotificationLog() { #pragma warning disable 618 Settings.DoAdditionalCorrectnessChecks = false; #pragma warning restore 618 var path = TestUtils.GetPath(); var repoName = "CouldWriteAndReadLog0"; var processConfig = new ProcessConfig(path); StartupConfig.StreamLogBufferPoolFlags = LMDBEnvironmentFlags.NoSync; StartupConfig.StreamBlockIndexFlags = LMDBEnvironmentFlags.NoSync; var slm = new StreamLogManager(processConfig, repoName, null, 10 * 1024, true, true); var log0 = new NotificationLog(slm); // will disable packing log0.ActiveBuffer.Increment(); var count = 3_000_000; using (Benchmark.Run("Log0.Append", count)) { for (long i = 1; i <= count; i++) { log0.Append((StreamLogNotification)(ulong)i); } } Benchmark.Dump(); slm.BufferPool.PrintBuffersAfterPoolDispose = true; log0.Dispose(); slm.Dispose(); }
/// <summary> /// Adds entries to the notificationlog /// </summary> /// <param name="sentToID"></param> private void AddNotificationLog(List <UserInfo> sentToID) { DateTime notificationDate = DateTime.Now; int uploadUserID = currentUserInfo.ID; NotificationLog uNote = new NotificationLog(); uNote.DateSent = DateTime.Now; uNote.CreatedByID = currentUserInfo.ID; using (TMM_DEPLOYEntities ef = new TMM_DEPLOYEntities()) { ef.AddToNotificationLog(uNote); foreach (UserInfo Recip in sentToID) { //ef.Attach(uNote); NotificationLogRecipients logRecip = new NotificationLogRecipients(); logRecip.DateAdded = DateTime.Now; logRecip.NotificationLog = uNote; logRecip.RecipientID = Recip.ID; ef.AddToNotificationLogRecipients(logRecip); //ef.Detach(uNote); } ef.SaveChanges(); } }
/// <summary> /// Creates the e mail notification log. /// </summary> /// <param name="log">The log.</param> /// <returns></returns> public async Task <DatabaseResponse> CreateEMailNotificationLog(NotificationLog log) { try { SqlParameter[] parameters = { new SqlParameter("@CustomerID", SqlDbType.Int), new SqlParameter("@Email", SqlDbType.NVarChar), new SqlParameter("@EmailSubject", SqlDbType.NVarChar), new SqlParameter("@EmailBody", SqlDbType.NVarChar), new SqlParameter("@ScheduledOn", SqlDbType.DateTime), new SqlParameter("@EmailTemplateID", SqlDbType.Int), new SqlParameter("@SendOn", SqlDbType.DateTime), new SqlParameter("@Status", SqlDbType.Int) }; parameters[0].Value = log.CustomerID; parameters[1].Value = log.Email; parameters[2].Value = log.EmailSubject; parameters[3].Value = log.EmailBody; parameters[4].Value = log.ScheduledOn; parameters[5].Value = log.EmailTemplateID; parameters[6].Value = log.SendOn; parameters[7].Value = log.Status; _DataHelper = new DataAccessHelper("z_EmailNotificationsLogEntry", parameters, _configuration); DataTable dt = new DataTable(); int result = await _DataHelper.RunAsync(dt); // 107 /100 DatabaseResponse response = new DatabaseResponse(); response = new DatabaseResponse { ResponseCode = result }; return(response); } catch (Exception ex) { Log.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical)); throw (ex); } finally { _DataHelper.Dispose(); } }
public override Task <Empty> Write(NotificationLog request, ServerCallContext context) { m_logger.Info($"{context.Peer} {request}"); m_notificationService.Add(request); return(Task.FromResult(m_empty)); }
void Awake() { if (instance != this && instance != null) { Destroy(instance.gameObject); } instance = this; }
public NotificationLog AddLog(Notification notification, string logText) { var log = new NotificationLog { Notification = notification, Log = logText }; return(GetContext().Add(log).Entity); }
public NotificationLog AddNotificationLog(NotificationLog notificationLog) { using (var c = new ServiceDBModel()) { c.NotificationLogs.Add(notificationLog); c.SaveChanges(); return(notificationLog); } }
public static NotificationLogDto MapToDto(NotificationLog notificationLog) { return(new NotificationLogDto { ErrorMessage = notificationLog.ErrorMessage, Id = notificationLog.Id, NotificationId = notificationLog.NotificationId, SendSucceeded = notificationLog.SendSucceeded, TryDate = notificationLog.TryDate }); }
// Use this for initialization void Awake() { StageBuilder.scale = scale; stage = new Stage(lair.ToString(), floor_material, wall_material, fluff_builder); stage.Create(); player = GameObject.FindGameObjectWithTag("Player"); player.transform.position = playerSpawn; Instantiate(boss, bossSpawn, Quaternion.identity); log = GameObject.FindWithTag("Log").GetComponent<NotificationLog>(); fluff_builder.DestroyFluff(); }
/// <summary> /// A lists of every notification associated with an account /// </summary> /// <param name="log">Specifies that only notifications with the given log level value should be listed.</param> /// <param name="page">Used to return a particular page withing the list.</param> /// <param name="pageSize">Used to specify the amount of list items to return per page.</param> /// <returns></returns> public NotificationResult GetAccountNotifications(NotificationLog? log, int? page, int? pageSize) { var request = new RestRequest(); request.Resource = RequestUri.NotificationsUri; if (log.HasValue) request.AddParameter("Log", (int)log); if (page.HasValue) request.AddParameter("Page", page); if (pageSize.HasValue) request.AddParameter("PageSize", pageSize); return Execute<NotificationResult>(request); }
private static void LogMessage(string deviceId, string json, string resp) { using (NotificationLogDao dao = new NotificationLogDao()) { NotificationLog log = new NotificationLog(); log.ReceiverId = deviceId; log.JSONMessage = json; log.FCMResponse = resp; dao.Insert(log); } }
public void CouldWriteReadLog0MoveGT() { #pragma warning disable 618 Settings.DoAdditionalCorrectnessChecks = false; #pragma warning restore 618 var path = TestUtils.GetPath(); var repoName = "CouldWriteAndReadLog0"; var processConfig = new ProcessConfig(path); StartupConfig.StreamLogBufferPoolFlags = LMDBEnvironmentFlags.NoSync; StartupConfig.StreamBlockIndexFlags = LMDBEnvironmentFlags.NoSync; var slm = new StreamLogManager(processConfig, repoName, null, 10 * 1024, true, true); var log0 = new NotificationLog(slm); // will disable packing log0.ActiveBuffer.Increment(); var count = 3_000_000; using (Benchmark.Run("Log0.Append", count)) { for (long i = 1; i <= count; i++) { log0.Append((StreamLogNotification)(ulong)i); } } using (Benchmark.Run("Log0 MoveGT", count)) { using (var reader = new NotificationLog.Reader(log0, CancellationToken.None, false)) { for (long i = 0; i < count; i++) { if (reader.MoveGT((ulong)i)) { if (reader.CurrentVersion != (ulong)(i + 1)) { Assert.Fail($"reader.CurrentVersion {reader.CurrentVersion} != [(ulong) (i + 1)] {i + 1}"); } } } } } // readerTask.Wait(); Benchmark.Dump(); slm.BufferPool.PrintBuffersAfterPoolDispose = true; log0.Dispose(); slm.Dispose(); }
private void SendNotificationDestination(NotificationDestination notification) { String jsonConfig = null; String provaider = null; String title = null; String message = null; String typeNotification = null; NotificationLog notificationLogSave = null; if (notification.NotificationMessageBase != null) { title = ResolveParamsMessageDinamyc(notification.NotificationMessageBase.TitleMessage, notification.NotificationMessageBase.TitleParams, notification.ParamsTitleBase); message = ResolveParamsMessageDinamyc(notification.NotificationMessageBase.MessageBase, notification.NotificationMessageBase.MessageParams, notification.ParamsMessageBase); } typeNotification = notification.CatalogNotificationType.NotificationType; if (!String.IsNullOrEmpty(notification.TitleSpecifict)) { title = notification.TitleSpecifict; } if (!String.IsNullOrEmpty(notification.MessageSpecifict)) { message = notification.MessageSpecifict; } jsonConfig = notification.CatalogNotificationType.NotificationConfig.JsonConfig; provaider = notification.CatalogNotificationType.NotificationConfig.ProvaiderNotification; if (notification.Notify) { notificationLogSave = NotificationLogs.SaveNotificationLogs(new NotificationLog() { IdNotificationCondition = notification.NotificationConditions.IdNotificationCondition, TaleName = notification.TableName, TableKeys = notification.TableKeys, IdTypeNotification = notification.IdNotificationType, EventName = notification.NotificationConditions.NotificationEvents.EventName, TableEvent = notification.NotificationConditions.NotificationEvents.TableName, DateSend = DateTime.Now, TitleMessage = title, Message = message, WasSend = false, BaseSend = notification.BaseSend }); if (Enum.TryParse(typeNotification, out TypeNotification typeNotificationEnum) && Notify.Send(notification.BaseSend, title, message, jsonConfig, typeNotificationEnum, provaider, out String a)) { notificationLogSave.WasSend = true; NotificationLogs.SaveNotificationLogs(notificationLogSave); } } }
public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime) { var entities = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey <ShipyardComponent>()); foreach (var entity in entities) { if (((newTime.Tick - 1) % (int)Math.Round(Constants.TicksPerDay * 365.25 * 5)) == 0) { var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>().GetCurrentAbsolutePosition(entityLookup); EntityUtility.CreateShip(entityLookup, $"Discovery {Interlocked.Increment(ref m_shipId)}", position); } } }
public List <NotificationLog> GetNotificationLog(int userId, int itemId, DateTime startTime, DateTime endTime) { try { IndustrialMonitoringEntities entities = new IndustrialMonitoringEntities(); List <NotificationItemsLog> notificationItemsLogs = entities.NotificationItemsLogs.Where(x => x.Time >= startTime & x.Time <= endTime).OrderByDescending(x => x.Time).ToList(); List <UsersItemsPermission> usersItemsPermissions = entities.UsersItemsPermissions.Where(x => x.UserId == userId).ToList(); List <NotificationLog> result = new List <NotificationLog>(); foreach (NotificationItemsLog log in notificationItemsLogs) { if (log.NotificationItem.ItemId == itemId) { if (usersItemsPermissions.Any(x => x.ItemId == log.NotificationItem.ItemId)) { int itemId2 = log.NotificationItem.ItemId; string itemName = log.NotificationItem.Item.ItemName; string notificationMsg = log.NotificationItem.NotificationMsg; DateTime dateTime = log.Time; bool hasFault = !log.Value; var tabsItem = entities.TabsItems.FirstOrDefault(x => x.ItemId == itemId); string category = ""; if (tabsItem != null) { category = tabsItem.Tab.TabName; } NotificationLog notificationLog = new NotificationLog(itemId2, itemName, notificationMsg, dateTime, hasFault, category); result.Add(notificationLog); } } } return(result); } catch (Exception ex) { Logger.LogMonitoringServiceLibrary(ex); return(null); } }
/// <summary> /// A list of only notifications associated with a given CallSid /// </summary> /// <param name="callSid">An alphanumeric string used for identification of calls.</param> /// <param name="log">Specifies that only notifications with the given log level value should be listed.</param> /// <param name="page">Used to return a particular page withing the list.</param> /// <param name="pageSize">Used to specify the amount of list items to return per page.</param> /// <returns></returns> public NotificationResult GetCallNotifications(string callSid, NotificationLog? log, int? page, int? pageSize) { Require.Argument("callSid", callSid); var request = new RestRequest(); request.Resource = RequestUri.CallNotificationUri; request.AddUrlSegment("CallSid", callSid); if (log.HasValue) request.AddParameter("Log", (int)log); if (page.HasValue) request.AddParameter("Page", page); if (pageSize.HasValue) request.AddParameter("PageSize", pageSize); return Execute<NotificationResult>(request); }
public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime) { var entitiesList = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey(typeof(PopulationComponent))); foreach (var entity in entitiesList) { var component = entity.GetRequiredComponent <PopulationComponent>(); var populations = component.Populations; foreach (var population in populations) { var newPops = PopulationUtility.ProcessTick(population, out var _); component.SetPopulation(population.RacialTemplate, newPops); } } }
private TextResponse ProcessLog(NotificationLog log, string requestUrlBase) { var response = new TextResponse(JsonConvert.SerializeObject(log.NotificationList.ToArray())); var sb = new StringBuilder(); ResponseHelper.Header.Link.AppendValue( sb, $"{requestUrlBase}/{log.NotificationLogId}", neurUL.Common.Constants.Response.Header.Link.Relation.Self ); if (log.HasFirstNotificationLog) { ResponseHelper.Header.Link.AppendValue( sb, $"{requestUrlBase}/{log.FirstNotificationLogId}", neurUL.Common.Constants.Response.Header.Link.Relation.First ); } if (log.HasPreviousNotificationLog) { ResponseHelper.Header.Link.AppendValue( sb, $"{requestUrlBase}/{log.PreviousNotificationLogId}", neurUL.Common.Constants.Response.Header.Link.Relation.Previous ); } if (log.HasNextNotificationLog) { ResponseHelper.Header.Link.AppendValue( sb, $"{requestUrlBase}/{log.NextNotificationLogId}", neurUL.Common.Constants.Response.Header.Link.Relation.Next ); } response.Headers.Add(neurUL.Common.Constants.Response.Header.Link.Key, sb.ToString()); response.Headers.Add(neurUL.Common.Constants.Response.Header.TotalCount.Key, log.TotalCount.ToString()); return(response); }
public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime) { var entitiesList = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey(typeof(AgeComponent))); foreach (var entity in entitiesList) { AgeComponent ageComponent = entity.GetRequiredComponent <AgeComponent>(); double survivalChance = 0.998; /* * GetSurvivalChance( * ageComponent.GetAge(GameData.CurrentDate).Days, * ageComponent.Template.MeanDaysBetweenFailures, * ageComponent.Template.AgeRiskDoublingDays); */ if (m_rng.NextDouble() > survivalChance) { // death } } }
public async Task CheckNotificationsAndSend() { try { var notSentNotifications = await AuditUnitOfWork.NotificationRepository.GetAsync(a => a.Sent == false); if (notSentNotifications.Any()) { List <NotificationLog> notificationLogs = new List <NotificationLog>(); notSentNotifications.ForEach(async notification => { var result = await EmailService.SendAsync("", notification.ToEmails.Split(',').ToList(), "", notification.Message); if (result.Succeeded) { notification.Sent = result.Succeeded; AuditUnitOfWork.NotificationRepository.Update(notification); } NotificationLog notificationLog = new NotificationLog(); notificationLog.NotificationId = notification.Id; notificationLog.SendSucceeded = result.Succeeded; notificationLog.ErrorMessage = result.ErrorMessage; notificationLog.TryDate = DateTime.Now; notificationLogs.Add(notificationLog); }); await AuditUnitOfWork.NotificationLogRepository.AddAsync(notificationLogs); await AuditUnitOfWork.SaveAsync(); } } catch (Exception ex) { await ErrorLoger.Log(ex); } }
private async static Task UpdateGraph(string notificationLogBaseUrl, string position, INeuronRepository neuronRepository, ITerminalRepository terminalRepository, IRepository <Settings> settingsRepository) { AssertionConcern.AssertStateTrue(long.TryParse(position, out long lastPosition), $"Specified position value of '{position}' is not a valid integer (long)."); AssertionConcern.AssertMinimum(lastPosition, 0, nameof(position)); var eventSourcingUrl = notificationLogBaseUrl + "/"; var notificationClient = new HttpNotificationClient(); // get current log var currentNotificationLog = await notificationClient.GetNotificationLog(eventSourcingUrl, string.Empty); NotificationLog processingEventInfoLog = null; if (lastPosition == StandardNotificationLogClient.StartPosition) { // get first log from current processingEventInfoLog = await notificationClient.GetNotificationLog(eventSourcingUrl, currentNotificationLog.FirstNotificationLogId); } else { processingEventInfoLog = currentNotificationLog; while (lastPosition < processingEventInfoLog.DecodedNotificationLogId.Low) { processingEventInfoLog = await notificationClient.GetNotificationLog(eventSourcingUrl, processingEventInfoLog.PreviousNotificationLogId); } } // while processing logid is not equal to newly retrieved currenteventinfolog while (processingEventInfoLog.DecodedNotificationLogId.Low <= currentNotificationLog.DecodedNotificationLogId.Low) { foreach (Notification e in processingEventInfoLog.NotificationList) { if (e.SequenceId > lastPosition) { var eventName = e.GetEventName(); StandardNotificationLogClient.logger.Info($"Processing event '{eventName}' with Sequence Id-{e.SequenceId.ToString()} for Neuron '{e.Id}"); if (await new EventDataProcessor().Process(neuronRepository, terminalRepository, eventName, e.Data, e.AuthorId)) { // update current position lastPosition = e.SequenceId; if (!processingEventInfoLog.HasNextNotificationLog && processingEventInfoLog.NotificationList.Last() == e) { await settingsRepository.Save( new Settings() { Id = Guid.Empty.ToString(), LastPosition = lastPosition.ToString() } ); } } else { StandardNotificationLogClient.logger.Warn($"Processing failed."); } } } if (processingEventInfoLog.HasNextNotificationLog) { processingEventInfoLog = await notificationClient.GetNotificationLog(eventSourcingUrl, processingEventInfoLog.NextNotificationLogId); } else { break; } } }
public static async Task <IEnumerable <NotificationData> > UpdateCacheGetNotifications(NotificationLog notificationLog, INeuronQueryClient neuronGraphQueryClient, string avatarUrl, IDictionary <string, Neuron> cache) { var ids = new List <string>(); var ns = notificationLog.NotificationList.ToList(); ns.ForEach(n => { ids.Add(n.AuthorId); ids.Add(n.Id); dynamic d = JsonConvert.DeserializeObject(n.Data); // NeuronCreated if (n.TypeName.Contains(EventTypeNames.NeuronCreated.ToString())) { // RegionId if (d.RegionId != null) { ids.Add(d.RegionId.ToString()); } } // TerminalCreated else if (n.TypeName.Contains(EventTypeNames.TerminalCreated.ToString())) { // PresynapticNeuronId ids.Add(d.PresynapticNeuronId.ToString()); // PostsynapticNeuronId ids.Add(d.PostsynapticNeuronId.ToString()); } } ); ids.RemoveAll(i => cache.ContainsKey(i)); ids = new List <string>(ids.Distinct()); if (ids.Count() > 0) { (await neuronGraphQueryClient.GetNeurons(avatarUrl, neuronQuery: new NeuronQuery() { Id = ids.ToArray() })) .ToList() .ForEach(n => cache.Add(n.Id, n)); } return(notificationLog.NotificationList.ToArray().Select(n => Common.Helper.CreateNotificationData(n, cache))); }
public NotificationLog Insert(NotificationLog log) { _context.NotificationLogs.Add(log); _context.SaveChanges(); return(log); }
public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime) { var entities = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey <EllipticalOrbitalPositionComponent>()); var entitiesWithMovementOrders = new Dictionary <EntityId, Entity>(); foreach (var entity in entities) { var unitDesign = entity.GetOptionalComponent <OrbitalUnitDesignComponent>(); var orders = entity.GetOptionalComponent <OrdersComponent>(); if (MovementOrderUtility.CanExecuteOrders(orders, unitDesign)) { entitiesWithMovementOrders.Add(entity.Id, entity); } else { var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>(); var body = entity.GetRequiredComponent <OrbitalBodyCharacteristicsComponent>(); position.InitializeOrbitalValuesIfNeeded(entityLookup, body.Mass); } } var currentTime = newTime - new TimeOffset(1); foreach (var entity in entitiesWithMovementOrders.Values) { var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>(); var orders = entity.GetRequiredComponent <OrdersComponent>(); var unitDesign = entity.GetRequiredComponent <OrbitalUnitDesignComponent>(); var order = orders.GetActiveOrder <MovementOrderBase>(); var newOrder = order.PrepareIntercept(entityLookup, position.GetCurrentAbsolutePosition(entityLookup), unitDesign.MaxSpeedPerTick, currentTime); if (newOrder != null) { orders.UpdateOrder(newOrder); } } foreach (var entity in entities) { var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>(); if (entitiesWithMovementOrders.ContainsKey(entity.Id)) { var orders = entity.GetRequiredComponent <OrdersComponent>(); var order = orders.GetActiveOrder <MovementOrderBase>(); var absolutePosition = position.GetCurrentAbsolutePosition(entityLookup); position.SetCurrentAbsolutePosition(order.MoveOneTick(absolutePosition)); } else { var oldRelativePosition = position.RelativePosition; position.RelativePosition = position.GetRelativeOrbitalPositionAtTime(newTime); if (oldRelativePosition.DistanceTo(position.RelativePosition) > 1E11 && oldRelativePosition.X != 0.0) { Log.Info($"Entity jumped from {oldRelativePosition.X},{oldRelativePosition.Y} to {position.RelativePosition.X},{position.RelativePosition.Y}"); } } } foreach (var entity in entitiesWithMovementOrders.Values) { var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>(); var orders = entity.GetRequiredComponent <OrdersComponent>(); var order = orders.GetActiveOrder <MovementOrderBase>(); if (order.TryMarkAsResolved(entityLookup, position.GetCurrentAbsolutePosition(entityLookup), out var newOrder)) { orders.RemoveOrder(order); } else if (newOrder != null) { orders.UpdateOrder(newOrder); } if (!orders.HasActiveOrder <MovementOrderBase>()) { var text = string.Format(CultureInfo.InvariantCulture, OurResources.NotificationFinishedOrders, entity.Id); notificationLog.AddEvent(new Notification(text, newTime, true, entity.Id)); } } }
public async Task Write(NotificationLog notificationLog) { await m_client.WriteAsync(notificationLog); }
/// <summary> /// Node factory method that constructs a derived Node object type from the specified Node object. /// </summary> /// <param name="store">Store object.</param> /// <param name="document">Xml document to construct new Node from.</param> /// <returns>Downcasts the derived Node object back to a Node that can then be explicitly casted back up.</returns> static public Node NodeFactory(Store store, XmlDocument document) { XmlElement nodeObject = document.DocumentElement[XmlTags.ObjectTag]; Node rNode = null; switch (nodeObject.GetAttribute(XmlTags.TypeAttr)) { case "Node": rNode = new Node(document); break; case "DirNode": rNode = new DirNode(document); break; case "FileNode": rNode = new FileNode(document); break; case "LinkNode": rNode = new LinkNode(document); break; case "StoreFileNode": rNode = new StoreFileNode(document); break; case "Collection": rNode = new Collection(store, document); break; case "Tombstone": rNode = new Node(document); break; case "LocalDatabase": rNode = new LocalDatabase(store, document); break; case "Identity": rNode = new Identity(document); break; case "Member": rNode = new Member(document); break; case "Domain": rNode = new Domain(store, document); break; case "Policy": rNode = new Policy.Policy(document); break; case "POBox": rNode = new POBox.POBox(store, document); break; case "Subscription": rNode = new Subscription(document); break; case "NotificationLog": rNode = new NotificationLog(store, document); break; default: rNode = new Node(document); break; } return(rNode); }
public void CouldWriteInParallelAllValuesNonZero() { #pragma warning disable 618 Settings.DoAdditionalCorrectnessChecks = false; #pragma warning restore 618 var path = TestUtils.GetPath(); var repoName = "CouldWriteAndReadLog0"; var processConfig = new ProcessConfig(path); StartupConfig.StreamLogBufferPoolFlags = LMDBEnvironmentFlags.NoSync; StartupConfig.StreamBlockIndexFlags = LMDBEnvironmentFlags.NoSync; var slm = new StreamLogManager(processConfig, repoName, null, 10 * 1024, true, true); var log0 = new NotificationLog(slm); // will disable packing log0.ActiveBuffer.Increment(); var count = 2 * 1024 * 1024; List <Task> tasks = new List <Task>(); var taskCount = 4; for (int j = 0; j < taskCount; j++) { tasks.Add(Task.Run(() => { try { using (Benchmark.Run("Log0.Append", count * taskCount)) { for (long i = 1; i <= count; i++) { log0.Append((StreamLogNotification)(ulong)i); // Thread.Yield(); } } } catch (Exception ex) { Console.WriteLine("EX: " + ex); } })); } Task.WhenAll(tasks).Wait(); Benchmark.Dump(); using (Benchmark.Run("Log0 MoveNext", count * taskCount)) { var chunkCursor = log0.BlockIndex.GetBlockRecordCursor(StreamLogId.Log0Id); var readCount = 0; while (chunkCursor.MoveNext()) { var record = chunkCursor.Current.Value; if ((long)record.Version >= count * taskCount) { break; } if (record.IsPacked) { break; } var chunk = log0.RentChunkFromRecord(record); for (ulong i = 0; i < 1024 * 1024; i++) { var position = NotificationLog.Log0ItemPosition(chunk.Pointer, (long)(chunk.FirstVersion + i), out _); var value = *(ulong *)position; if (value == 0) { Assert.Fail("Zero value at: " + (chunk.FirstVersion + i)); } readCount++; } chunk.DisposeFree(); } //var c = log0.GetContainerCursor(false); //while (c.MoveNext()) //{ // if (c.CurrentValue.ReadUInt64(0) == 0) // { // // Console.WriteLine($"c.CurrentValue == 0 at {c.CurrentKey}"); // Assert.Fail($"c.CurrentValue == 0 at {c.CurrentKey}"); // } // readCount++; //} //c.Dispose(); // Assert.AreEqual(count * taskCount, readCount); Console.WriteLine("READ COUNT M: " + readCount * 1.0 / (1024 * 1024)); } // readerTask.Wait(); slm.BufferPool.PrintBuffersAfterPoolDispose = true; log0.Dispose(); slm.Dispose(); }
void Start() { playerInstance.GetComponent<PlayerController>().decrementCurrentFloor(); //to distinguish as tutorial level log = GameObject.FindWithTag("Log").GetComponent<NotificationLog>(); log.PassMessage("Press WASD to move with\nrespect to the mouse\n\nDouble tap a direction\nto dash\n\nPress space to skip anytime\n"); }
/// <summary> /// Node factory method that constructs a derived Node object type from the specified ShallowNode object. /// </summary> /// <param name="collection">Collection object associated with the specified Node object.</param> /// <param name="shallowNode">ShallowNode object to construct new Node from.</param> /// <returns>Downcasts the derived Node object back to a Node that can then be explicitly casted back up.</returns> static public Node NodeFactory(Collection collection, ShallowNode shallowNode) { Node rNode = null; switch (shallowNode.Type) { case "Node": rNode = new Node(collection, shallowNode); break; case "DirNode": rNode = new DirNode(collection, shallowNode); break; case "FileNode": rNode = new FileNode(collection, shallowNode); break; case "LinkNode": rNode = new LinkNode(collection, shallowNode); break; case "StoreFileNode": rNode = new StoreFileNode(collection, shallowNode); break; case "Collection": rNode = new Collection(collection.StoreReference, shallowNode); break; case "Tombstone": rNode = new Node(collection, shallowNode); break; case "LocalDatabase": rNode = new LocalDatabase(collection.StoreReference, shallowNode); break; case "Identity": rNode = new Identity(collection, shallowNode); break; case "Member": rNode = new Member(collection, shallowNode); break; case "Domain": rNode = new Domain(collection.StoreReference, shallowNode); break; case "Policy": rNode = new Policy.Policy(collection, shallowNode); break; case "POBox": rNode = new POBox.POBox(collection.StoreReference, shallowNode); break; case "Subscription": rNode = new Subscription(collection, shallowNode); break; case "NotificationLog": rNode = new NotificationLog(collection.StoreReference, shallowNode); break; default: rNode = new Node(collection, shallowNode); break; } return(rNode); }
public void Create(NotificationLog notificationLog) { _context.NotificationLog.Add(notificationLog); }