예제 #1
0
        private void Initialize(InformationEvent infoEvent)
        {
            this.informationEvent = infoEvent;

            // All information records are currently barrier records
            this.isBarrierRecord = true;
        }
예제 #2
0
        private static void RaiseInformationEvent(string eventName)
        {
            // Usamos el nombre "_event" porque "event" es una keyword.
            InformationEvent _event = new InformationEvent();

            _event.EventName = eventName;
            _event.Notify();
        }
예제 #3
0
 internal InformationLogRecord(
     LogicalSequenceNumber lsn,
     PhysicalLogRecord linkedPhysicalRecord,
     InformationEvent informationEvent)
     : base(LogRecordType.Information, lsn, linkedPhysicalRecord)
 {
     this.Initialize(informationEvent);
     this.UpdateApproximateDiskSize();
 }
예제 #4
0
        /// <summary>
        /// Append information record
        /// </summary>
        public void Information(InformationEvent informationEvent)
        {
            lock (lsnOrderingLock)
            {
                this.LastInformationRecord = new InformationLogRecord(
                    this.CurrentLogTailLsn,
                    this.LastLinkedPhysicalRecord,
                    informationEvent);

                this.LogManager.PhysicalLogWriter.InsertBufferedRecord(this.LastInformationRecord);
            }
        }
예제 #5
0
        private void AnalysePacket(MCPPacket packet)
        {
            lock (ipCounterTable)
            {
                IPAddress ipKey = packet.IpAddress;
                bool      isNew = false;
                if (ipCounterTable.ContainsKey(ipKey))
                {
                    if (ipCounterTable[ipKey] < packet.Number || packet.State == MCPState.Reset)
                    {
                        ipCounterTable[ipKey] = packet.Number;
                        isNew = true;
                    }
                }
                else
                {
                    ipCounterTable.Add(ipKey, packet.Number);
                    isNew = true;
                }

                if (isNew)
                {
                    switch (packet.State)
                    {
                    case MCPState.Information:
                        InformationEvent?.Invoke(this, new InformationEventArgs()
                        {
                            Address = packet.IpAddress, Port = packet.Port, Information = packet.Information
                        });
                        break;

                    case MCPState.MaintainConnection:
                        MaintainEvent?.Invoke(this, new MaintainEventArgs()
                        {
                            Address = packet.IpAddress, Port = packet.Port
                        });
                        break;

                    case MCPState.Close:
                        CloseEvent?.Invoke(this, new CloseEventArgs()
                        {
                            Address = packet.IpAddress, Port = packet.Port
                        });
                        ipCounterTable.Remove(ipKey);
                        break;

                    default: break;
                    }
                }
            }
        }
예제 #6
0
        public async Task FlushInformationRecordAsync(
            InformationEvent type,
            bool closeLog,
            string flushInitiator)
        {
            lock (lsnOrderingLock)
            {
                this.Information(type);
                if (closeLog)
                {
                    this.LogManager.PrepareToClose();
                }
            }

            await this.LogManager.FlushAsync(flushInitiator).ConfigureAwait(false);
        }
예제 #7
0
 /// -------------------------------------------------------------------------------------------------------------------------------------------------------------
 /// Awake
 /// -------------------------------------------------------------------------------------------------------------------------------------------------------------
 /// <summary> The Awake method of MonoBehaviour interface. </summary>
 private void Awake()
 {
     // Event instances are created.
     EventSetCamera      = new CameraEvent();
     EventSetInformation = new InformationEvent();
 }
예제 #8
0
 private InformationLogRecord()
     : base()
 {
     this.informationEvent = InformationEvent.Invalid;
     this.isBarrierRecord  = false;
 }
예제 #9
0
 internal InformationLogRecord(LogRecordType recordType, ulong recordPosition, long lsn)
     : base(recordType, recordPosition, lsn)
 {
     Utility.Assert(recordType == LogRecordType.Information, "recordType == LogRecordType.Information");
     this.informationEvent = InformationEvent.Invalid;
 }