add methods to retrieve the status (checksum, date) of
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 20 Jul 2007 20:21:08 +0000 (20:21 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 20 Jul 2007 20:21:08 +0000 (20:21 +0000)
metadata and cache

zypp/RepoManager.cc
zypp/RepoManager.h

index f07ff70..27b041d 100644 (file)
@@ -262,7 +262,7 @@ namespace zypp
 
   ////////////////////////////////////////////////////////////////////////////
 
-  RepoStatus RepoManager::rawMetadataStatus( const RepoInfo &info )
+  RepoStatus RepoManager::metadataStatus( const RepoInfo &info ) const
   {
     Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
     RepoType repokind = info.type();
@@ -339,7 +339,7 @@ namespace zypp
         }
 
         Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
-        oldstatus = rawMetadataStatus(info);
+        oldstatus = metadataStatus(info);
 
         if ( ( repokind.toEnum() == RepoType::RPMMD_e ) ||
              ( repokind.toEnum() == RepoType::YAST2_e ) )
@@ -468,7 +468,7 @@ namespace zypp
 
     cache::CacheStore store(_pimpl->options.repoCachePath);
 
-    RepoStatus raw_metadata_status = rawMetadataStatus(info);
+    RepoStatus raw_metadata_status = metadataStatus(info);
     if ( raw_metadata_status.empty() )
     {
       ZYPP_THROW(RepoMetadataException(info));
@@ -553,7 +553,7 @@ namespace zypp
 
   ////////////////////////////////////////////////////////////////////////////
 
-  repo::RepoType RepoManager::probe( const Url &url )
+  repo::RepoType RepoManager::probe( const Url &url ) const
   {
     if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
     {
@@ -608,6 +608,14 @@ namespace zypp
     return store.isCached(info.alias());
   }
 
+  RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const
+  {
+    cache::CacheStore store(_pimpl->options.repoCachePath);
+    data::RecordId id = store.lookupRepository(info.alias());
+    RepoStatus cache_status = store.repositoryStatus(id);
+    return cache_status;
+  }
+
   Repository RepoManager::createFromCache( const RepoInfo &info,
                                            const ProgressData::ReceiverFnc & progressrcv )
   {
index 1b41b4f..678991f 100644 (file)
@@ -102,6 +102,11 @@ namespace zypp
    std::list<RepoInfo> knownRepositories() const;
 
    /**
+    * \short Status of local metadata
+    */
+    RepoStatus metadataStatus( const RepoInfo &info ) const;
+
+   /**
     * \short Refresh local raw cache
     *
     * Will try to download the metadata
@@ -128,6 +133,11 @@ namespace zypp
     */
    void cleanMetadata( const RepoInfo &info,
                        const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
+   /**
+    * \short Status of metadata cache
+    */
+    RepoStatus cacheStatus( const RepoInfo &info ) const;
    
    /**
     * \short Refresh local cache
@@ -200,7 +210,7 @@ namespace zypp
     *
     * \todo FIXME Should this be private?
     */
-   repo::RepoType probe( const Url &url );
+   repo::RepoType probe( const Url &url ) const;
    
    
    /**