1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/RepoStatus.h
12 #ifndef ZYPP2_REPOSTATUS_H
13 #define ZYPP2_REPOSTATUS_H
16 #include "zypp/base/PtrTypes.h"
17 #include "zypp/CheckSum.h"
18 #include "zypp/Date.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 // CLASS NAME : RepoStatus
29 * \short Local facts about a repository
30 * This class represents the status of a
31 * repository on the system.
33 * Anything that is not provided on the metadata
34 * files, like the timestamp of the downloaded
35 * metadata, and its checksum.
39 friend std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
44 * reads the status from a file which contains the
45 * checksum and timestamp in each line.
47 * \returns An empty \ref RepoStatus if the file does not
48 * exist or is not readable.
50 static RepoStatus fromCookieFile( const Pathname &path );
53 * save the status information to a cookie file
54 * \throws Exception if the file can't be saved
56 void saveToCookieFile( const Pathname &path ) const;
59 * Checksum of the repository.
60 * Usually the checksum of the index, but any
61 * checksum that changes when the repository changes
62 * in any way is sufficient.
64 std::string checksum() const;
67 * timestamp of the repository. If the repository
68 * changes, it has to be updated as well with the
71 Date timestamp() const;
74 * \short Is the status empty?
76 * An empty status means that the status
82 * set the repository checksum \see checksum
85 RepoStatus & setChecksum( const std::string &checksum );
88 * set the repository timestamp \see timestamp
91 RepoStatus & setTimestamp( const Date ×tamp );
101 * \short Status from a single file
102 * As most repository state is represented
103 * by the status of the index file, you can
104 * construct the status from a file.
106 * \note construct from a non existing
107 * file will result in an empty status
109 * \note construct from a directory, the
110 * directories mtime will be also used as
113 * \todo Add recursive option for dirs so we finaly get
114 * the same as \ref parser::plaindir::dirStatus and can
117 RepoStatus( const Pathname &file );
125 /** Pointer to implementation */
126 RWCOW_pointer<Impl> _pimpl;
128 ///////////////////////////////////////////////////////////////////
130 /** \relates RepoStatus Stream output */
131 std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
134 * combines 2 repostatus with a checksum based on both
135 * checksums and the newest timestamp
137 RepoStatus operator&&( const RepoStatus &lhs, const RepoStatus &rhs );
139 /////////////////////////////////////////////////////////////////
141 ///////////////////////////////////////////////////////////////////
142 #endif // ZYPP2_REPOSTATUS_H