xrootd
|
00001 00002 // // 00003 // XrdClientMStream // 00004 // // 00005 // Author: Fabrizio Furano (INFN Padova, 2006) // 00006 // // 00007 // Helper code for XrdClient to handle multistream behavior // 00008 // // 00010 00011 // $Id$ 00012 00013 00014 #ifndef XRD_CLI_MSTREAM 00015 #define XRD_CLI_MSTREAM 00016 00017 #include "XrdClient/XrdClientConn.hh" 00018 00019 class XrdClientMStream { 00020 00021 00022 00023 00024 00025 public: 00026 00027 // Compute the parameters to split blocks 00028 static void GetGoodSplitParameters(XrdClientConn *cliconn, 00029 int &spltsize, int &reqsperstream, 00030 kXR_int32 len); 00031 00032 // Establish all the parallel streams, stop 00033 // adding streams at the first creation refusal/failure 00034 static int EstablishParallelStreams(XrdClientConn *cliconn); 00035 00036 // Add a parallel stream to the pool used by the given client inst 00037 static int AddParallelStream(XrdClientConn *cliconn, int port, int windowsz, int tempid); 00038 00039 // Remove a parallel stream to the pool used by the given client inst 00040 static int RemoveParallelStream(XrdClientConn *cliconn, int substream); 00041 00042 // Binds the pending temporary parallel stream to the current session 00043 // Returns into newid the substreamid assigned by the server 00044 static bool BindPendingStream(XrdClientConn *cliconn, int substreamid, int &newid); 00045 00046 struct ReadChunk { 00047 kXR_int64 offset; 00048 kXR_int32 len; 00049 int streamtosend; 00050 }; 00051 00052 00053 // This splits a long requests into many smaller requests, to be sent in parallel 00054 // through multiple streams 00055 // Returns false if the chunk is not worth splitting 00056 static bool SplitReadRequest(XrdClientConn *cliconn, kXR_int64 offset, kXR_int32 len, 00057 XrdClientVector<ReadChunk> &reqlists); 00058 00059 00060 }; 00061 00062 00063 00064 00065 00066 00067 #endif