|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectorg.csource.fastdfs.ProtoCommon
public class ProtoCommon
protocol common functions
嵌套类摘要 | |
---|---|
static class |
ProtoCommon.RecvHeaderInfo
receive header info |
static class |
ProtoCommon.RecvPackageInfo
receive package info |
方法摘要 | |
---|---|
static boolean |
activeTest(Socket sock)
send ACTIVE_TEST command to server, test if network is ok and the server is alive |
static int |
buff2int(byte[] bs,
int offset)
buff convert to int |
static long |
buff2long(byte[] bs,
int offset)
buff convert to long |
static void |
closeSocket(Socket sock)
send quit command to server and close socket |
static String |
genSlaveFilename(String master_filename,
String prefix_name,
String ext_name)
generate slave filename |
static String |
getIpAddress(byte[] bs,
int offset)
buff convert to ip address |
static String |
getStorageStatusCaption(byte status)
|
static String |
getToken(String remote_filename,
int ts,
String secret_key)
get token for file URL |
static byte[] |
long2buff(long n)
long convert to buff (big-endian) |
static String |
md5(byte[] source)
md5 function |
static String |
pack_metadata(NameValuePair[] meta_list)
pack metadata array to string |
static byte[] |
packHeader(byte cmd,
long pkg_len,
byte errno)
pack header by FastDFS transfer protocol |
static ProtoCommon.RecvHeaderInfo |
recvHeader(InputStream in,
byte expect_cmd,
long expect_body_len)
receive pack header |
static ProtoCommon.RecvPackageInfo |
recvPackage(InputStream in,
byte expect_cmd,
long expect_body_len)
receive whole pack |
static NameValuePair[] |
split_metadata(String meta_buff)
split metadata to name value pair array |
static NameValuePair[] |
split_metadata(String meta_buff,
String recordSeperator,
String filedSeperator)
split metadata to name value pair array |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
public static final byte FDFS_PROTO_CMD_QUIT
public static final byte TRACKER_PROTO_CMD_SERVER_LIST_GROUP
public static final byte TRACKER_PROTO_CMD_SERVER_LIST_STORAGE
public static final byte TRACKER_PROTO_CMD_SERVER_DELETE_STORAGE
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITHOUT_GROUP_ONE
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_FETCH_ONE
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_UPDATE
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ONE
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_FETCH_ALL
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITHOUT_GROUP_ALL
public static final byte TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ALL
public static final byte TRACKER_PROTO_CMD_RESP
public static final byte FDFS_PROTO_CMD_ACTIVE_TEST
public static final byte STORAGE_PROTO_CMD_UPLOAD_FILE
public static final byte STORAGE_PROTO_CMD_DELETE_FILE
public static final byte STORAGE_PROTO_CMD_SET_METADATA
public static final byte STORAGE_PROTO_CMD_DOWNLOAD_FILE
public static final byte STORAGE_PROTO_CMD_GET_METADATA
public static final byte STORAGE_PROTO_CMD_UPLOAD_SLAVE_FILE
public static final byte STORAGE_PROTO_CMD_QUERY_FILE_INFO
public static final byte STORAGE_PROTO_CMD_UPLOAD_APPENDER_FILE
public static final byte STORAGE_PROTO_CMD_APPEND_FILE
public static final byte STORAGE_PROTO_CMD_MODIFY_FILE
public static final byte STORAGE_PROTO_CMD_TRUNCATE_FILE
public static final byte STORAGE_PROTO_CMD_RESP
public static final byte FDFS_STORAGE_STATUS_INIT
public static final byte FDFS_STORAGE_STATUS_WAIT_SYNC
public static final byte FDFS_STORAGE_STATUS_SYNCING
public static final byte FDFS_STORAGE_STATUS_IP_CHANGED
public static final byte FDFS_STORAGE_STATUS_DELETED
public static final byte FDFS_STORAGE_STATUS_OFFLINE
public static final byte FDFS_STORAGE_STATUS_ONLINE
public static final byte FDFS_STORAGE_STATUS_ACTIVE
public static final byte FDFS_STORAGE_STATUS_NONE
public static final byte STORAGE_SET_METADATA_FLAG_OVERWRITE
public static final byte STORAGE_SET_METADATA_FLAG_MERGE
public static final int FDFS_PROTO_PKG_LEN_SIZE
public static final int FDFS_PROTO_CMD_SIZE
public static final int FDFS_GROUP_NAME_MAX_LEN
public static final int FDFS_IPADDR_SIZE
public static final int FDFS_DOMAIN_NAME_MAX_SIZE
public static final int FDFS_VERSION_SIZE
public static final int FDFS_STORAGE_ID_MAX_SIZE
public static final String FDFS_RECORD_SEPERATOR
public static final String FDFS_FIELD_SEPERATOR
public static final int TRACKER_QUERY_STORAGE_FETCH_BODY_LEN
public static final int TRACKER_QUERY_STORAGE_STORE_BODY_LEN
public static final byte FDFS_FILE_EXT_NAME_MAX_LEN
public static final byte FDFS_FILE_PREFIX_MAX_LEN
public static final byte FDFS_FILE_PATH_LEN
public static final byte FDFS_FILENAME_BASE64_LENGTH
public static final byte FDFS_TRUNK_FILE_INFO_LEN
public static final byte ERR_NO_ENOENT
public static final byte ERR_NO_EIO
public static final byte ERR_NO_EBUSY
public static final byte ERR_NO_EINVAL
public static final byte ERR_NO_ENOSPC
public static final byte ECONNREFUSED
public static final byte ERR_NO_EALREADY
public static final long INFINITE_FILE_SIZE
public static final long APPENDER_FILE_SIZE
public static final long TRUNK_FILE_MARK_SIZE
public static final long NORMAL_LOGIC_FILENAME_LENGTH
public static final long TRUNK_LOGIC_FILENAME_LENGTH
protected static final int PROTO_HEADER_CMD_INDEX
protected static final int PROTO_HEADER_STATUS_INDEX
方法详细信息 |
---|
public static String getStorageStatusCaption(byte status)
public static byte[] packHeader(byte cmd, long pkg_len, byte errno) throws UnsupportedEncodingException
cmd
- which command to sendpkg_len
- package body lengtherrno
- status code, should be (byte)0
UnsupportedEncodingException
public static ProtoCommon.RecvHeaderInfo recvHeader(InputStream in, byte expect_cmd, long expect_body_len) throws IOException
in
- input streamexpect_cmd
- expect response commandexpect_body_len
- expect response package body length
IOException
public static ProtoCommon.RecvPackageInfo recvPackage(InputStream in, byte expect_cmd, long expect_body_len) throws IOException
in
- input streamexpect_cmd
- expect response commandexpect_body_len
- expect response package body length
IOException
public static NameValuePair[] split_metadata(String meta_buff)
meta_buff
- metadata
public static NameValuePair[] split_metadata(String meta_buff, String recordSeperator, String filedSeperator)
meta_buff
- metadatarecordSeperator
- record/row seperatorfiledSeperator
- field/column seperator
public static String pack_metadata(NameValuePair[] meta_list)
meta_list
- metadata array
public static void closeSocket(Socket sock) throws IOException
sock
- the Socket object
IOException
public static boolean activeTest(Socket sock) throws IOException
sock
- the Socket object
IOException
public static byte[] long2buff(long n)
n
- long number
public static long buff2long(byte[] bs, int offset)
bs
- the buffer (big-endian)offset
- the start position based 0
public static int buff2int(byte[] bs, int offset)
bs
- the buffer (big-endian)offset
- the start position based 0
public static String getIpAddress(byte[] bs, int offset)
bs
- the buffer (big-endian)offset
- the start position based 0
public static String md5(byte[] source) throws NoSuchAlgorithmException
source
- the input buffer
NoSuchAlgorithmException
public static String getToken(String remote_filename, int ts, String secret_key) throws UnsupportedEncodingException, NoSuchAlgorithmException, MyException
remote_filename
- the filename return by FastDFS serverts
- unix timestamp, unit: secondsecret_key
- the secret key
UnsupportedEncodingException
NoSuchAlgorithmException
MyException
public static String genSlaveFilename(String master_filename, String prefix_name, String ext_name) throws MyException
master_filename
- the master filename to generate the slave filenameprefix_name
- the prefix name to generate the slave filenameext_name
- the extension name of slave filename, null for same as the master extension name
MyException
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |