示例#1
0
        public static int AlignedTotalFileLength(int alignment, string aeronDirectory, string archiveChannel, string serviceControlChannel, string ingressChannel, string serviceName, string authenticator)
        {
            if (aeronDirectory == null)
            {
                throw new ArgumentNullException(nameof(aeronDirectory));
            }
            if (archiveChannel == null)
            {
                throw new ArgumentNullException(nameof(archiveChannel));
            }
            if (serviceControlChannel == null)
            {
                throw new ArgumentNullException(nameof(serviceControlChannel));
            }

            return(BitUtil.Align(MarkFileHeaderEncoder.BLOCK_LENGTH + (6 * VarAsciiEncodingEncoder.LengthEncodingLength()) + aeronDirectory.Length + archiveChannel.Length + serviceControlChannel.Length + (null == ingressChannel ? 0 : ingressChannel.Length) + (null == serviceName ? 0 : serviceName.Length) + (null == authenticator ? 0 : authenticator.Length), alignment));
        }
        public static void CheckHeaderLength(
            string aeronDirectory,
            string controlChannel,
            string ingressChannel,
            string serviceName,
            string authenticator)
        {
            var lengthRequired =
                MarkFileHeaderEncoder.BLOCK_LENGTH +
                5 * VarAsciiEncodingEncoder.LengthEncodingLength() +
                (aeronDirectory?.Length ?? 0) +
                (controlChannel?.Length ?? 0) +
                (ingressChannel?.Length ?? 0) +
                (serviceName?.Length ?? 0) +
                (authenticator?.Length ?? 0);

            if (lengthRequired > HEADER_LENGTH)
            {
                throw new ClusterException($"MarkFile length required {lengthRequired} great than {HEADER_LENGTH}.");
            }
        }
示例#3
0
        public static void CheckHeaderLength(
            string aeronDirectory,
            string archiveChannel,
            string serviceControlChannel,
            string ingressChannel,
            string serviceName,
            string authenticator)
        {
            if (aeronDirectory == null)
            {
                throw new ArgumentNullException(nameof(aeronDirectory));
            }
            if (archiveChannel == null)
            {
                throw new ArgumentNullException(nameof(archiveChannel));
            }
            if (serviceControlChannel == null)
            {
                throw new ArgumentNullException(nameof(serviceControlChannel));
            }

            var lengthRequired =
                MarkFileHeaderEncoder.BLOCK_LENGTH +
                6 * VarAsciiEncodingEncoder.LengthEncodingLength() +
                aeronDirectory.Length +
                archiveChannel.Length +
                serviceControlChannel.Length +
                (ingressChannel?.Length ?? 0) +
                (serviceName?.Length ?? 0) +
                (authenticator?.Length ?? 0);

            if (lengthRequired > HEADER_LENGTH)
            {
                throw new ClusterException($"MarkFile length required {lengthRequired} great than {HEADER_LENGTH}.");
            }
        }