summaryrefslogtreecommitdiff
path: root/apt-pkg/metaindex.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-23 15:16:08 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-10 17:25:26 +0200
commit5ad0096a4e19e191b59634e8a8817995ec4045ad (patch)
tree70b2310cdff52e809ffebcdfae4ffa4cd42f10fb /apt-pkg/metaindex.h
parent268ffcebb9ae4278b1e3c3f89f8167f229164dbd (diff)
merge indexRecords into metaIndex
indexRecords was used to parse the Release file – mostly the hashes – while metaIndex deals with downloading the Release file, storing all indexes coming from this release and … parsing the Release file, but this time mostly for the other fields. That wasn't a problem in metaIndex as this was done in the type specific subclass, but indexRecords while allowing to override the parsing method did expect by default a specific format. APT isn't really supporting different types at the moment, but this is a violation of the abstraction we have everywhere else and, which is the actual reason for this merge: Options e.g. coming from the sources.list come to metaIndex naturally, which needs to wrap them up and bring them into indexRecords, so the acquire system is told about it as they don't get to see the metaIndex, but they don't really belong in indexRecords as this is just for storing data loaded from the Release file… the result is a complete mess. I am not saying it is a lot prettier after the merge, but at least adding new options is now slightly easier and there is just one place responsible for parsing the Release file. That can't hurt.
Diffstat (limited to 'apt-pkg/metaindex.h')
-rw-r--r--apt-pkg/metaindex.h66
1 files changed, 56 insertions, 10 deletions
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index 9667e1c92..5be7397ae 100644
--- a/apt-pkg/metaindex.h
+++ b/apt-pkg/metaindex.h
@@ -28,35 +28,81 @@ class OpProgress;
class metaIndex
{
+public:
+ APT_IGNORE_DEPRECATED_PUSH
+ struct checkSum
+ {
+ std::string MetaKeyFilename;
+ HashStringList Hashes;
+ unsigned long long Size;
+
+ APT_DEPRECATED HashString Hash;
+ };
+ APT_IGNORE_DEPRECATED_POP
+
+ enum APT_HIDDEN TriState {
+ TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET
+ };
+private:
void * const d;
- protected:
+protected:
std::vector <pkgIndexFile *> *Indexes;
+ // parsed from the sources.list
const char *Type;
std::string URI;
std::string Dist;
+ TriState Trusted;
+ TriState LoadedSuccessfully;
- public:
+ // parsed from a file
+ std::string Suite;
+ std::string Codename;
+ time_t Date;
+ time_t ValidUntil;
+ bool SupportsAcquireByHash;
+ std::map<std::string, checkSum *> Entries;
+public:
// Various accessors
- virtual std::string GetURI() const {return URI;}
- virtual std::string GetDist() const {return Dist;}
- virtual const char* GetType() const {return Type;}
+ std::string GetURI() const;
+ std::string GetDist() const;
+ const char* GetType() const;
+ TriState GetTrusted() const;
- // interface to to query it
- /** \return the path of the local file (or "" if its not available) */
- virtual std::string LocalFileName() const;
+ std::string GetCodename() const;
+ std::string GetSuite() const;
+ bool GetSupportsAcquireByHash() const;
+ time_t GetValidUntil() const;
+ time_t GetDate() const;
+
+ std::string GetExpectedDist() const;
+ bool CheckDist(std::string const &MaybeDist) const;
// Interface for acquire
+ virtual std::string Describe() const;
virtual std::string ArchiveURI(std::string const& File) const = 0;
- virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
+ virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0;
virtual std::vector<IndexTarget> GetIndexTargets() const = 0;
virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
virtual bool IsTrusted() const = 0;
+ virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0;
+ /** @return a new metaIndex object based on this one, but without information from #Load */
+ virtual metaIndex * UnloadedClone() const = 0;
+ // the given metaIndex is potentially invalid after this call and should be deleted
+ void swapLoad(metaIndex * const OldMetaIndex);
- virtual std::string Describe() const;
+ // Lookup functions for parsed Hashes
+ checkSum *Lookup(std::string const &MetaKey) const;
+ /** \brief tests if a checksum for this file is available */
+ bool Exists(std::string const &MetaKey) const;
+ std::vector<std::string> MetaKeys() const;
+ TriState GetLoadedSuccessfully() const;
+
+ // Interfaces for pkgCacheGen
virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
+
metaIndex(std::string const &URI, std::string const &Dist,
char const * const Type);
virtual ~metaIndex();