[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: File size of a put operation in an IOSlave
From:       Craig Howard <kde () choward ! ca>
Date:       2007-03-17 21:32:57
Message-ID: 200703171432.57518.kde () choward ! ca
[Download RAW message or body]

On Friday 16 March 2007 10:16, David Faure wrote:
> On Friday 16 March 2007, Craig Howard wrote:
> > KDE3 did not provide a way to get the size and I haven't seen KDE4 add
> > that capability.  I think it could be made standard to pass the file size
> > through the metadata, but that seems wrong.
>
> Since the information isn't necessary to all implementations, and since it
> can't always be passed along, I think metadata actually fits the bill quite
> well. 

Conceptually, I'm okay with that.  However, I do think that serializing the 
size into a QString is wrong.  Perhaps Metadata should change to contain a 
QMap<QString, QVariant> instead of QMap<QString, QString>.  This will make 
serialization marginally more expensive, but it should make the code more 
obviously correct.

From what I can determine, the Metadata is never sent across the wire itself; 
it's only used as an IPC mechanism between different processes on the same 
system, so the serialization format of the Metadata is not part of the binary 
compatibility requirement.  Am I correct?

I'm syncing to trunk now.  I'll take a stab at conversion, but again no 
promises regarding my free time.

> I thought we already passed it when known, but indeed we don't; I was 
> confusing with FileCopyJob::setSourceSize(), which is used inside kio but
> not passed to the slave (see below).
>
> Worse: FileCopyJob starts the put before we start the get, so we really
> can't pass the size to put before the get job tells us. Which also means
> the put implementation can't ask too early :/
>
> Vague idea of the beginning of a patch:
> The first hunk is about passing the source size from setSourceSize() to the
> put job, the other half of the work would be to pass along the value from
> totalSize() of the get job. But in both cases, we have to check the
> metadata actually makes it to the put job, it might be too late to set
> metadata at that point....

I understand what you're trying to do below, but I don't understand the TODO.

> Index: job.cpp
> ===================================================================
> --- job.cpp     (revision 637688)
> +++ job.cpp     (working copy)
> @@ -1788,8 +1788,10 @@ void FileCopyJob::slotCanResume( KIO::Jo
>              m_getJob->addMetaData( "errorPage", "false" );
>              m_getJob->addMetaData( "AllowCompressedPage", "false" );
>              // Set size in subjob. This helps if the slave doesn't emit
> totalSize. -            if ( d->m_sourceSize != (KIO::filesize_t)-1 )
> +            if ( d->m_sourceSize != (KIO::filesize_t)-1 ) {
>                  m_getJob->slotTotalSize( d->m_sourceSize );
> +                m_putJob->addMetaData("size", d->m_sourceSize);
> +            }
>              if (offset)
>              {
>                  //kdDebug(7007) << "Setting metadata for resume to " <<
> (unsigned long) offset << endl; @@ -1808,6 +1810,7 @@ void
> FileCopyJob::slotCanResume( KIO::Jo
>              connectSubjob( m_getJob ); // Progress info depends on get
>              m_getJob->resume(); // Order a beer
>
> +            // TODO connect to m_getJob's totalSize signal, and do
> m_putJob->addMetaData("size", ....) there connect( m_getJob,
> SIGNAL(data(KIO::Job*,const QByteArray&)), SLOT( slotData(KIO::Job*,const
> QByteArray&)) ); connect( m_getJob, SIGNAL(mimetype(KIO::Job*,const
> QString&) ),

-- 

Craig Howard
craig@choward.ca
BMath CompSci - University of Waterloo
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic