xref: /haiku/src/apps/haikudepot/server/LocalRepositoryUpdateProcess.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2018, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #ifndef LOCAL_REPOSITORY_UPDATE_PROCESS__H
8 #define LOCAL_REPOSITORY_UPDATE_PROCESS__H
9 
10 
11 #include "AbstractProcess.h"
12 
13 #include <File.h>
14 #include <Path.h>
15 #include <String.h>
16 #include <Url.h>
17 
18 #include <package/Context.h>
19 #include <package/PackageRoster.h>
20 #include <package/RepositoryCache.h>
21 
22 #include "Model.h"
23 #include "PackageInfo.h"
24 
25 
26 /*! This process is intended to, for each repository configured on the host,
27     retrieve an updated set of data for the repository from the remote
28     repository site.  This is typically HPKR data copied over to the local
29     machine.  From there, a latter process will process this data by using the
30     facilities of the Package Kit.
31 */
32 
33 class LocalRepositoryUpdateProcess : public AbstractProcess {
34 public:
35 								LocalRepositoryUpdateProcess(
36 									Model *model, bool force = false);
37 	virtual						~LocalRepositoryUpdateProcess();
38 
39 			const char*			Name() const;
40 			const char*			Description() const;
41 
42 protected:
43 	virtual status_t			RunInternal();
44 
45 private:
46 			status_t			_RunForRepositoryName(const BString& repoName,
47 									BPackageKit::BContext& context,
48 									BPackageKit::BPackageRoster& roster,
49 									BPackageKit::BRepositoryCache* cache);
50 			void				_NotifyError(const BString& error) const;
51 			void				_NotifyError(const BString& error,
52 									const BString& details) const;
53 
54 private:
55 			Model*				fModel;
56 			bool				fForce;
57 };
58 
59 #endif // LOCAL_REPOSITORY_UPDATE_PROCESS__H
60