Module: Fastdfs::Client::ProtoCommon

Defined in:
lib/fastdfs-client/proto_common.rb

Constant Summary collapse

TRACKER_BODY_LEN =
40
IPADDR =
16...31
PORT =
31...-1
SIZE_LEN =
9
HEAD_LEN =
10
EXTNAME_LEN =
6
GROUP_NAME_MAX_LEN =
16
RECV_MAX_LEN =
2 * 1024
RECORD_SEPERATOR =
"\u0001"
FILE_SEPERATOR =
"\u0002"
SET_METADATA_FLAG_OVERWRITE =
"O"
SET_METADATA_FLAG_MERGE =
"M"

Class Method Summary collapse

Class Method Details

.header_bytes(cmd, hex_long, erron = 0) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/fastdfs-client/proto_common.rb', line 22

def self.header_bytes(cmd, hex_long, erron=0)
  hex_bytes = hex_long.to_eight_buffer
  header = hex_bytes.fill(0, hex_bytes.length...HEAD_LEN)
  header[8] = cmd
  header[9] = erron
  header
end