Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::FileClient::DoPut ( String  fileName  ) 

Definition at line 49 of file mainFileClient.cpp.

References Impala::Util::IOBuffer::Available(), Impala::Util::Channel::Buffer(), Impala::Util::Channel::DATA_BUFFER_SIZE, Impala::FileNameTail(), gChannel, Impala::Util::IOBufferFile::Read(), Impala::Util::Channel::SendRequest(), Impala::Util::IOBuffer::Size(), and Impala::Timer::SplitTime().

Referenced by mainFileClient().

00050 {
00051     std::cout << "Putting " << fileName << " ... " << std::flush;
00052     Timer timer(1);
00053     char* buf = gChannel->Buffer();
00054     String dstFileName = FileNameTail(fileName);
00055     sprintf(buf, "put %s\0", dstFileName.c_str());
00056     int len = gChannel->SendRequest(strlen(buf)+1);
00057     buf[len] = 0;
00058     if ((len > 5) && (strncmp(buf, "ERROR", 5) == 0))
00059         return;
00060     IOBufferFile ioBuf(fileName, true, false);
00061     double b = ioBuf.Size();
00062     while (ioBuf.Available() > 0)
00063     {
00064         sprintf(buf, "putmore\0");
00065         int nrData = Min<Int64>(Channel::DATA_BUFFER_SIZE-8, ioBuf.Available());
00066         ioBuf.Read(buf+8, nrData);
00067         len = gChannel->SendRequest(nrData+8);
00068         if ((len > 5) && (strncmp(buf, "ERROR", 5) == 0))
00069             return;
00070         std::cout << "#" << std::flush;
00071     }
00072     double timeVal = timer.SplitTime();
00073     double bps = b / (1024.0*1024.0 * timeVal);
00074     std::cout << " done (in " << timeVal << " sec = " << bps << " Mb/sec)"
00075               << std::endl;
00076 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:39:16 2010 for ImpalaSrc by  doxygen 1.5.1