Ignore:
Timestamp:
27/08/2010 10:18:57 (21 months ago)
Author:
chris
Message:

Change the store info file format to include an account name and the
number of blocks in current (not old or deleted) files, an
often-requested feature since this number is difficult to calculate
otherwise, because files may be both old and deleted, thus counted
twice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupstore/BackupStoreInfo.h

    r1868 r2702  
    4747         
    4848        // Save modified infomation back to store 
    49         void Save(); 
     49        void Save(bool allowOverwrite = true); 
    5050         
    5151        // Data access functions 
     
    5353        int64_t GetLastObjectIDUsed() const {return mLastObjectIDUsed;} 
    5454        int64_t GetBlocksUsed() const {return mBlocksUsed;} 
     55        int64_t GetBlocksInCurrentFiles() const {return mBlocksInCurrentFiles;} 
    5556        int64_t GetBlocksInOldFiles() const {return mBlocksInOldFiles;} 
    5657        int64_t GetBlocksInDeletedFiles() const {return mBlocksInDeletedFiles;} 
     
    5960        int64_t GetBlocksSoftLimit() const {return mBlocksSoftLimit;} 
    6061        int64_t GetBlocksHardLimit() const {return mBlocksHardLimit;} 
     62        int64_t GetNumFiles() const {return mNumFiles;} 
     63        int64_t GetNumOldFiles() const {return mNumOldFiles;} 
     64        int64_t GetNumDeletedFiles() const {return mNumDeletedFiles;} 
     65        int64_t GetNumDirectories() const {return mNumDirectories;} 
    6166        bool IsReadOnly() const {return mReadOnly;} 
    6267        int GetDiscSetNumber() const {return mDiscSet;} 
     68 
     69        int ReportChangesTo(BackupStoreInfo& rOldInfo); 
    6370         
    6471        // Data modification functions 
    6572        void ChangeBlocksUsed(int64_t Delta); 
     73        void ChangeBlocksInCurrentFiles(int64_t Delta); 
    6674        void ChangeBlocksInOldFiles(int64_t Delta); 
    6775        void ChangeBlocksInDeletedFiles(int64_t Delta); 
     
    7179        void RemovedDeletedDirectory(int64_t DirID); 
    7280        void ChangeLimits(int64_t BlockSoftLimit, int64_t BlockHardLimit); 
     81        void AdjustNumFiles(int64_t increase); 
     82        void AdjustNumOldFiles(int64_t increase); 
     83        void AdjustNumDeletedFiles(int64_t increase); 
     84        void AdjustNumDirectories(int64_t increase); 
    7385         
    7486        // Object IDs 
     
    7991        void SetClientStoreMarker(int64_t ClientStoreMarker); 
    8092 
    81 private: 
    82         static std::auto_ptr<BackupStoreInfo> CreateForRegeneration(int32_t AccountID, const std::string &rRootDir, 
    83                 int DiscSet, int64_t LastObjectID, int64_t BlocksUsed, int64_t BlocksInOldFiles, 
    84                 int64_t BlocksInDeletedFiles, int64_t BlocksInDirectories, int64_t BlockSoftLimit, int64_t BlockHardLimit); 
     93        const std::string& GetAccountName() { return mAccountName; } 
     94        void SetAccountName(const std::string& rName); 
    8595 
    8696private: 
     97        static std::auto_ptr<BackupStoreInfo> CreateForRegeneration( 
     98                int32_t AccountID, const std::string &rAccountName, 
     99                const std::string &rRootDir, int DiscSet, 
     100                int64_t LastObjectID, int64_t BlocksUsed, 
     101                int64_t BlocksInCurrentFiles, int64_t BlocksInOldFiles, 
     102                int64_t BlocksInDeletedFiles, int64_t BlocksInDirectories, 
     103                int64_t BlockSoftLimit, int64_t BlockHardLimit); 
     104 
    87105        // Location information 
     106        // Be VERY careful about changing types of these values, as 
     107        // they now define the sizes of fields on disk (via Archive). 
    88108        int32_t mAccountID; 
     109        std::string mAccountName; 
    89110        int mDiscSet; 
    90111        std::string mFilename; 
     
    98119        int64_t mLastObjectIDUsed; 
    99120        int64_t mBlocksUsed; 
     121        int64_t mBlocksInCurrentFiles; 
    100122        int64_t mBlocksInOldFiles; 
    101123        int64_t mBlocksInDeletedFiles; 
     
    103125        int64_t mBlocksSoftLimit; 
    104126        int64_t mBlocksHardLimit; 
     127        int64_t mNumFiles; 
     128        int64_t mNumOldFiles; 
     129        int64_t mNumDeletedFiles; 
     130        int64_t mNumDirectories; 
    105131        std::vector<int64_t> mDeletedDirectories; 
    106132}; 
    107  
    108133 
    109134#endif // BACKUPSTOREINFO__H 
Note: See TracChangeset for help on using the changeset viewer.