FastDFS客戶端可以幫助我們很方便的連接DFS服務器,將封裝好的SOCKET命令發送到服務器端,DFS只提供linux環境下的服務器端,暫不支持WINDOWS系統,我們做.net開始,可以選擇C#版的FastDFS客戶端,自己可以根據自己的需要再去完善它。
我的改造:
為了調用方便,我把與tracker連接的工作放到了DFS客戶端上,並且為它分配默認的組
Constructors List<IPEndPoint> trackerIPs = List<IPEndPoint> = List<IPEndPoint>= =
對於開始人員來說,在調用時,可以這樣完成上傳,下載等操作,看代碼:
[] content = = FileStream( (BinaryReader reader = = reader.ReadBytes(( fileName = FastDFSClient.UploadFile(FastDFSClient.DefaultGroup, content,
下面我把FastDFSClient類的源代碼公開一下,大家看了後有問題,再提出來,大家再一起解決。
Constructors List<IPEndPoint> trackerIPs = List<IPEndPoint> = List<IPEndPoint>= = StorageNode GetStorageNode(== = = === UploadFile(StorageNode storageNode, [] contentByte, == UploadSlaveFile( groupName, [] contentByte, master_filename, prefix_name, == = == UploadAppenderFile(StorageNode storageNode, [] contentByte, == AppendFile( groupName, fileName, == = = RemoveFile( groupName, == = = [] DownloadFile(StorageNode storageNode, = DOWNLOAD_FILE.Instance.GetRequest(storageNode.EndPoint, , = [] DownloadFile(StorageNode storageNode, fileName, offset, == FDFSFileInfo GetFileInfo(StorageNode storageNode, ==