Esempio n. 1
0
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(ClusterConfiguration configuration)
        {
            var bodyBuffer = EndecodeUtil.EncodeGroupName(GroupName, configuration.Charset);

            //Header = new FDFSHeader(Consts.FDFS_GROUP_NAME_MAX_LEN, Consts.TRACKER_PROTO_CMD_SERVER_LIST_ONE_GROUP, 0);
            return(bodyBuffer);
        }
Esempio n. 2
0
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(FastDFSOption option)
        {
            var bodyBuffer = EndecodeUtil.EncodeGroupName(GroupName, option.Charset);

            //Header = new FDFSHeader(Consts.FDFS_GROUP_NAME_MAX_LEN, Consts.TRACKER_PROTO_CMD_SERVER_LIST_STORAGE, 0);
            return(bodyBuffer);
        }
Esempio n. 3
0
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(ClusterConfiguration configuration)
        {
            var groupNameBuffer = EndecodeUtil.EncodeGroupName(GroupName, configuration.Charset);
            var fileIdBuffer    = EndecodeUtil.EncodeString(FileId, configuration.Charset);

            //var length = Consts.FDFS_GROUP_NAME_MAX_LEN + fileIdBuffer.Length;
            return(ByteUtil.Combine(groupNameBuffer, fileIdBuffer));
        }
Esempio n. 4
0
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(ClusterConfiguration configuration)
        {
            //消息体长度为group name的最大长度,16

            var bodyBuffer = EndecodeUtil.EncodeGroupName(GropName, configuration.Charset);

            //Header = new FDFSHeader(Consts.FDFS_GROUP_NAME_MAX_LEN, Consts.TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ONE, 0);
            return(bodyBuffer);
        }
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(ClusterConfiguration configuration)
        {
            var groupNameBuffer = EndecodeUtil.EncodeGroupName(GroupName, configuration.Charset);
            //文件偏移量
            var offsetBuffer = EndecodeUtil.EncodeLong(Offset);
            //下载文件的大小,全部下载用0
            var byteSizeBuffer = EndecodeUtil.EncodeLong(ByteSize);
            //文件FileId数组
            var fileIdBuffer = EndecodeUtil.EncodeString(FileId, configuration.Charset);

            //long length = Consts.FDFS_PROTO_PKG_LEN_SIZE + Consts.FDFS_PROTO_PKG_LEN_SIZE + Consts.FDFS_GROUP_NAME_MAX_LEN + FileId.Length;

            return(ByteUtil.Combine(offsetBuffer, byteSizeBuffer, groupNameBuffer, fileIdBuffer));
        }
Esempio n. 6
0
        /// <summary>EncodeBody
        /// </summary>
        public override byte[] EncodeBody(FastDFSOption option)
        {
            string optionString = (Option == MetaDataOption.Overwrite) ? "O" : "M";
            var    optionBuffer = EndecodeUtil.EncodeString(optionString, option.Charset);

            var groupNameBuffer = EndecodeUtil.EncodeGroupName(GroupName, option.Charset);


            var fileIdBuffer   = ByteUtil.StringToByte(FileId, option.Charset);
            var metaDataBuffer = CreateMetaDataBuffer(option, MetaData);

            var fileIdLengthBuffer = ByteUtil.LongToBuffer(fileIdBuffer.Length);
            var metaDataSizeBuffer = ByteUtil.LongToBuffer(metaDataBuffer.Length);

            //int length = Consts.FDFS_PROTO_PKG_LEN_SIZE +  // filename length
            //             Consts.FDFS_PROTO_PKG_LEN_SIZE +  // metadata size
            //             1 +  // operation flag
            //             Consts.FDFS_GROUP_NAME_MAX_LEN +  // group name
            //             fileIdBuffer.Length +  // file name
            //             metaDataBuffer.Length;            // metadata


            return(ByteUtil.Combine(fileIdLengthBuffer, metaDataSizeBuffer, optionBuffer, groupNameBuffer, fileIdBuffer, metaDataBuffer));
        }