View Single Post
  #1 (permalink)  
Old 09-25-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
IcePatch design question

Hi there!

Could you please give me a design advice for a program that is quite similar to IcePatch:

Apart from only being able to download data, the program should also support uploading data.
This would be implemented by adding an upload() function to CFile.

Thus, a factory would be used to obtain a handle for new CFile and CFileDesc objects (file object server-side, fileDesc is then client-side) and then the upload() function of CFile would be called.
Having uploaded a file, the md5 descriptor in CFileDesc would surely become invalid.
Unfortunately, there's no connection between the file and fileDesc objects to make sure that fileDesc is being invalidated.
Imho, the only possibility for a slick solution is to wrap the functionality on the client-side thus that another client-side component is responsible for the upload. This client-side component would also have to know about the fileDesc to invalidate it, thus one would need a function like this:

bool uploadFile(CFileDesc& desc, ByteArray data)
{
try
{
desc.fileHandle->upload(data);
}
catch ()
{
return false;
}
desc.bValid = false;
return true;
}

Is this the only possibility or are there ways to avoid such wrapping (i.e. working only with file and fileDesc)?

regs,

Stephan
Reply With Quote