1 #ifndef PKGLIB_METAINDEX_H
2 #define PKGLIB_METAINDEX_H
4 #include <apt-pkg/indexfile.h>
5 #include <apt-pkg/init.h>
12 #ifndef APT_10_CLEANER_HEADERS
13 #include <apt-pkg/pkgcache.h>
14 class pkgCacheGenerator
;
17 #ifndef APT_8_CLEANER_HEADERS
18 #include <apt-pkg/srcrecords.h>
19 #include <apt-pkg/pkgrecords.h>
25 class pkgCacheGenerator
;
31 APT_IGNORE_DEPRECATED_PUSH
34 std::string MetaKeyFilename
;
35 HashStringList Hashes
;
36 unsigned long long Size
;
38 APT_DEPRECATED HashString Hash
;
40 APT_IGNORE_DEPRECATED_POP
42 enum APT_HIDDEN TriState
{
43 TRI_YES
, TRI_DONTCARE
, TRI_NO
, TRI_UNSET
48 std::vector
<pkgIndexFile
*> *Indexes
;
49 // parsed from the sources.list
61 bool SupportsAcquireByHash
;
62 std::map
<std::string
, checkSum
*> Entries
;
63 TriState LoadedSuccessfully
;
67 std::string
GetURI() const;
68 std::string
GetDist() const;
69 const char* GetType() const;
70 TriState
GetTrusted() const;
71 std::string
GetSignedBy() const;
73 std::string
GetCodename() const;
74 std::string
GetSuite() const;
75 bool GetSupportsAcquireByHash() const;
76 time_t GetValidUntil() const;
77 time_t GetDate() const;
79 std::string
GetExpectedDist() const;
80 bool CheckDist(std::string
const &MaybeDist
) const;
82 // Interface for acquire
83 virtual std::string
Describe() const;
84 virtual std::string
ArchiveURI(std::string
const& File
) const = 0;
85 virtual bool GetIndexes(pkgAcquire
*Owner
, bool const &GetAll
=false) = 0;
86 virtual std::vector
<IndexTarget
> GetIndexTargets() const = 0;
87 virtual std::vector
<pkgIndexFile
*> *GetIndexFiles() = 0;
88 virtual bool IsTrusted() const = 0;
89 virtual bool Load(std::string
const &Filename
, std::string
* const ErrorText
) = 0;
90 /** @return a new metaIndex object based on this one, but without information from #Load */
91 virtual metaIndex
* UnloadedClone() const = 0;
92 // the given metaIndex is potentially invalid after this call and should be deleted
93 void swapLoad(metaIndex
* const OldMetaIndex
);
95 // Lookup functions for parsed Hashes
96 checkSum
*Lookup(std::string
const &MetaKey
) const;
97 /** \brief tests if a checksum for this file is available */
98 bool Exists(std::string
const &MetaKey
) const;
99 std::vector
<std::string
> MetaKeys() const;
100 TriState
GetLoadedSuccessfully() const;
102 // Interfaces for pkgCacheGen
103 virtual pkgCache::RlsFileIterator
FindInCache(pkgCache
&Cache
, bool const ModifyCheck
) const;
104 virtual bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const;
107 metaIndex(std::string
const &URI
, std::string
const &Dist
,
108 char const * const Type
);
109 virtual ~metaIndex();
111 // FIXME: make virtual on next abi break
112 bool IsArchitectureSupported(std::string
const &arch
) const;