Ignore:
Timestamp:
28/05/2008 16:24:05 (4 years ago)
Author:
chris
Message:

Track and log file deletions by name.

Split crypto init and file sync process into its own method, to reduce
call depth and facilitate calling in process from tests.

Differentiate between 3 uses of stat in BackupClientDirectoryRecord? by
renaming the structures.

Use stat instead of lstat when checking the filesystem that's holding an
entity, in case it's a symbolic link to a different filesystem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h

    r1801 r2181  
    9797                const std::string& rLocalPath, 
    9898                int64_t FileSize) = 0; 
     99        virtual void NotifyDirectoryDeleted( 
     100                int64_t ObjectID, 
     101                const std::string& rRemotePath) = 0; 
     102        virtual void NotifyFileDeleted( 
     103                int64_t ObjectID, 
     104                const std::string& rRemotePath) = 0; 
    99105}; 
    100106 
     
    138144                SyncParams( 
    139145                        BackupDaemon &rDaemon, 
    140                         ProgressNotifier &rProgressNotifier, 
    141146                        BackupClientContext &rContext); 
    142147                ~SyncParams(); 
     
    145150                SyncParams(const SyncParams&); 
    146151                SyncParams &operator=(const SyncParams&); 
    147                 ProgressNotifier &mrProgressNotifier; 
    148152                 
    149153        public: 
     
    162166                box_time_t mUploadAfterThisTimeInTheFuture; 
    163167                bool mHaveLoggedWarningAboutFutureFileTimes; 
    164          
    165                 ProgressNotifier& GetProgressNotifier() const  
    166                 {  
    167                         return mrProgressNotifier; 
    168                 } 
    169168        }; 
    170169 
    171         void SyncDirectory(SyncParams &rParams, int64_t ContainingDirectoryID, const std::string &rLocalPath, 
     170        void SyncDirectory(SyncParams &rParams, 
     171                int64_t ContainingDirectoryID, 
     172                const std::string &rLocalPath, 
     173                const std::string &rRemotePath, 
    172174                bool ThisDirHasJustBeenCreated = false); 
    173175 
     
    175177        void DeleteSubDirectories(); 
    176178        BackupStoreDirectory *FetchDirectoryListing(SyncParams &rParams); 
    177         void UpdateAttributes(SyncParams &rParams, BackupStoreDirectory *pDirOnStore, const std::string &rLocalPath); 
    178         bool UpdateItems(SyncParams &rParams, const std::string &rLocalPath, BackupStoreDirectory *pDirOnStore, 
     179        void UpdateAttributes(SyncParams &rParams, 
     180                BackupStoreDirectory *pDirOnStore, 
     181                const std::string &rLocalPath); 
     182        bool UpdateItems(SyncParams &rParams, const std::string &rLocalPath, 
     183                const std::string &rRemotePath, 
     184                BackupStoreDirectory *pDirOnStore, 
    179185                std::vector<BackupStoreDirectory::Entry *> &rEntriesLeftOver, 
    180                 std::vector<std::string> &rFiles, const std::vector<std::string> &rDirs); 
    181         int64_t UploadFile(SyncParams &rParams, const std::string &rFilename, const BackupStoreFilename &rStoreFilename, 
    182                 int64_t FileSize, box_time_t ModificationTime, box_time_t AttributesHash, bool NoPreviousVersionOnServer); 
    183         void SetErrorWhenReadingFilesystemObject(SyncParams &rParams, const char *Filename); 
    184         void RemoveDirectoryInPlaceOfFile(SyncParams &rParams, BackupStoreDirectory *pDirOnStore, int64_t ObjectID, const std::string &rFilename); 
     186                std::vector<std::string> &rFiles, 
     187                const std::vector<std::string> &rDirs); 
     188        int64_t UploadFile(SyncParams &rParams, 
     189                const std::string &rFilename, 
     190                const BackupStoreFilename &rStoreFilename, 
     191                int64_t FileSize, box_time_t ModificationTime, 
     192                box_time_t AttributesHash, bool NoPreviousVersionOnServer); 
     193        void SetErrorWhenReadingFilesystemObject(SyncParams &rParams, 
     194                const char *Filename); 
     195        void RemoveDirectoryInPlaceOfFile(SyncParams &rParams, 
     196                BackupStoreDirectory* pDirOnStore, 
     197                BackupStoreDirectory::Entry* pEntry, 
     198                const std::string &rFilename); 
    185199 
    186200private: 
    187         int64_t                 mObjectID; 
     201        int64_t         mObjectID; 
    188202        std::string     mSubDirName; 
    189         bool                    mInitialSyncDone; 
    190         bool                    mSyncDone; 
     203        bool            mInitialSyncDone; 
     204        bool            mSyncDone; 
    191205 
    192206        // Checksum of directory contents and attributes, used to detect changes 
    193207        uint8_t mStateChecksum[MD5Digest::DigestLength]; 
    194208 
    195         std::map<std::string, box_time_t>                                               *mpPendingEntries; 
    196         std::map<std::string, BackupClientDirectoryRecord *>    mSubDirectories; 
     209        std::map<std::string, box_time_t> *mpPendingEntries; 
     210        std::map<std::string, BackupClientDirectoryRecord *> mSubDirectories; 
    197211        // mpPendingEntries is a pointer rather than simple a member 
    198         // variables, because most of the time it'll be empty. This would waste a lot 
    199         // of memory because of STL allocation policies. 
     212        // variable, because most of the time it'll be empty. This would 
     213        // waste a lot of memory because of STL allocation policies. 
    200214}; 
    201215 
Note: See TracChangeset for help on using the changeset viewer.