mirror of
https://github.com/happyfish100/fastdfs-client-java.git
synced 2026-09-22 14:09:27 +00:00
query file info support two combined flags
This commit is contained in:
@@ -113,6 +113,9 @@ public class ProtoCommon {
|
||||
public static final byte FDFS_RW_MODE_WRITEONLY = 2;
|
||||
public static final byte FDFS_RW_MODE_BOTH = FDFS_RW_MODE_READONLY + FDFS_RW_MODE_WRITEONLY;
|
||||
|
||||
public static final byte FDFS_QUERY_FINFO_FLAGS_NOT_CALC_CRC32 = 1;
|
||||
public static final byte FDFS_QUERY_FINFO_FLAGS_KEEP_SILENCE = 2;
|
||||
|
||||
private ProtoCommon() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1540,9 +1540,14 @@ public class StorageClient {
|
||||
*
|
||||
* @param group_name the group name of storage server
|
||||
* @param remote_filename filename on storage server
|
||||
* @param flags combined flags as following:
|
||||
* ProtoCommon.FDFS_QUERY_FINFO_FLAGS_NOT_CALC_CRC32 : do NOT calculate CRC32
|
||||
* for appender file or slave file
|
||||
* ProtoCommon.FDFS_QUERY_FINFO_FLAGS_KEEP_SILENCE : keep silence,
|
||||
* when this file not exist, do not log error on storage server
|
||||
* @return FileInfo object for success, return null for fail
|
||||
*/
|
||||
public FileInfo query_file_info(String group_name, String remote_filename) throws IOException, MyException {
|
||||
public FileInfo query_file_info(String group_name, String remote_filename, byte flags) throws IOException, MyException {
|
||||
boolean bNewStorageServer = this.newUpdatableStorageConnection(group_name, remote_filename);
|
||||
Connection connection = this.storageServer.getConnection();
|
||||
try {
|
||||
@@ -1566,7 +1571,7 @@ public class StorageClient {
|
||||
System.arraycopy(bs, 0, groupBytes, 0, groupLen);
|
||||
|
||||
header = ProtoCommon.packHeader(ProtoCommon.STORAGE_PROTO_CMD_QUERY_FILE_INFO,
|
||||
+groupBytes.length + filenameBytes.length, (byte) 0);
|
||||
groupBytes.length + filenameBytes.length, flags);
|
||||
OutputStream out = connection.getOutputStream();
|
||||
byte[] wholePkg = new byte[header.length + groupBytes.length + filenameBytes.length];
|
||||
System.arraycopy(header, 0, wholePkg, 0, header.length);
|
||||
@@ -1613,6 +1618,11 @@ public class StorageClient {
|
||||
}
|
||||
}
|
||||
|
||||
public FileInfo query_file_info(String group_name, String remote_filename) throws IOException, MyException {
|
||||
final byte flags = 0;
|
||||
return this.query_file_info(group_name, remote_filename, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* check storage socket, if null create a new connection
|
||||
*
|
||||
|
||||
@@ -735,16 +735,26 @@ public class StorageClient1 extends StorageClient {
|
||||
* get file info from storage server
|
||||
*
|
||||
* @param file_id the file id(including group name and filename)
|
||||
* @param flags combined flags as following:
|
||||
* ProtoCommon.FDFS_QUERY_FINFO_FLAGS_NOT_CALC_CRC32 : do NOT calculate CRC32
|
||||
* for appender file or slave file
|
||||
* ProtoCommon.FDFS_QUERY_FINFO_FLAGS_KEEP_SILENCE : keep silence,
|
||||
* when this file not exist, do not log error on storage server
|
||||
* @return FileInfo object for success, return null for fail
|
||||
*/
|
||||
public FileInfo query_file_info1(String file_id) throws IOException, MyException {
|
||||
String[] parts = new String[2];
|
||||
this.errno = this.split_file_id(file_id, parts);
|
||||
if (this.errno != 0) {
|
||||
return null;
|
||||
}
|
||||
public FileInfo query_file_info1(String file_id, byte flags) throws IOException, MyException {
|
||||
String[] parts = new String[2];
|
||||
this.errno = this.split_file_id(file_id, parts);
|
||||
if (this.errno != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.query_file_info(parts[0], parts[1]);
|
||||
return this.query_file_info(parts[0], parts[1], flags);
|
||||
}
|
||||
|
||||
public FileInfo query_file_info1(String file_id) throws IOException, MyException {
|
||||
final byte flags = 0;
|
||||
return this.query_file_info1(file_id, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user