[Box Backup] (Un)Deleting Files

Ben Summers boxbackup@fluffy.co.uk
Sun, 13 Mar 2005 11:20:39 +0000


On 12 Mar 2005, at 20:00, Chris Wilson wrote:

> Hi Ben and all,
>
> Sorry, a few more questions for you. In the client protocol 
> (autogen_BackupProtocolClient.cpp) there are three ProtocolObject 
> classes relating to deleting and undeleting objects:
>
> 	BackupProtocolClientDeleteDirectory
> 	BackupProtocolClientUndeleteDirectory

(Further to a previous message about marking files for immediate 
deletion, this would make a good basis for a change flags command.)

> 	BackupProtocolClientDeleteFile
>
> Does this mean it's impossible to undelete files with the current 
> protocol?

Yes.

>  Please would you consider adding this feature?

OK.

>
> Also, why is there a distinction between files and directories at the 
> protocol level?

Because they're different things. Files are really just blobs of data, 
with some known structure so the server can do basic operations on 
them. Directories are rather more complicated, and can be queried and 
modified as required. Looking at the operations, how would they neatly 
be unified.

>
> Finally, it seems to be possible to ChangeDirAttributes and 
> SetReplacementFileAttributes. Can these be used to delete and undelete 
> objects?

No. They modify the attributes the directories and files will have on 
the client's filing system when they get restored.

>  It appears that SetReplacementFileAttributes takes an attributes 
> hash, but I have no idea how to generate this.

BackupClientFileAttributes::GenerateAttributeHash()

>  Also, the distinction between files and directories (at the protocol 
> level) again mystifies me. Why are the names inconsistent?

They do different things. Directories have attributes included in the 
directory record. Files have attributes embedded in the stored file, 
but the directory record can include "replacement" attributes which 
override the attributes in the stored file. This is for when files have 
attributes changed, but the data isn't modified.

Ben