Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Nov 17 10:56:21 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id mAHIuLEI005309 for ; Mon, 17 Nov 2008 10:56:21 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAHIqr5q027250 for ; Mon, 17 Nov 2008 10:52:53 -0800 Message-Id: <200811171852.mAHIqr5q027250@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Store question Date: Mon, 17 Nov 2008 10:52:53 -0800 From: Bill Cheng Someone wrote: > So if i receive a command like: > > " store mall.c 1 type="code" " from the user first time, i will store the > file mall.c in the files directory. Well, you need to store the file as "N.data" where N is a number. > Now, if the user enters the same command, no change at all , is this > considered as a duplicate file ? No. It will be a new version of the same file. > or anything from the prompt is always > assumed to be unique. This can happen after n commands after the user gave > the first store command too. Correct. > If say we have match in the above scenario i.e. both the files are same, > then do we need to inform the user that the file already exists on the node, > the second time he tries to save it and stop processing the Store further ? > or shud we just process the command normally ?? You do not need to check if the file is already in the node since every time you initiate a STORE, you will have to generate a Nonce, and that will make the new file different from what's already stored. -- Bill Cheng // bill.cheng@usc.edu On Mon, Nov 17, 2008 at 9:11 AM, Bill Cheng wrote: > Someone wrote: > > > Upon your comments about STORE message below, I conclude that when > > receiving STORE message, the node doesn't need to check if it already > > has a copy of the file. Because it's impossible since the nonce must be > > different. > > Correct. > > > What about when forwarding GET message? I think after it flips the > > coin and decides to cache the file, it needs to check if it already has > > a copy of the file, correct? > > Correct. > > > If it is correct, besides forwarding GET message and receiving GET > > message, is there any other situation we need to check if it already has > > a copy of the file? > > I cannot think of anything at this point. If you see a > situation where it needs to be done, then you need to write > code for it. > -- > Bill Cheng // bill.cheng@usc.edu > > > > > > Bill Cheng wrote: > > Someone wrote: > > > > > Had a few doubts on the store feature ... > > > Is it possible for the same file to be stored twice on the > > > network? > > > > Yes. > > > > > Seems possible so when I get a store response on a node > > > I need to check if the file already exists on the node before > > > storing it (in the Cache area). > > > > You don't need to check if you already has a copy of the file > > if you are just caching it. (Of course, you need check if > > you have seen the *message* by looking at the message UOID > > and discard duplicate messages -- this is what you do for > > messages of all types anyway.) > > > > > While matching should the > > > filename and the SHA value be enough or should we match the > > > keywords also ? > > > > No. FileName, SHA1, *and* Nonce. > > > > > Should we consider the files to be different if > > > they have the same name and content but different keywords ? > > > > Just FileName, SHA1, *and* Nonce. If the keywords are > > different for the same file, Nonce must also be different! > > > > > If I already have the file do I still need to probabilistically > > > flood it ? > > > > Yes. You should *not* even be checking if you have the > > file already if you are forwarding a file. > > -- > > Bill Cheng // bill.cheng@usc.edu