Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 09-28-2004
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi Stephan,

If I were going to add an upload operation to IcePatch, I would probably add it to the Directory interface. This would allow me to manage the file objects in a transactional way, i.e., the uploaded data is stored in a temporary file, and the file is only replaced once all the data has been uploaded successfully. I would also hold a lock while replacing the file to ensure that a client doesn't get inconsistent information.

There isn't anything you can do about an invalid FileDesc instance that a client already possesses; you just have to wait for the client to notice that the MD5 no longer matches.

Hope that helps.

- Mark
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie's question: wondering how to design to make this work... sjinny Help Center 6 06-05-2006 12:15 PM
how to use icepatch as win32 service? jeylee Help Center 2 03-07-2005 08:49 AM
How to use IcePatch? weiwei Help Center 7 05-24-2004 12:49 PM
How to use IcePatch? alwayscy1 Help Center 3 10-27-2003 08:40 PM
specific design question sylvain Help Center 4 07-08-2003 07:28 PM


All times are GMT -4. The time now is 08:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.