Exemple #1
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _hasValue = reader.Read <bool>();
                _value    = reader.Read <TSource>();
                _id       = reader.Read <ulong>();

                var hasInner = reader.Read <bool>();

                if (hasInner)
                {
#pragma warning disable IDE0079 // Remove unnecessary suppression.
#pragma warning disable CA2000  // Dispose objects before losing scope. (Observer will be owned by inner subscription.)

                    var observer = new ThrottleObserver(this);

                    var subscription = LoadInner <TThrottle>(reader, observer);
                    observer.Subscription    = subscription;
                    _cancelable.Subscription = subscription;

#pragma warning restore CA2000
#pragma warning restore IDE0079
                }
            }
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _currentKey    = reader.Read <TKey>();
                _hasCurrentKey = reader.Read <bool>();
            }
Exemple #3
0
                protected override void LoadStateCore(IOperatorStateReader reader)
                {
                    base.LoadStateCore(reader);

                    _currentId = reader.Read <ulong>();
                    _value     = reader.Read <TSource>();
                }
Exemple #4
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _nextTick  = reader.Read <DateTimeOffset>();
                _remaining = reader.Read <int>();
            }
Exemple #5
0
            /// <summary>
            /// Restores the counter.
            /// </summary>
            /// <param name="reader">The reader.</param>
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _counter          = reader.Read <long>();
                _nextAbsoluteTime = reader.Read <DateTimeOffset?>();
            }
Exemple #6
0
            /// <summary>
            /// Restores the state whether the timer had already fired before the checkpoint.
            /// </summary>
            /// <param name="reader">The reader.</param>
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _hasFired         = reader.Read <bool>();
                _nextAbsoluteTime = reader.Read <DateTimeOffset?>();
            }
Exemple #7
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _running      = reader.Read <bool>();
                _currentIndex = reader.Read <int>();
            }
Exemple #8
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _isStopped = reader.Read <bool>();
                var subscriptionCount = reader.Read <int>();

                Debug.Assert(_innerSubscriptions != null);
                Debug.Assert(_innerSubscriptions.Count == 0);

                if (subscriptionCount > 0)
                {
                    for (int i = 0; i < subscriptionCount; ++i)
                    {
#pragma warning disable IDE0079 // Remove unnecessary suppression.
#pragma warning disable CA2000  // Dispose objects before losing scope. (Observer will be owned by inner subscription.)

                        var observer = new Observer(this);

                        var subscription = LoadInner <TCollection>(reader, observer);
                        observer.Subscription = subscription;
                        _innerSubscriptions.Add(subscription);

#pragma warning restore CA2000
#pragma warning restore IDE0079
                    }
                }
            }
Exemple #9
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _hasValue = reader.Read <bool>();
                _res      = reader.Read <TSource>();
            }
Exemple #10
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _nextTick  = reader.Read <DateTimeOffset>();
                _nextOpen  = reader.Read <DateTimeOffset>();
                _nextClose = reader.Read <DateTimeOffset>();
            }
        /// <summary>
        /// Loads the state of the operator.
        /// </summary>
        /// <param name="reader">Reader to read operator state from.</param>
        protected override void LoadStateCore(IOperatorStateReader reader)
        {
            base.LoadStateCore(reader);

            OutputSubscriptionDisposed = reader.Read <bool>();
            CollectorUri = reader.Read <Uri>();
            TollboothUri = reader.Read <Uri>();
            _refCount    = reader.Read <int>();
        }
Exemple #12
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _nextTick  = reader.Read <DateTimeOffset>();
                _remaining = reader.Read <int>();

                _recovered = true;
                DoSubscribeTask(recovery: true);
            }
Exemple #13
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                var length = reader.Read <int>();

                for (var i = 0; i < length; ++i)
                {
                    _values.Add(reader.Read <int>());
                }
            }
Exemple #14
0
                public void LoadState(IOperatorStateReader reader)
                {
                    _done = reader.Read <bool>();

                    var n = reader.Read <int>();

                    _queue = new Queue <TSource>(n);

                    for (var i = 0; i < n; i++)
                    {
                        _queue.Enqueue(reader.Read <TSource>());
                    }
                }
Exemple #15
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _buffers = CreateQueue();

                var count = reader.Read <int>();

                for (var i = 0; i < count; i++)
                {
                    var buffer = reader.Read <List <TSource> >();
                    _buffers.Enqueue(buffer);
                }
            }
Exemple #16
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                CheckpointWatermark = reader.Read <long>();
                HighWatermark       = CheckpointWatermark;
            }
Exemple #17
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                var signaled      = reader.Read <bool>();
                var firstDisposed = reader.Read <bool>();

                if (firstDisposed)
                {
                    _firstSubscription.Dispose();
                }

                if (signaled)
                {
                    _otherObserver.MarkSignaled();
                }
            }
Exemple #18
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _buffer = reader.Read <List <TSource> >();

                HasRecovered = true;
            }
Exemple #19
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _count = reader.Read <long>();

                _recovered = true;
                DoSubscribeTask(recovery: true);
            }
Exemple #20
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                for (var i = 0; i < _done.Length; i++)
                {
                    _done[i] = reader.Read <bool>();
                }
            }
Exemple #21
0
            private void LoadWindow(IOperatorStateReader reader)
            {
                _currentWindowUri = reader.Read <Uri>();

                if (TryGetInner(_currentWindowUri, out var window))
                {
                    _currentWindow = window.CreateObserver();
                }
            }
Exemple #22
0
        /// <summary>
        /// Loads the state of the operator.
        /// </summary>
        /// <param name="reader">The reader to load state from.</param>
        protected override void LoadStateCore(IOperatorStateReader reader)
        {
            base.LoadStateCore(reader);

            var hasValue = (uint)0;
            var complete = (uint)0;

            for (int i = 0; i < Arity; i++)
            {
                hasValue |= (reader.Read <bool>() ? 1U : 0U) << i;
            }

            for (int i = 0; i < Arity; i++)
            {
                complete |= (reader.Read <bool>() ? 1U : 0U) << i;
            }

            _state |= (complete << 16) | hasValue;
        }
Exemple #23
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _hasLatest = reader.Read <bool>();
                _latest    = reader.Read <ulong>();
                _isStopped = reader.Read <bool>();

                var hasInner = reader.Read <bool>();

                if (hasInner)
                {
                    var observer = new i(this, _latest);

                    var subscription = LoadInner <TSource>(reader, observer);
                    observer.Subscription           = subscription;
                    _innerSubscription.Subscription = subscription;
                }
            }
Exemple #24
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _subscribed = reader.Read <bool>();
                if (_subscribed)
                {
                    DoSubscribeTask(true);
                }
            }
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                lock (_queue)
                {
                    _completed = reader.Read <bool>();

                    var length = reader.Read <int>();
                    _queue.Capacity    = length;
                    _initialQueueCount = length;

                    for (int i = 0; i < length; ++i)
                    {
                        var element = reader.Read <TResult>();
                        _queue.Add(element);
                    }
                }
            }
Exemple #26
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _valuesIndex = reader.Read <int>();

                if (_valuesIndex >= Params._values.Length)
                {
                    DoSubscribeTask(recovery: true);
                }
            }
Exemple #27
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _retryCount = reader.Read <int>();

                if (IsDisposed)
                {
                    _subscription.Dispose();
                }
            }
Exemple #28
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                base.LoadStateCore(reader);

                _gateOpened = reader.Read <bool>();

                if (_gateOpened)
                {
                    _otherSubscription.Dispose();
                }
            }
Exemple #29
0
        /// <summary>
        /// Loads version information from the specified state reader and asserts that the version name tag matches with the specified versioned artifact's.
        /// </summary>
        /// <param name="reader">Reader to read version state from.</param>
        /// <param name="versioned">Version artifact whose version name tag to compart to the version information read from the reader.</param>
        /// <returns>The version number read from the state reader.</returns>
        /// <exception cref="InvalidOperationException">Thrown if the state reader read a version name tag that doesn't match the name tag in the specified version artifact.</exception>
        public static Version LoadVersionInfo(this IOperatorStateReader reader, IVersioned versioned)
        {
            // The call to TryRead will only ever return false if the operator is transitioning.
            // Otherwise, the constructor call for the reader would have thrown.
            if (!reader.TryRead <string>(out string name) || (versioned is ITransitioningOperator && versioned.Name != name))
            {
                return(null);
            }

            if (versioned.Name != name)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Failed to restore state for artifact '{0}' with expected tag '{1}'. State tag is '{2}'.", versioned.ToString(), versioned.Name, name));
            }

            var major    = reader.Read <int>();
            var minor    = reader.Read <int>();
            var build    = reader.Read <int>();
            var revision = reader.Read <int>();

            return(Versioning.GetVersion(major, minor, build, revision));
        }
Exemple #30
0
            protected override void LoadStateCore(IOperatorStateReader reader)
            {
                Debug.Assert(reader != null);

                base.LoadStateCore(reader);

                var bufferId = reader.Read <string>();

                _buffer = Storage.GetList <TSource>(bufferId);

                HasRecovered = true;
            }