xref: /haiku/src/apps/haikudepot/server/LocalPkgDataLoadProcess.h (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
1 /*
2  * Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #ifndef LOCAL_PKG_DATA_LOAD_PROCESS__H
8 #define LOCAL_PKG_DATA_LOAD_PROCESS__H
9 
10 
11 #include "AbstractProcess.h"
12 
13 #include "Model.h"
14 #include "PackageInfo.h"
15 
16 #include <File.h>
17 #include <Path.h>
18 #include <String.h>
19 #include <Url.h>
20 
21 #include <package/RepositoryCache.h>
22 
23 
24 class PkgDataLoadState;
25 
26 
27 /*! This process will take the data from the locally stored repositories (HPKR)
28     and will extract the packages.  The packages are then loaded into the
29     HaikuDepot 'Model'.
30 */
31 
32 class LocalPkgDataLoadProcess : public AbstractProcess {
33 public:
34 								LocalPkgDataLoadProcess(
35 									PackageInfoListenerRef packageInfoListener,
36 									Model *model, bool force = false);
37 	virtual						~LocalPkgDataLoadProcess();
38 
39 			const char*			Name() const;
40 			const char*			Description() const;
41 
42 protected:
43 	virtual status_t			RunInternal();
44 
45 private:
46 			void				_NotifyError(const BString& messageText) const;
47 			off_t				_DeriveSize(const PackageInfoRef modelInfo) const;
48 
49 private:
50 			Model*				fModel;
51 			bool				fForce;
52 			PackageInfoListenerRef
53 								fPackageInfoListener;
54 };
55 
56 #endif // LOCAL_PKG_DATA_LOAD_PROCESS__H
57