Ejemplo n.º 1
0
        public static async Task IntervalRange()
        {
            var indexInterval = new IndexInterval();

            indexInterval.PrintIndex();
            indexInterval.PrintIndexInterval();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a ReplaceRange message to a store.
        /// </summary>
        /// <param name="changedInterval">The changed interval.</param>
        /// <param name="channelIds">The channel IDs.</param>
        /// <param name="data">The changed data.</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="correlatedHeader">The message header that the message to send is correlated with.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <ReplaceRange> ReplaceRange(IndexInterval changedInterval, IList <long> channelIds, IList <DataItem> data, bool isFinalPart = true, IMessageHeader correlatedHeader = null, IMessageHeaderExtension extension = null)
        {
            var body = new ReplaceRange
            {
                ChangedInterval = changedInterval,
                ChannelIds      = channelIds ?? new List <long>(),
                Data            = data ?? new List <DataItem>(),
            };

            return(SendRequest(body, extension: extension, isMultiPart: true, correlatedHeader: correlatedHeader, isFinalPart: isFinalPart));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a GetPartsByRange message to a store.
        /// </summary>
        /// <param name="uri">The URI of the parent object.</param>
        /// <param name="indexInterval">The index interval.</param>
        /// <param name="includeOverlappingIntervals"><c>true</c> if overlapping intervals should be included; otherwise, <c>false</c>.</param>
        /// <param name="format">The format of the response (XML or JSON).</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetPartsByRange> GetPartsByRange(string uri, IndexInterval indexInterval, bool includeOverlappingIntervals = false, string format = Formats.Xml, IMessageHeaderExtension extension = null)
        {
            var body = new GetPartsByRange
            {
                Uri           = uri ?? string.Empty,
                Format        = format ?? Formats.Xml,
                IndexInterval = indexInterval,
                IncludeOverlappingIntervals = includeOverlappingIntervals,
            };

            return(SendRequest(body, extension: extension));
        }
        /// <summary>
        /// Sends a RequestChannelData message to a producer.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="requestedInterval">The requested interval.</param>
        /// <returns>The message identifier.</returns>
        public virtual long RequestChannelData(string uri, IndexInterval requestedInterval)
        {
            var header = CreateMessageHeader((int)Protocols.ChannelDataFrame, (int)MessageTypes.ChannelDataFrame.RequestChannelData);

            var requestChannelData = new RequestChannelData
            {
                Uri = uri,
                RequestedInterval = requestedInterval
            };

            return(Session.SendMessage(header, requestChannelData));
        }
Ejemplo n.º 5
0
                private IndexInterval EnsureInterval()
                {
                    if (Interval == null)
                    {
                        Interval = new IndexInterval();
                    }

                    if (Interval.StartIndex == null)
                    {
                        Interval.StartIndex = new IndexValue();
                    }

                    if (Interval.EndIndex == null)
                    {
                        Interval.EndIndex = new IndexValue();
                    }

                    return(Interval);
                }
Ejemplo n.º 6
0
        /// <summary>
        /// Sends a GetFrame message to a store.
        /// </summary>
        /// <param name="uri">The frame URI.</param>
        /// <param name="includeAllChannelSecondaryIndexes">Whether or not to include all channel secondary indexes.</param>
        /// <param name="requestedInterval">The requested interval.</param>
        /// <param name="requestedSecondaryIntervals">The requested secondary intervals.</param>
        /// <param name="requestUuid">The request UUID.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetFrame> GetFrame(string uri, bool includeAllChannelSecondaryIndexes, IndexInterval requestedInterval, IList <IndexInterval> requestedSecondaryIntervals, Guid requestUuid, IMessageHeaderExtension extension = null)
        {
            var body = new GetFrame()
            {
                Uri = uri ?? string.Empty,
                IncludeAllChannelSecondaryIndexes = includeAllChannelSecondaryIndexes,
                RequestedInterval           = requestedInterval,
                RequestedSecondaryIntervals = requestedSecondaryIntervals ?? new List <IndexInterval>(),
                RequestUuid = requestUuid,
            };

            return(SendRequest(body, extension: extension));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sends a ReplacePartsByRange message to a store.
        /// </summary>
        /// <param name="uri">The URI of the parent object.</param>
        /// <param name="deleteInterval">The index interval to delete.</param>
        /// <param name="includeOverlappingIntervals"><c>true</c> if overlapping intervals should be included; otherwise, <c>false</c>.</param>
        /// <param name="parts">The map of UIDs and data of the parts being put.</param>
        /// <param name="format">The format of the data (XML or JSON).</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="correlatedHeader">The message header that the message to send is correlated with.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <ReplacePartsByRange> ReplacePartsByRange(string uri, IndexInterval deleteInterval, bool includeOverlappingIntervals, IList <ObjectPart> parts, string format = Formats.Xml, bool isFinalPart = true, IMessageHeader correlatedHeader = null, IMessageHeaderExtension extension = null)
        {
            var body = new ReplacePartsByRange
            {
                Uri            = uri ?? string.Empty,
                Format         = format ?? Formats.Xml,
                DeleteInterval = deleteInterval,
                IncludeOverlappingIntervals = includeOverlappingIntervals,
                Parts = parts ?? new List <ObjectPart>(),
            };

            return(SendRequest(body, extension: extension, isMultiPart: true, correlatedHeader: correlatedHeader, isFinalPart: isFinalPart));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Sends a PartsReplacedByRange message to a customer.
        /// </summary>
        /// <param name="requestUuid">The request UUID.</param>
        /// <param name="uri">The URI.</param>
        /// <param name="deletedInterval">The index interval for the deleted range.</param>
        /// <param name="includeOverlappingIntervals"><c>true</c> if overlapping intervals were included; otherwise, <c>false</c>.</param>
        /// <param name="parts">The map of UIDs and data of the parts that were put.</param>
        /// <param name="changeTime">The change time.</param>
        /// <param name="format">The format of the data (XML or JSON).</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <PartsReplacedByRange> PartsReplacedByRange(Guid requestUuid, string uri, IndexInterval deletedInterval, bool includeOverlappingIntervals, IList <ObjectPart> parts, DateTime changeTime, string format = Formats.Xml, bool isFinalPart = true, IMessageHeaderExtension extension = null)
        {
            var body = new PartsReplacedByRange
            {
                RequestUuid                 = requestUuid,
                Uri                         = uri ?? string.Empty,
                DeletedInterval             = deletedInterval,
                IncludeOverlappingIntervals = includeOverlappingIntervals,
                Parts                       = parts ?? new List <ObjectPart>(),
                Format                      = format ?? Formats.Xml,
                ChangeTime                  = changeTime,
            };

            return(SendNotification(body, extension: extension, isMultiPart: true, isFinalPart: isFinalPart));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Sends a RangeReplaced message to a customer.
        /// </summary>
        /// <param name="changeTime">The time of the change.</param>
        /// <param name="channelIds">The IDs of the channels that are changing.</param>
        /// <param name="changedInterval">The indexes that define the interval that is changing.</param>
        /// <param name="data">The channel data of the changed interval.</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="correlatedHeader">The message header that the message to send is correlated with.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <RangeReplaced> RangeReplaced(DateTime changeTime, IList <long> channelIds, IndexInterval changedInterval, IList <DataItem> data, bool isFinalPart = true, IMessageHeader correlatedHeader = null, IMessageHeaderExtension extension = null)
        {
            var body = new RangeReplaced
            {
                ChangeTime      = changeTime,
                ChangedInterval = changedInterval,
                ChannelIds      = channelIds ?? new List <long>(),
                Data            = data ?? new List <DataItem>(),
            };

            return(SendNotification(body, extension: extension, isMultiPart: true, correlatedHeader: correlatedHeader, isFinalPart: isFinalPart));
        }