13369e03dSAndrew Lindesay /* 2f67e0538SAndrew Lindesay * Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>. 33369e03dSAndrew Lindesay * All rights reserved. Distributed under the terms of the MIT License. 43369e03dSAndrew Lindesay */ 53369e03dSAndrew Lindesay #ifndef LOCAL_PKG_DATA_LOAD_PROCESS__H 63369e03dSAndrew Lindesay #define LOCAL_PKG_DATA_LOAD_PROCESS__H 73369e03dSAndrew Lindesay 83369e03dSAndrew Lindesay 93369e03dSAndrew Lindesay #include "AbstractProcess.h" 103369e03dSAndrew Lindesay 113369e03dSAndrew Lindesay #include "Model.h" 123369e03dSAndrew Lindesay #include "PackageInfo.h" 133369e03dSAndrew Lindesay 143369e03dSAndrew Lindesay #include <File.h> 153369e03dSAndrew Lindesay #include <Path.h> 163369e03dSAndrew Lindesay #include <String.h> 173369e03dSAndrew Lindesay #include <Url.h> 183369e03dSAndrew Lindesay 193369e03dSAndrew Lindesay #include <package/RepositoryCache.h> 203369e03dSAndrew Lindesay 213369e03dSAndrew Lindesay 223369e03dSAndrew Lindesay class PkgDataLoadState; 233369e03dSAndrew Lindesay 243369e03dSAndrew Lindesay 253369e03dSAndrew Lindesay /*! This process will take the data from the locally stored repositories (HPKR) 263369e03dSAndrew Lindesay and will extract the packages. The packages are then loaded into the 273369e03dSAndrew Lindesay HaikuDepot 'Model'. 283369e03dSAndrew Lindesay */ 293369e03dSAndrew Lindesay 303369e03dSAndrew Lindesay class LocalPkgDataLoadProcess : public AbstractProcess { 313369e03dSAndrew Lindesay public: 323369e03dSAndrew Lindesay LocalPkgDataLoadProcess( 33*409af934SAndrew Lindesay PackageInfoListenerRef packageInfoListener, 343369e03dSAndrew Lindesay Model *model, bool force = false); 353369e03dSAndrew Lindesay virtual ~LocalPkgDataLoadProcess(); 363369e03dSAndrew Lindesay 373369e03dSAndrew Lindesay const char* Name() const; 383369e03dSAndrew Lindesay const char* Description() const; 393369e03dSAndrew Lindesay 403369e03dSAndrew Lindesay protected: 413369e03dSAndrew Lindesay virtual status_t RunInternal(); 423369e03dSAndrew Lindesay 433369e03dSAndrew Lindesay private: 443369e03dSAndrew Lindesay void _NotifyError(const BString& messageText) const; 45f67e0538SAndrew Lindesay off_t _DeriveSize(const PackageInfoRef modelInfo) const; 463369e03dSAndrew Lindesay 473369e03dSAndrew Lindesay private: 483369e03dSAndrew Lindesay Model* fModel; 493369e03dSAndrew Lindesay bool fForce; 50*409af934SAndrew Lindesay PackageInfoListenerRef 513369e03dSAndrew Lindesay fPackageInfoListener; 523369e03dSAndrew Lindesay }; 533369e03dSAndrew Lindesay 543369e03dSAndrew Lindesay #endif // LOCAL_PKG_DATA_LOAD_PROCESS__H 55