/** * delete file from storage server * * @param file_id the file id(including group name and filename) * @return 0 for success, none zero for fail (error code) */ public int delete_file1(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 this.errno; } return this.delete_file(parts[0], parts[1]); }
/** * get all metadata items from storage server * * @param file_id the file id(including group name and filename) * @return meta info array, return null if fail */ public NameValuePair[] get_metadata1(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; } return this.get_metadata(parts[0], parts[1]); }
/** * get file info from storage server * * @param file_id the file id(including group name and filename) * @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; } return this.query_file_info(parts[0], parts[1]); }
/** * truncate appender file to size 0 from storage server * * @param appender_file_id the appender file id * @return 0 for success, none zero for fail (error code) */ public int truncate_file1(String appender_file_id) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.truncate_file(parts[0], parts[1]); }
/** * query storage server to download file * * @param trackerServer the tracker server * @param file_id the file id(including group name and filename) * @return storage server Socket object, return null if fail */ public StorageServer getFetchStorage1(TrackerServer trackerServer, String file_id) throws IOException { String[] parts = new String[2]; this.errno = StorageClient1.split_file_id(file_id, parts); if (this.errno != 0) { return null; } return this.getFetchStorage(trackerServer, parts[0], parts[1]); }
/** * get storage servers to download file * * @param trackerServer the tracker server * @param file_id the file id(including group name and filename) * @return storage servers, return null if fail */ public ServerInfo[] getFetchStorages1(TrackerServer trackerServer, String file_id) throws IOException { String[] parts = new String[2]; this.errno = StorageClient1.split_file_id(file_id, parts); if (this.errno != 0) { return null; } return this.getFetchStorages(trackerServer, parts[0], parts[1]); }
/** * append file to storage server (by file name) * * @param appender_file_id the appender file id * @param local_filename local filename to append * @return 0 for success, != 0 for error (error no) */ public int append_file1(String appender_file_id, String local_filename) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.append_file(parts[0], parts[1], local_filename); }
/** * truncate appender file from storage server * * @param appender_file_id the appender file id * @param truncated_file_size truncated file size * @return 0 for success, none zero for fail (error code) */ public int truncate_file1(String appender_file_id, long truncated_file_size) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.truncate_file(parts[0], parts[1], truncated_file_size); }
/** * get file info decoded from filename * * @param file_id the file id(including group name and filename) * @return FileInfo object for success, return null for fail */ public FileInfo get_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; } return this.get_file_info(parts[0], parts[1]); } }
/** * append file to storage server (by file buff) * * @param appender_file_id the appender file id * @param file_buff file content/buff * @return 0 for success, != 0 for error (error no) */ public int append_file1(String appender_file_id, byte[] file_buff) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.append_file(parts[0], parts[1], file_buff); }
/** * append file to storage server (by callback) * * @param appender_file_id the appender file id * @param file_size the file size * @param callback the write data callback object * @return 0 for success, != 0 for error (error no) */ public int append_file1(String appender_file_id, long file_size, UploadCallback callback) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.append_file(parts[0], parts[1], file_size, callback); }
/** * download file from storage server * * @param file_id the file id(including group name and filename) * @param file_offset the start offset of the file * @param download_bytes download bytes, 0 for remain bytes from offset * @param callback the callback object, will call callback.recv() when data arrive * @return 0 success, return none zero errno if fail */ public int download_file1(String file_id, long file_offset, long download_bytes, DownloadCallback callback) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(file_id, parts); if (this.errno != 0) { return this.errno; } return this.download_file(parts[0], parts[1], file_offset, download_bytes, callback); }
/** * download file from storage server * * @param file_id the file id(including group name and filename) * @param file_offset the start offset of the file * @param download_bytes download bytes, 0 for remain bytes from offset * @return file content/buff, return null if fail */ public byte[] download_file1(String file_id, long file_offset, long download_bytes) 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.download_file(parts[0], parts[1], file_offset, download_bytes); }
/** * append file to storage server (by file buff) * * @param appender_file_id the appender file id * @param file_buff file content/buffer * @param offset start offset of the buffer * @param length the length of the buffer to append * @return 0 for success, != 0 for error (error no) */ public int append_file1(String appender_file_id, byte[] file_buff, int offset, int length) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.append_file(parts[0], parts[1], file_buff, offset, length); }
/** * modify appender file to storage server (by callback) * * @param appender_file_id the appender file id * @param file_offset the offset of appender file * @param modify_size the modify size * @param callback the write data callback object * @return 0 for success, != 0 for error (error no) */ public int modify_file1(String appender_file_id, long file_offset, long modify_size, UploadCallback callback) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.modify_file(parts[0], parts[1], file_offset, modify_size, callback); }
/** * modify appender file to storage server (by file name) * * @param appender_file_id the appender file id * @param file_offset the offset of appender file * @param local_filename local filename to append * @return 0 for success, != 0 for error (error no) */ public int modify_file1(String appender_file_id, long file_offset, String local_filename) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.modify_file(parts[0], parts[1], file_offset, local_filename); }
/** * modify appender file to storage server (by file buff) * * @param appender_file_id the appender file id * @param file_offset the offset of appender file * @param file_buff file content/buff * @return 0 for success, != 0 for error (error no) */ public int modify_file1(String appender_file_id, long file_offset, byte[] file_buff) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.modify_file(parts[0], parts[1], file_offset, file_buff); }
/** * download file from storage server * * @param file_id the file id(including group name and filename) * @param file_offset the start offset of the file * @param download_bytes download bytes, 0 for remain bytes from offset * @param local_filename the filename on local * @return 0 success, return none zero errno if fail */ public int download_file1(String file_id, long file_offset, long download_bytes, String local_filename) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(file_id, parts); if (this.errno != 0) { return this.errno; } return this.download_file(parts[0], parts[1], file_offset, download_bytes, local_filename); }
/** * modify appender file to storage server (by file buff) * * @param appender_file_id the appender file id * @param file_offset the offset of appender file * @param file_buff file content/buff * @param buffer_offset start offset of the buff * @param buffer_length the length of buff to modify * @return 0 for success, != 0 for error (error no) */ public int modify_file1(String appender_file_id, long file_offset, byte[] file_buff, int buffer_offset, int buffer_length) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(appender_file_id, parts); if (this.errno != 0) { return this.errno; } return this.modify_file(parts[0], parts[1], file_offset, file_buff, buffer_offset, buffer_length); }
/** * set metadata items to storage server * * @param file_id the file id(including group name and filename) * @param meta_list meta item array * @param op_flag flag, can be one of following values: <br> * <ul><li> ProtoCommon.STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite all old * metadata items</li></ul> * <ul><li> ProtoCommon.STORAGE_SET_METADATA_FLAG_MERGE: merge, insert when * the metadata item not exist, otherwise update it</li></ul> * @return 0 for success, !=0 fail (error code) */ public int set_metadata1(String file_id, NameValuePair[] meta_list, byte op_flag) throws IOException, MyException { String[] parts = new String[2]; this.errno = this.split_file_id(file_id, parts); if (this.errno != 0) { return this.errno; } return this.set_metadata(parts[0], parts[1], meta_list, op_flag); }