public class StorageClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StorageClient.UploadBuff
Upload file by file buff
|
| Modifier and Type | Field and Description |
|---|---|
static Base64 |
base64 |
protected byte |
errno |
protected StorageServer |
storageServer |
protected TrackerServer |
trackerServer |
| Constructor and Description |
|---|
StorageClient()
constructor using global settings in class ClientGlobal
|
StorageClient(TrackerServer trackerServer,
StorageServer storageServer)
constructor with tracker server and storage server
|
| Modifier and Type | Method and Description |
|---|---|
int |
append_file(String group_name,
String appender_filename,
byte[] file_buff)
append file to storage server (by file buff)
|
int |
append_file(String group_name,
String appender_filename,
byte[] file_buff,
int offset,
int length)
append file to storage server (by file buff)
|
int |
append_file(String group_name,
String appender_filename,
long file_size,
UploadCallback callback)
append file to storage server (by callback)
|
int |
append_file(String group_name,
String appender_filename,
String local_filename)
append file to storage server (by file name)
|
int |
delete_file(String group_name,
String remote_filename)
delete file from storage server
|
protected int |
do_append_file(String group_name,
String appender_filename,
long file_size,
UploadCallback callback)
append file to storage server
|
protected int |
do_modify_file(String group_name,
String appender_filename,
long file_offset,
long modify_size,
UploadCallback callback)
modify appender file to storage server
|
protected String[] |
do_upload_file(byte cmd,
String group_name,
String master_filename,
String prefix_name,
String file_ext_name,
long file_size,
UploadCallback callback,
NameValuePair[] meta_list)
upload file to storage server
|
byte[] |
download_file(String group_name,
String remote_filename)
download file from storage server
|
int |
download_file(String group_name,
String remote_filename,
DownloadCallback callback)
download file from storage server
|
byte[] |
download_file(String group_name,
String remote_filename,
long file_offset,
long download_bytes)
download file from storage server
|
int |
download_file(String group_name,
String remote_filename,
long file_offset,
long download_bytes,
DownloadCallback callback)
download file from storage server
|
int |
download_file(String group_name,
String remote_filename,
long file_offset,
long download_bytes,
String local_filename)
download file from storage server
|
int |
download_file(String group_name,
String remote_filename,
String local_filename)
download file from storage server
|
FileInfo |
get_file_info(String group_name,
String remote_filename)
get file info decoded from the filename, fetch from the storage if necessary
|
NameValuePair[] |
get_metadata(String group_name,
String remote_filename)
get all metadata items from storage server
|
byte |
getErrorCode()
get the error code of last call
|
int |
modify_file(String group_name,
String appender_filename,
long file_offset,
byte[] file_buff)
modify appender file to storage server (by file buff)
|
int |
modify_file(String group_name,
String appender_filename,
long file_offset,
byte[] file_buff,
int buffer_offset,
int buffer_length)
modify appender file to storage server (by file buff)
|
int |
modify_file(String group_name,
String appender_filename,
long file_offset,
long modify_size,
UploadCallback callback)
modify appender file to storage server (by callback)
|
int |
modify_file(String group_name,
String appender_filename,
long file_offset,
String local_filename)
modify appender file to storage server (by file name)
|
protected boolean |
newReadableStorageConnection(String group_name,
String remote_filename)
check storage socket, if null create a new connection
|
protected boolean |
newUpdatableStorageConnection(String group_name,
String remote_filename)
check storage socket, if null create a new connection
|
protected boolean |
newWritableStorageConnection(String group_name)
check storage socket, if null create a new connection
|
FileInfo |
query_file_info(String group_name,
String remote_filename)
get file info from storage server
|
protected void |
send_download_package(String group_name,
String remote_filename,
long file_offset,
long download_bytes)
send package to storage server
|
protected void |
send_package(byte cmd,
String group_name,
String remote_filename)
send package to storage server
|
int |
set_metadata(String group_name,
String remote_filename,
NameValuePair[] meta_list,
byte op_flag)
set metadata items to storage server
|
int |
truncate_file(String group_name,
String appender_filename)
truncate appender file to size 0 from storage server
|
int |
truncate_file(String group_name,
String appender_filename,
long truncated_file_size)
truncate appender file from storage server
|
String[] |
upload_appender_file(byte[] file_buff,
int offset,
int length,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file buff)
|
String[] |
upload_appender_file(byte[] file_buff,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file buff)
|
String[] |
upload_appender_file(String group_name,
byte[] file_buff,
int offset,
int length,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file buff)
|
String[] |
upload_appender_file(String group_name,
byte[] file_buff,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file buff)
|
String[] |
upload_appender_file(String group_name,
long file_size,
UploadCallback callback,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by callback)
|
String[] |
upload_appender_file(String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file name)
|
protected String[] |
upload_appender_file(String group_name,
String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload appender file to storage server (by file name)
|
String[] |
upload_file(byte[] file_buff,
int offset,
int length,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff)
|
String[] |
upload_file(byte[] file_buff,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff)
|
protected String[] |
upload_file(byte cmd,
String group_name,
String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file name)
|
String[] |
upload_file(String group_name,
byte[] file_buff,
int offset,
int length,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff)
|
String[] |
upload_file(String group_name,
byte[] file_buff,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff)
|
String[] |
upload_file(String group_name,
long file_size,
UploadCallback callback,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by callback)
|
String[] |
upload_file(String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file name)
|
String[] |
upload_file(String group_name,
String master_filename,
String prefix_name,
byte[] file_buff,
int offset,
int length,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff, slave file mode)
|
String[] |
upload_file(String group_name,
String master_filename,
String prefix_name,
byte[] file_buff,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file buff, slave file mode)
|
String[] |
upload_file(String group_name,
String master_filename,
String prefix_name,
long file_size,
UploadCallback callback,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by callback, slave file mode)
|
protected String[] |
upload_file(String group_name,
String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file name)
|
String[] |
upload_file(String group_name,
String master_filename,
String prefix_name,
String local_filename,
String file_ext_name,
NameValuePair[] meta_list)
upload file to storage server (by file name, slave file mode)
|
public static final Base64 base64
protected TrackerServer trackerServer
protected StorageServer storageServer
protected byte errno
public StorageClient()
public StorageClient(TrackerServer trackerServer, StorageServer storageServer)
trackerServer - the tracker server, can be nullstorageServer - the storage server, can be nullpublic byte getErrorCode()
public String[] upload_file(String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
local_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionprotected String[] upload_file(String group_name, String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptylocal_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionprotected String[] upload_file(byte cmd, String group_name, String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
cmd - the commandgroup_name - the group name to upload file to, can be emptylocal_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
file_buff - file content/buffoffset - start offset of the bufflength - the length of buff to uploadfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_buff - file content/buffoffset - start offset of the bufflength - the length of buff to uploadfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
file_buff - file content/bufffile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_buff - file content/bufffile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_size - the file sizecallback - the write data callback objectfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, String master_filename, String prefix_name, String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name of master filemaster_filename - the master file name to generate the slave fileprefix_name - the prefix name to generate the slave filelocal_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, String master_filename, String prefix_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name of master filemaster_filename - the master file name to generate the slave fileprefix_name - the prefix name to generate the slave filefile_buff - file content/bufffile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, String master_filename, String prefix_name, byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name of master filemaster_filename - the master file name to generate the slave fileprefix_name - the prefix name to generate the slave filefile_buff - file content/buffoffset - start offset of the bufflength - the length of buff to uploadfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_file(String group_name, String master_filename, String prefix_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptymaster_filename - the master file name to generate the slave fileprefix_name - the prefix name to generate the slave filefile_size - the file sizecallback - the write data callback objectfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
local_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionprotected String[] upload_appender_file(String group_name, String local_filename, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptylocal_filename - local filename to uploadfile_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filenamemeta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
file_buff - file content/buffoffset - start offset of the bufflength - the length of buff to uploadfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(String group_name, byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_buff - file content/buffoffset - start offset of the bufflength - the length of buff to uploadfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
file_buff - file content/bufffile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_buff - file content/bufffile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic String[] upload_appender_file(String group_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list) throws IOException, FsException
group_name - the group name to upload file to, can be emptyfile_size - the file sizecallback - the write data callback objectfile_ext_name - file ext name, do not include dot(.)meta_list - meta info arrayIOExceptionFsExceptionpublic int append_file(String group_name, String appender_filename, String local_filename) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamelocal_filename - local filename to appendIOExceptionFsExceptionpublic int append_file(String group_name, String appender_filename, byte[] file_buff) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_buff - file content/buffIOExceptionFsExceptionpublic int append_file(String group_name, String appender_filename, byte[] file_buff, int offset, int length) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_buff - file content/buffoffset - start offset of the bufflength - the length of buff to appendIOExceptionFsExceptionpublic int append_file(String group_name, String appender_filename, long file_size, UploadCallback callback) throws IOException, FsException
group_name - the group name to append file toappender_filename - the appender filenamefile_size - the file sizecallback - the write data callback objectIOExceptionFsExceptionpublic int modify_file(String group_name, String appender_filename, long file_offset, String local_filename) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_offset - the offset of appender filelocal_filename - local filename to appendIOExceptionFsExceptionpublic int modify_file(String group_name, String appender_filename, long file_offset, byte[] file_buff) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_offset - the offset of appender filefile_buff - file content/buffIOExceptionFsExceptionpublic int modify_file(String group_name, String appender_filename, long file_offset, byte[] file_buff, int buffer_offset, int buffer_length) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_offset - the offset of appender filefile_buff - file content/buffbuffer_offset - start offset of the buffbuffer_length - the length of buff to modifyIOExceptionFsExceptionpublic int modify_file(String group_name, String appender_filename, long file_offset, long modify_size, UploadCallback callback) throws IOException, FsException
group_name - the group name to modify file toappender_filename - the appender filenamefile_offset - the offset of appender filemodify_size - the modify sizecallback - the write data callback objectIOExceptionFsExceptionprotected String[] do_upload_file(byte cmd, String group_name, String master_filename, String prefix_name, String file_ext_name, long file_size, UploadCallback callback, NameValuePair[] meta_list) throws IOException, FsException
cmd - the command codegroup_name - the group name to upload file to, can be emptymaster_filename - the master file name to generate the slave fileprefix_name - the prefix name to generate the slave filefile_ext_name - file ext name, do not include dot(.)file_size - the file sizecallback - the write data callback objectmeta_list - meta info arrayIOExceptionFsExceptionprotected int do_append_file(String group_name, String appender_filename, long file_size, UploadCallback callback) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_size - the file sizecallback - the write data callback objectIOExceptionFsExceptionprotected int do_modify_file(String group_name, String appender_filename, long file_offset, long modify_size, UploadCallback callback) throws IOException, FsException
group_name - the group name of appender fileappender_filename - the appender filenamefile_offset - the offset of appender filemodify_size - the modify sizecallback - the write data callback objectIOExceptionFsExceptionpublic int delete_file(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionpublic int truncate_file(String group_name, String appender_filename) throws IOException, FsException
group_name - the group name of storage serverappender_filename - the appender filenameIOExceptionFsExceptionpublic int truncate_file(String group_name, String appender_filename, long truncated_file_size) throws IOException, FsException
group_name - the group name of storage serverappender_filename - the appender filenametruncated_file_size - truncated file sizeIOExceptionFsExceptionpublic byte[] download_file(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionpublic byte[] download_file(String group_name, String remote_filename, long file_offset, long download_bytes) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverfile_offset - the start offset of the filedownload_bytes - download bytes, 0 for remain bytes from offsetIOExceptionFsExceptionpublic int download_file(String group_name, String remote_filename, String local_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverlocal_filename - filename on localIOExceptionFsExceptionpublic int download_file(String group_name, String remote_filename, long file_offset, long download_bytes, String local_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverfile_offset - the start offset of the filedownload_bytes - download bytes, 0 for remain bytes from offsetlocal_filename - filename on localIOExceptionFsExceptionpublic int download_file(String group_name, String remote_filename, DownloadCallback callback) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage servercallback - call callback.recv() when data arriveIOExceptionFsExceptionpublic int download_file(String group_name, String remote_filename, long file_offset, long download_bytes, DownloadCallback callback) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverfile_offset - the start offset of the filedownload_bytes - download bytes, 0 for remain bytes from offsetcallback - call callback.recv() when data arriveIOExceptionFsExceptionpublic NameValuePair[] get_metadata(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionpublic int set_metadata(String group_name, String remote_filename, NameValuePair[] meta_list, byte op_flag) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage servermeta_list - meta item arrayop_flag - flag, can be one of following values: IOExceptionFsExceptionpublic FileInfo get_file_info(String group_name, String remote_filename) throws IOException, FsException
group_name - the group nameremote_filename - the filenameIOExceptionFsExceptionpublic FileInfo query_file_info(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionprotected boolean newWritableStorageConnection(String group_name) throws IOException, FsException
group_name - the group name to upload file to, can be emptyIOExceptionFsExceptionprotected boolean newReadableStorageConnection(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionprotected boolean newUpdatableStorageConnection(String group_name, String remote_filename) throws IOException, FsException
group_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionFsExceptionprotected void send_package(byte cmd,
String group_name,
String remote_filename)
throws IOException
cmd - which command to sendgroup_name - the group name of storage serverremote_filename - filename on storage serverIOExceptionprotected void send_download_package(String group_name, String remote_filename, long file_offset, long download_bytes) throws IOException
group_name - the group name of storage serverremote_filename - filename on storage serverfile_offset - the start offset of the filedownload_bytes - download bytesIOExceptionCopyright © 2018 lodsve. All rights reserved.