1f633814fa
Instead of handling compression for individual file/attribute data we do now compress the whole heap where they are stored. This significantly improves compression ratios. We still divide the uncompressed data into 64 KiB chunks and use a chunk offset array for the compressed chunks to allow for quick random access without too much overhead. The tradeoff is a limited possible compression ratio -- i.e. we won't be as good as tar.gz (though surprisingly with my test archives we did better than zip). The other package file sections (package attributes and TOC) are no longer compressed individually. Their uncompressed data are simply pushed onto the heap where the usual compression strategy applies. To simplify things the repository format has been changed in the same manner although it doesn't otherwise use the heap, since it only stores meta data. Due to the data compression having been exposed in public and private API, this change touches a lot of package kit using code, including packagefs and the boot loader packagefs support. The latter two haven't been tested yet. Moreover packagefs needs a new kind of cache so we avoid re-reading the same heap chunk for two different data items it contains.
56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
/*
|
|
* Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _PACKAGE__HPKG__PRIVATE__REPOSITORY_READER_IMPL_H_
|
|
#define _PACKAGE__HPKG__PRIVATE__REPOSITORY_READER_IMPL_H_
|
|
|
|
|
|
#include <package/hpkg/ReaderImplBase.h>
|
|
|
|
#include <package/RepositoryInfo.h>
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
class BRepositoryContentHandler;
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
class RepositoryReaderImpl : public ReaderImplBase {
|
|
typedef ReaderImplBase inherited;
|
|
public:
|
|
RepositoryReaderImpl(BErrorOutput* errorOutput);
|
|
~RepositoryReaderImpl();
|
|
|
|
status_t Init(const char* fileName);
|
|
status_t Init(int fd, bool keepFD);
|
|
|
|
status_t GetRepositoryInfo(
|
|
BRepositoryInfo* _repositoryInfo) const;
|
|
|
|
status_t ParseContent(
|
|
BRepositoryContentHandler* contentHandler);
|
|
|
|
private:
|
|
struct RootAttributeHandler;
|
|
|
|
private:
|
|
BRepositoryInfo fRepositoryInfo;
|
|
};
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
} // namespace BHPKG
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PRIVATE__REPOSITORY_READER_IMPL_H_
|