HaikuDepot: notify work status from main window
[haiku.git] / src / apps / haikudepot / server / BulkLoadStateMachine.h
blob0fb8f15085bc0336790c41cfc5c34aaf1fd09b47
1 /*
2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5 #ifndef BULK_LOAD_STATE_MACHINE_H
6 #define BULK_LOAD_STATE_MACHINE_H
8 #include <String.h>
9 #include <File.h>
10 #include <Locker.h>
11 #include <Path.h>
13 #include "AbstractServerProcess.h"
14 #include "Model.h"
17 class BulkLoadStateMachine : public AbstractServerProcessListener {
18 public:
19 BulkLoadStateMachine(Model* model);
20 virtual ~BulkLoadStateMachine();
22 bool IsRunning();
24 void Start();
25 void Stop();
27 void ServerProcessExited();
29 private:
30 static status_t StartProcess(void* cookie);
31 void ContextPoll();
32 void SetContextState(bulk_load_state state);
33 void StopAllProcesses();
34 bool HasNetwork();
36 bool CanTransitionTo(
37 bulk_load_state targetState);
39 static void InitiatePopulatePackagesForDepotCallback(
40 const DepotInfo& depotInfo,
41 void* context);
43 status_t InitiateServerProcess(
44 AbstractServerProcess* process);
45 status_t InitiateBulkRepositories();
46 status_t InitiateBulkPopulateIcons();
47 status_t InitiateBulkPopulatePackagesForDepot(
48 const DepotInfo& depotInfo);
49 void InitiateBulkPopulatePackagesForAllDepots();
52 private:
53 BLocker fLock;
54 BulkLoadContext* fBulkLoadContext;
55 Model* fModel;
60 #endif // BULK_LOAD_STATE_MACHINE_H