Poechant fastdfs configuration, deployment and API usage tutorial
Fastdfs configuration, deployment, and API usage explanation-(1) Getting Started tutorial
Fastdfs configuration, deployment, and API usage explanation -- (2) Java
API: uploads files based on inputstream, file name, and file length
Fastdfs configuration, deployment, and API usage explanation-(3) Java
API: uploads files by direct conversion of Io streams based on inputstream, file name, and file length
Fastdfs configuration, deployment, and API usage explanation -- (4) Two Methods for setting fastdfs configuration parameters
Fastdfs configuration, deployment, and API usage explanation-(5) Detailed description of fastdfs configuration and tracker Configuration
Fastdfs configuration, deployment, and API usage explanation-(6) Storage configuration for fastdfs configuration explanation
Fastdfs configuration, deployment, and API usage explanation -- (7) Some Q & A summary of fastdfs nginx
Fastdfs configuration, deployment, and API usage explanation -- (8) Detailed description of fastdfs configuration: clinet configuration and two initialization Methods
Explanation of fastdfs configuration, deployment, and API usage-(9) Explanation of multiple fastdfs File Upload Interfaces
This article comes from poetry vendors
• Liu Jinghong poechant http://blog.csdn.net/poechant. Please note this.
1. Differences between storageclient and storageclient1
I believe that the fastdfs shoes using happy_fish must be familiar with storageclient, or you are familiar with storageclient1. What is the difference between the two?
We already know in the previous blog that fastdfs stores files to a certain storage path of a group. If you set a two-tier directory structure on the storage server, the file ID after a file is uploaded to fastdfs is generally in the format of "group1/M01/00/2 A/rbasvk8ory2nf9eoaairko2da7u901.jpg. The "group1" is called the group name, and the "M01/00/08/rbasvk8ory2nf9eoaalrko2da7u901.jpg" in the back section is called a file.
Name.
After knowing this, we can discuss the differences between storageclient and storageclient1. In storageclient, the file ID is expressed by group name and file name, while in storageclient1, the group name and file name are unified for processing. In fact, by analyzing the source code of fastdfs Java client, we can find that storageclient1 is a subclass of storageclient.
public class StorageClient1 extends StorageClient { ...}
The implementation of the upload_file1 (...) method in storageclient1 is to call this. upload_file (...) and combine the returned group name and file name to return the result.
2. Multiple File Upload Interfaces
The latest version of fastdfs Java client API is 1.19, which includes the following upload APIs (storage Client1 is used as an example ):
/* Method 1 */upload_file1 (byte [] file_buff, string file_ext_name, namevaluepair [] meta_list);/* method 2 */upload_file1 (string group_name, byte [] file_buff, string file_ext_name, namevaluepair [] meta_list);/* method 3 */upload_file1 (string master_file_id, string prefix_name, byte [] file_buff, int offset, int length, string file_ext_name, namevaluepair [] meta_list);/* method 4 */upload_file1 (string master_file_id, string prefix_name, byte [] file_buff, string file_ext_name, namevaluepair [] meta_list ); /* Method 5 */upload_file1 (string group_name, long file_size, uploadcallback callback, string file_ext_name, parts [] meta_list);/* Method 6 */upload_file1 (string master_file_id, string prefix_name, long file_size, uploadcallback callback, string file_ext_name, namevaluepair [] meta_list);/* 7 */upload_file1 (string local_file_name, string file_ext_name, namevaluepair [] meta_list ); /* Method 8 */upload_file1 (string group_name, string local_file_name, string file_ext_name, parts [] meta_list);/* Method 9 */upload_file1 (string master_file_id, string prefix_name, string local_file_name, string file_ext_name, namevaluepair [] meta_list );
(1) Multiple upload formats
Method 1-4 uploads the File Buffer (byte array); Method 5-6 uploads the file stream through callback (which will be explained in later articles); Method 7-9 uploads the local file.
(2) Multiple upload Methods
Below we will summarize the parameters of these upload interfaces for your convenience.
|
Group Name |
Extension |
Meta list |
Master File ID |
Prefix name |
Offset |
Length |
Size |
Format |
Method 1 |
|
√ |
√ |
|
|
|
|
|
Buffer |
Method 2 |
√ |
√ |
√ |
|
|
|
|
|
Buffer |
Method 3 |
|
√ |
√ |
√ |
√ |
√ |
√ |
|
Buffer |
Method 4 |
|
√ |
√ |
√ |
√ |
|
|
|
Buffer |
Method 5 |
√ |
√ |
√ |
|
|
|
|
√ |
Stream |
Method 6 |
|
√ |
√ |
√ |
√ |
|
|
√ |
Stream |
Method 7 |
|
√ |
√ |
|
|
|
|
|
Local |
Method 8 |
√ |
√ |
√ |
|
|
|
|
|
Local |
Method 9 |
|
√ |
√ |
√ |
√ |
|
|
|
Local |
Parameters extension and meta list can be carried in all methods. In addition, the file size parameter must be provided when the stream is uploaded through callback.
The upload method of storageclient1. The returned values are string and storageclient. The returned values are string [].
This article comes from poetry vendors
• Liu Jinghong poechant http://blog.csdn.net/poechant. Please note this.
-