Cache Builder

Cache Builder — Building caches

Synopsis

#include <apt/cache-builder.h>

                    AptCacheBuilder;
AptCache *          apt_cache_builder_end               (AptCacheBuilder *builder);
AptCacheBuilder *   apt_cache_builder_new               (void);
AptCacheDependency * apt_cache_builder_new_dependency   (AptCacheBuilder *builder,
                                                         cindex *index);
AptCacheDescription * apt_cache_builder_new_description (AptCacheBuilder *builder,
                                                         cindex *index);
AptCacheIndex *     apt_cache_builder_new_file          (AptCacheBuilder *builder);
AptCacheGroup *     apt_cache_builder_new_group         (AptCacheBuilder *builder);
AptCacheGroupMember * apt_cache_builder_new_group_member
                                                        (AptCacheBuilder *builder,
                                                         cindex *index);
AptCachePackage *   apt_cache_builder_new_package       (AptCacheBuilder *builder);
AptCacheProvides *  apt_cache_builder_new_provides      (AptCacheBuilder *builder,
                                                         cindex *index);
coffset             apt_cache_builder_new_string        (AptCacheBuilder *builder,
                                                         const gchar *s,
                                                         gssize len);

Description

The cache builder is a simple object that enables the creation of caches.

Details

AptCacheBuilder

typedef struct _AptCacheBuilder AptCacheBuilder;

AptCacheBuilder is an opaque data type that may only be accessed using the following functions. It is responsible for creating APT2 caches.


apt_cache_builder_end ()

AptCache *          apt_cache_builder_end               (AptCacheBuilder *builder);

Finalizes builder and returns the generated cache. After this function returned, the object pointed to by builder does not exist anymore.

builder :

An AptCacheBuilder

Returns :

A pointer to a newly-allocated AptCache. Must be freed by calling apt_cache_unref().

apt_cache_builder_new ()

AptCacheBuilder *   apt_cache_builder_new               (void);

Creates a new AptCacheBuilder.

Returns :

A pointer to a newly-allocated AptCacheBuilder. Must be freed with apt_cache_builder_end().

apt_cache_builder_new_dependency ()

AptCacheDependency * apt_cache_builder_new_dependency   (AptCacheBuilder *builder,
                                                         cindex *index);

Creates a new dependency in the cache and returns a pointer to it which can be used to set the data. The index stored in *index can be used; for example, to set AptCachePackage.begin_dependencies.

builder :

An AptCacheBuilder

index :

Return location for the dependencies index

Returns :

A pointer to an AptCacheDependency that stays valid until the next call to apt_cache_builder_new_dependency() or apt_cache_builder_end().

apt_cache_builder_new_description ()

AptCacheDescription * apt_cache_builder_new_description (AptCacheBuilder *builder,
                                                         cindex *index);

Creates a new description in the cache and returns a pointer to it which can be used to set the data. The index stored in *index can be used; for example, to set AptCachePackage.begin_descriptions.

builder :

An AptCacheBuilder

index :

Return location for the description index

Returns :

A pointer to an AptCacheDescription that stays valid until the next call to apt_cache_builder_new_description() or apt_cache_builder_end().

apt_cache_builder_new_file ()

AptCacheIndex *     apt_cache_builder_new_file          (AptCacheBuilder *builder);

Creates a new file in the cache and returns a pointer to it which can be used to set the data.

builder :

An AptCacheBuilder

Returns :

A pointer to an AptCacheIndex that stays valid until the next call to apt_cache_builder_new_file() or apt_cache_builder_end().

apt_cache_builder_new_group ()

AptCacheGroup *     apt_cache_builder_new_group         (AptCacheBuilder *builder);

Creates a new group in the cache and returns a pointer to it which can be used to set the data. You normally do not need to call this function. If this function is not called at all, but group members have been added, the builder will automatically create the groups for the members.

builder :

An AptCacheBuilder

Returns :

A pointer to an AptCacheGroup that stays valid until the next call to apt_cache_builder_new_group() or apt_cache_builder_end().

apt_cache_builder_new_group_member ()

AptCacheGroupMember * apt_cache_builder_new_group_member
                                                        (AptCacheBuilder *builder,
                                                         cindex *index);

Creates a new group member in the cache and returns a pointer to it which can be used to set the data. The index stored in *index can be used; for example, to set AptCacheGroup.begin_members.

builder :

An AptCacheBuilder

index :

Return location for the group member index, or NULL if not needed

Returns :

A pointer to an AptCacheGroupMember that stays valid until the next call to apt_cache_builder_new_group_member() or apt_cache_builder_end().

apt_cache_builder_new_package ()

AptCachePackage *   apt_cache_builder_new_package       (AptCacheBuilder *builder);

Creates a new package in the cache and returns a pointer to it which can be used to set the data.

builder :

An AptCacheBuilder

Returns :

A pointer to an AptCachePackage that stays valid until the next call to apt_cache_builder_new_package() or apt_cache_builder_end().

apt_cache_builder_new_provides ()

AptCacheProvides *  apt_cache_builder_new_provides      (AptCacheBuilder *builder,
                                                         cindex *index);

Creates a new provides in the cache and returns a pointer to it which can be used to set the data. The index stored in *index can be used; for example, to set AptCachePackage.begin_provides.

builder :

An AptCacheBuilder

index :

Return location for the provides index

Returns :

A pointer to an AptCacheProvides that stays valid until the next call to apt_cache_builder_new_provides() or apt_cache_builder_end().

apt_cache_builder_new_string ()

coffset             apt_cache_builder_new_string        (AptCacheBuilder *builder,
                                                         const gchar *s,
                                                         gssize len);

Inserts a string into the cache. Duplicate strings are only inserted once, to improve space utilization and lookups. Empty strings and NULL pointers are not inserted, for them, 0 is returned (and the 0-th string is an empty string).

builder :

An AptCacheBuilder

s :

The string that shall be inserted

len :

The length of s, or -1 if s is nul-terminated

Returns :

The offset of the string in the cache's string array.