示例#1
0
 public NotificationLog(StreamLogManager streamLogManager)
     : base(streamLogManager, streamLogManager.Log0State, StreamLogManager.MaxBufferSize, "_NotificationLog")
 {
     _ = State.TryAcquireLock(streamLogManager.Wpid, streamLogManager.ProcessConfig);
     if (!Init())
     {
         RotateActiveBlock(nextVersion: 1, nextTimestamp: default, StreamLogManager.MaxBufferSize);
示例#2
0
        internal StreamLog(StreamLogManager streamLogManager,
                           StreamLogState state,
                           int ratePerMinuteHint = 0,
                           string textId         = null)
        {
            _streamLogManager = streamLogManager;
            State             = state;

            WriteMode       = state.GetWriteMode();
            _streamLogFlags = State.StreamLogFlags;

            if (state.GetRatePerMinute() == 0)
            {
                if (ratePerMinuteHint > 0)
                {
                    // hinted rate stored as negative
                    State.SetRatePerMinute(-ratePerMinuteHint);
                }
                else
                {
                    State.SetRatePerMinute(MinChunkSize);
                }
            }
            else
            {
                if (ratePerMinuteHint > 0 && Slid != StreamLogId.Log0Id)
                {
                    // hinted rate stored as negative
                    State.SetRatePerMinute(-ratePerMinuteHint);
                }
            }

            // TODO State init must check for RO
            if (_streamLogManager.BlockIndex.GetIsCompleted(State.StreamLogId))
            {
                State.SetIsCompleted();
            }

            _textId = textId;
        }