org.csource.fastdfs
类 TrackerClient

java.lang.Object
  继承者 org.csource.fastdfs.TrackerClient

public class TrackerClient
extends Object

Tracker client

版本:
Version 1.19
作者:
Happy Fish / YuQing

字段摘要
protected  byte errno
           
protected  TrackerGroup tracker_group
           
 
构造方法摘要
TrackerClient()
          constructor with global tracker group
TrackerClient(TrackerGroup tracker_group)
          constructor with specified tracker group
 
方法摘要
 boolean deleteStorage(String groupName, String storageIpAddr)
          delete a storage server from the global FastDFS cluster
 boolean deleteStorage(TrackerGroup trackerGroup, String groupName, String storageIpAddr)
          delete a storage server from the FastDFS cluster
 TrackerServer getConnection()
          get a connection to tracker server
 byte getErrorCode()
          get the error code of last call
 StorageServer getFetchStorage(TrackerServer trackerServer, String groupName, String filename)
          query storage server to download file
 StorageServer getFetchStorage1(TrackerServer trackerServer, String file_id)
          query storage server to download file
 ServerInfo[] getFetchStorages(TrackerServer trackerServer, String groupName, String filename)
          get storage servers to download file
 ServerInfo[] getFetchStorages1(TrackerServer trackerServer, String file_id)
          get storage servers to download file
protected  ServerInfo[] getStorages(TrackerServer trackerServer, byte cmd, String groupName, String filename)
          query storage server to download file
 StorageServer getStoreStorage(TrackerServer trackerServer)
          query storage server to upload file
 StorageServer getStoreStorage(TrackerServer trackerServer, String groupName)
          query storage server to upload file
 StorageServer[] getStoreStorages(TrackerServer trackerServer, String groupName)
          query storage servers to upload file
 StorageServer getUpdateStorage(TrackerServer trackerServer, String groupName, String filename)
          query storage server to update file (delete file or set meta data)
 StructGroupStat[] listGroups(TrackerServer trackerServer)
          list groups
 StructStorageStat[] listStorages(TrackerServer trackerServer, String groupName)
          query storage server stat info of the group
 StructStorageStat[] listStorages(TrackerServer trackerServer, String groupName, String storageIpAddr)
          query storage server stat info of the group
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

tracker_group

protected TrackerGroup tracker_group

errno

protected byte errno
构造方法详细信息

TrackerClient

public TrackerClient()
constructor with global tracker group


TrackerClient

public TrackerClient(TrackerGroup tracker_group)
constructor with specified tracker group

参数:
tracker_group - the tracker group object
方法详细信息

getErrorCode

public byte getErrorCode()
get the error code of last call

返回:
the error code of last call

getConnection

public TrackerServer getConnection()
                            throws IOException
get a connection to tracker server

返回:
tracker server Socket object, return null if fail
抛出:
IOException

getStoreStorage

public StorageServer getStoreStorage(TrackerServer trackerServer)
                              throws IOException
query storage server to upload file

参数:
trackerServer - the tracker server
返回:
storage server Socket object, return null if fail
抛出:
IOException

getStoreStorage

public StorageServer getStoreStorage(TrackerServer trackerServer,
                                     String groupName)
                              throws IOException
query storage server to upload file

参数:
trackerServer - the tracker server
groupName - the group name to upload file to, can be empty
返回:
storage server object, return null if fail
抛出:
IOException

getStoreStorages

public StorageServer[] getStoreStorages(TrackerServer trackerServer,
                                        String groupName)
                                 throws IOException
query storage servers to upload file

参数:
trackerServer - the tracker server
groupName - the group name to upload file to, can be empty
返回:
storage servers, return null if fail
抛出:
IOException

getFetchStorage

public StorageServer getFetchStorage(TrackerServer trackerServer,
                                     String groupName,
                                     String filename)
                              throws IOException
query storage server to download file

参数:
trackerServer - the tracker server
groupName - the group name of storage server
filename - filename on storage server
返回:
storage server Socket object, return null if fail
抛出:
IOException

getUpdateStorage

public StorageServer getUpdateStorage(TrackerServer trackerServer,
                                      String groupName,
                                      String filename)
                               throws IOException
query storage server to update file (delete file or set meta data)

参数:
trackerServer - the tracker server
groupName - the group name of storage server
filename - filename on storage server
返回:
storage server Socket object, return null if fail
抛出:
IOException

getFetchStorages

public ServerInfo[] getFetchStorages(TrackerServer trackerServer,
                                     String groupName,
                                     String filename)
                              throws IOException
get storage servers to download file

参数:
trackerServer - the tracker server
groupName - the group name of storage server
filename - filename on storage server
返回:
storage servers, return null if fail
抛出:
IOException

getStorages

protected ServerInfo[] getStorages(TrackerServer trackerServer,
                                   byte cmd,
                                   String groupName,
                                   String filename)
                            throws IOException
query storage server to download file

参数:
trackerServer - the tracker server
cmd - command code, ProtoCommon.TRACKER_PROTO_CMD_SERVICE_QUERY_FETCH_ONE or ProtoCommon.TRACKER_PROTO_CMD_SERVICE_QUERY_UPDATE
groupName - the group name of storage server
filename - filename on storage server
返回:
storage server Socket object, return null if fail
抛出:
IOException

getFetchStorage1

public StorageServer getFetchStorage1(TrackerServer trackerServer,
                                      String file_id)
                               throws IOException
query storage server to download file

参数:
trackerServer - the tracker server
file_id - the file id(including group name and filename)
返回:
storage server Socket object, return null if fail
抛出:
IOException

getFetchStorages1

public ServerInfo[] getFetchStorages1(TrackerServer trackerServer,
                                      String file_id)
                               throws IOException
get storage servers to download file

参数:
trackerServer - the tracker server
file_id - the file id(including group name and filename)
返回:
storage servers, return null if fail
抛出:
IOException

listGroups

public StructGroupStat[] listGroups(TrackerServer trackerServer)
                             throws IOException
list groups

参数:
trackerServer - the tracker server
返回:
group stat array, return null if fail
抛出:
IOException

listStorages

public StructStorageStat[] listStorages(TrackerServer trackerServer,
                                        String groupName)
                                 throws IOException
query storage server stat info of the group

参数:
trackerServer - the tracker server
groupName - the group name of storage server
返回:
storage server stat array, return null if fail
抛出:
IOException

listStorages

public StructStorageStat[] listStorages(TrackerServer trackerServer,
                                        String groupName,
                                        String storageIpAddr)
                                 throws IOException
query storage server stat info of the group

参数:
trackerServer - the tracker server
groupName - the group name of storage server
storageIpAddr - the storage server ip address, can be null or empty
返回:
storage server stat array, return null if fail
抛出:
IOException

deleteStorage

public boolean deleteStorage(String groupName,
                             String storageIpAddr)
                      throws IOException
delete a storage server from the global FastDFS cluster

参数:
groupName - the group name of storage server
storageIpAddr - the storage server ip address
返回:
true for success, false for fail
抛出:
IOException

deleteStorage

public boolean deleteStorage(TrackerGroup trackerGroup,
                             String groupName,
                             String storageIpAddr)
                      throws IOException
delete a storage server from the FastDFS cluster

参数:
trackerGroup - the tracker server group
groupName - the group name of storage server
storageIpAddr - the storage server ip address
返回:
true for success, false for fail
抛出:
IOException


Copyright © 2017. All rights reserved.