internal static void SaveStateCore(ISubscription subscription, IOperatorStateWriterFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            subscription.Accept(new SaveStateVisitor(factory));
        }
        /// <summary>
        /// Saves the state of operators in the <paramref name="subscription"/> to state writers obtained by the specified state writer factory.
        /// </summary>
        /// <param name="subscription">The subscription to save state for.</param>
        /// <param name="factory">State writer factory to obtain state writers for operators from.</param>
        public static void SaveState(ISubscription subscription, IOperatorStateWriterFactory factory)
        {
            if (subscription == null)
            {
                throw new ArgumentNullException(nameof(subscription));
            }

            SaveStateCore(subscription, factory);
        }
示例#3
0
            public OperatorStateWriter(IOperatorStateWriterFactory factory, ISerializer serializer, Stream stream)
            {
                Debug.Assert(factory != null);
                Debug.Assert(serializer != null);
                Debug.Assert(stream != null);

                _factory    = factory;
                _serializer = serializer;
                _stream     = stream;

                _stream.Write(s_zeroLength, 0, s_zeroLength.Length);
                _begin = _stream.Position;
            }
示例#4
0
        /// <summary>
        /// Saves the state of the specified stateful operator using a writer obtained from the specified state writer factory.
        /// </summary>
        /// <param name="factory">Factory to create an operator state writer to write operator state to.</param>
        /// <param name="node">Operator whose state to write.</param>
        public static void SaveState(this IOperatorStateWriterFactory factory, IStatefulOperator node)
        {
            using var writer = factory.Create(node);

            SaveState(writer, node);
        }
 /// <summary>
 /// Saves the state of operators in the subscription to state writers obtained by the specified state writer factory.
 /// </summary>
 /// <param name="factory">State writer factory to obtain state writers for operators from.</param>
 public void SaveState(IOperatorStateWriterFactory factory) => SaveStateCore(_subscription, factory);
 public SaveStateVisitor(IOperatorStateWriterFactory factory)
 {
     _factory = factory;
 }