mirror of
https://github.com/happyfish100/fastdfs-client-java.git
synced 2026-09-17 09:20:46 +00:00
query file info support two combined flags
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
|
|
||||||
|
Version 1.37 2025-11-06
|
||||||
|
* query file info support two combined flags:
|
||||||
|
ProtoCommon.FDFS_QUERY_FINFO_FLAGS_NOT_CALC_CRC32
|
||||||
|
ProtoCommon.FDFS_QUERY_FINFO_FLAGS_KEEP_SILENCE
|
||||||
|
you must upgrade your FastDFS server V6.15.1 and higher version
|
||||||
|
|
||||||
Version 1.36 2025-10-26
|
Version 1.36 2025-10-26
|
||||||
* monitor protocol compatible with IPv4/IPv6 address automatically
|
* monitor protocol compatible with IPv4/IPv6 address automatically
|
||||||
* FastDFS server version requirements:
|
* FastDFS server version requirements:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>org.csource</groupId>
|
<groupId>org.csource</groupId>
|
||||||
<artifactId>fastdfs-client-java</artifactId>
|
<artifactId>fastdfs-client-java</artifactId>
|
||||||
<version>1.36-SNAPSHOT</version>
|
<version>1.37-SNAPSHOT</version>
|
||||||
<name>fastdfs-client-java</name>
|
<name>fastdfs-client-java</name>
|
||||||
<description>fastdfs client for java</description>
|
<description>fastdfs client for java</description>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ public class ProtoCommon {
|
|||||||
public static final byte FDFS_RW_MODE_WRITEONLY = 2;
|
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_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() {
|
private ProtoCommon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1540,9 +1540,14 @@ public class StorageClient {
|
|||||||
*
|
*
|
||||||
* @param group_name the group name of storage server
|
* @param group_name the group name of storage server
|
||||||
* @param remote_filename filename on 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
|
* @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);
|
boolean bNewStorageServer = this.newUpdatableStorageConnection(group_name, remote_filename);
|
||||||
Connection connection = this.storageServer.getConnection();
|
Connection connection = this.storageServer.getConnection();
|
||||||
try {
|
try {
|
||||||
@@ -1566,7 +1571,7 @@ public class StorageClient {
|
|||||||
System.arraycopy(bs, 0, groupBytes, 0, groupLen);
|
System.arraycopy(bs, 0, groupBytes, 0, groupLen);
|
||||||
|
|
||||||
header = ProtoCommon.packHeader(ProtoCommon.STORAGE_PROTO_CMD_QUERY_FILE_INFO,
|
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();
|
OutputStream out = connection.getOutputStream();
|
||||||
byte[] wholePkg = new byte[header.length + groupBytes.length + filenameBytes.length];
|
byte[] wholePkg = new byte[header.length + groupBytes.length + filenameBytes.length];
|
||||||
System.arraycopy(header, 0, wholePkg, 0, header.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
|
* check storage socket, if null create a new connection
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -735,16 +735,26 @@ public class StorageClient1 extends StorageClient {
|
|||||||
* get file info from storage server
|
* get file info from storage server
|
||||||
*
|
*
|
||||||
* @param file_id the file id(including group name and filename)
|
* @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
|
* @return FileInfo object for success, return null for fail
|
||||||
*/
|
*/
|
||||||
public FileInfo query_file_info1(String file_id) throws IOException, MyException {
|
public FileInfo query_file_info1(String file_id, byte flags) throws IOException, MyException {
|
||||||
String[] parts = new String[2];
|
String[] parts = new String[2];
|
||||||
this.errno = this.split_file_id(file_id, parts);
|
this.errno = this.split_file_id(file_id, parts);
|
||||||
if (this.errno != 0) {
|
if (this.errno != 0) {
|
||||||
return null;
|
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