Mostly style-related changes to package kit:
* drop 'Haiku' namespace * rename 'Package' namespace to 'BPackageKit' * renamed all public classes to begin with a 'B' * renamed BPackageKit::Roster to BPackageKit::BPackageRoster to not clash with the BRoster from the application kit. * fix some instances of public headers including private ones Some functional changes, too: * JobQueue now removes and deletes dependants of failed jobs automatically * JobQueue supports waiting for jobs to become runnable * added a couple of InitCheck() methods where they make sense and invoke those in users of these classes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40287 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
#define _HAIKU__PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
#ifndef _PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
#define _PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
|
||||
|
||||
#include <String.h>
|
||||
@@ -12,22 +12,20 @@
|
||||
#include <package/Request.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
class ActivateRepositoryConfigJob;
|
||||
}
|
||||
using Private::ActivateRepositoryConfigJob;
|
||||
using BPrivate::ActivateRepositoryConfigJob;
|
||||
|
||||
|
||||
class AddRepositoryRequest : public Request {
|
||||
typedef Request inherited;
|
||||
class AddRepositoryRequest : public BRequest {
|
||||
typedef BRequest inherited;
|
||||
|
||||
public:
|
||||
AddRepositoryRequest(const Context& context,
|
||||
AddRepositoryRequest(const BContext& context,
|
||||
const BString& repositoryBaseURL,
|
||||
bool asUserRepository);
|
||||
virtual ~AddRepositoryRequest();
|
||||
@@ -37,8 +35,8 @@ public:
|
||||
const BString& RepositoryName() const;
|
||||
|
||||
protected:
|
||||
// JobStateListener
|
||||
virtual void JobSucceeded(Job* job);
|
||||
// BJobStateListener
|
||||
virtual void JobSucceeded(BJob* job);
|
||||
|
||||
private:
|
||||
BString fRepositoryBaseURL;
|
||||
@@ -50,9 +48,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
#endif // _PACKAGE__ADD_REPOSITORY_REQUEST_H_
|
||||
|
||||
@@ -2,30 +2,26 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__ATTRIBUTES_H_
|
||||
#define _HAIKU__PACKAGE__ATTRIBUTES_H_
|
||||
#ifndef _PACKAGE__ATTRIBUTES_H_
|
||||
#define _PACKAGE__ATTRIBUTES_H_
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
// attributes used in package and as file attribute, too
|
||||
extern const char* kNameAttribute;
|
||||
extern const char* kVendorAttribute;
|
||||
extern const char* kVersionAttribute;
|
||||
extern const char* kPackageNameAttribute;
|
||||
extern const char* kPackageVendorAttribute;
|
||||
extern const char* kPackageVersionAttribute;
|
||||
|
||||
// attributes kept local to packages
|
||||
extern const char* kCopyrightAttribute;
|
||||
extern const char* kLicenseAttribute;
|
||||
extern const char* kProvidesAttribute;
|
||||
extern const char* kRequiresAttribute;
|
||||
extern const char* kPackageCopyrightAttribute;
|
||||
extern const char* kPackageLicenseAttribute;
|
||||
extern const char* kPackageProvidesAttribute;
|
||||
extern const char* kPackageRequiresAttribute;
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__ATTRIBUTES_H_
|
||||
#endif // _PACKAGE__ATTRIBUTES_H_
|
||||
|
||||
@@ -2,24 +2,25 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__CONTEXT_H_
|
||||
#define _HAIKU__PACKAGE__CONTEXT_H_
|
||||
#ifndef _PACKAGE__CONTEXT_H_
|
||||
#define _PACKAGE__CONTEXT_H_
|
||||
|
||||
|
||||
#include <package/TempfileManager.h>
|
||||
#include <Entry.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class JobStateListener;
|
||||
using Private::TempfileManager;
|
||||
class BJobStateListener;
|
||||
namespace BPrivate {
|
||||
class TempfileManager;
|
||||
}
|
||||
|
||||
|
||||
struct DecisionProvider {
|
||||
virtual ~DecisionProvider();
|
||||
struct BDecisionProvider {
|
||||
virtual ~BDecisionProvider();
|
||||
|
||||
virtual bool YesNoDecisionNeeded(const BString& description,
|
||||
const BString& question,
|
||||
@@ -33,28 +34,32 @@ struct DecisionProvider {
|
||||
};
|
||||
|
||||
|
||||
class Context {
|
||||
class BContext {
|
||||
public:
|
||||
Context(DecisionProvider& decisionProvider);
|
||||
~Context();
|
||||
BContext(BDecisionProvider& decisionProvider,
|
||||
BJobStateListener& jobStateListener);
|
||||
~BContext();
|
||||
|
||||
TempfileManager& GetTempfileManager() const;
|
||||
status_t InitCheck() const;
|
||||
|
||||
JobStateListener* GetJobStateListener() const;
|
||||
void SetJobStateListener(JobStateListener* listener);
|
||||
status_t GetNewTempfile(const BString& baseName,
|
||||
BEntry* entry) const;
|
||||
|
||||
DecisionProvider& GetDecisionProvider() const;
|
||||
BDecisionProvider& DecisionProvider() const;
|
||||
BJobStateListener& JobStateListener() const;
|
||||
|
||||
private:
|
||||
mutable TempfileManager fTempfileManager;
|
||||
DecisionProvider& fDecisionProvider;
|
||||
JobStateListener* fJobStateListener;
|
||||
status_t _Initialize();
|
||||
|
||||
BDecisionProvider& fDecisionProvider;
|
||||
BJobStateListener& fJobStateListener;
|
||||
status_t fInitStatus;
|
||||
|
||||
mutable BPrivate::TempfileManager* fTempfileManager;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__CONTEXT_H_
|
||||
#endif // _PACKAGE__CONTEXT_H_
|
||||
|
||||
+44
-32
@@ -2,35 +2,33 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__JOB_H_
|
||||
#define _HAIKU__PACKAGE__JOB_H_
|
||||
#ifndef _PACKAGE__JOB_H_
|
||||
#define _PACKAGE__JOB_H_
|
||||
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class Context;
|
||||
class Job;
|
||||
class BContext;
|
||||
class BJob;
|
||||
|
||||
|
||||
struct JobStateListener {
|
||||
virtual ~JobStateListener();
|
||||
struct BJobStateListener {
|
||||
virtual ~BJobStateListener();
|
||||
|
||||
// these default implementations do nothing
|
||||
virtual void JobStarted(Job* job);
|
||||
virtual void JobSucceeded(Job* job);
|
||||
virtual void JobFailed(Job* job);
|
||||
virtual void JobAborted(Job* job);
|
||||
virtual void JobStarted(BJob* job);
|
||||
virtual void JobSucceeded(BJob* job);
|
||||
virtual void JobFailed(BJob* job);
|
||||
virtual void JobAborted(BJob* job);
|
||||
};
|
||||
|
||||
|
||||
enum JobState {
|
||||
enum BJobState {
|
||||
JOB_STATE_WAITING_TO_RUN,
|
||||
JOB_STATE_RUNNING,
|
||||
JOB_STATE_SUCCEEDED,
|
||||
@@ -39,30 +37,38 @@ enum JobState {
|
||||
};
|
||||
|
||||
|
||||
class Job {
|
||||
namespace BPrivate {
|
||||
class JobQueue;
|
||||
}
|
||||
|
||||
|
||||
class BJob {
|
||||
public:
|
||||
Job(const Context& context,
|
||||
BJob(const BContext& context,
|
||||
const BString& title);
|
||||
virtual ~Job();
|
||||
virtual ~BJob();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
virtual status_t Run();
|
||||
|
||||
const BString& Title() const;
|
||||
JobState State() const;
|
||||
BJobState State() const;
|
||||
status_t Result() const;
|
||||
const BString& ErrorString() const;
|
||||
|
||||
status_t AddStateListener(JobStateListener* listener);
|
||||
status_t RemoveStateListener(
|
||||
JobStateListener* listener);
|
||||
uint32 TicketNumber() const;
|
||||
|
||||
status_t AddDependency(Job* job);
|
||||
status_t RemoveDependency(Job* job);
|
||||
status_t AddStateListener(BJobStateListener* listener);
|
||||
status_t RemoveStateListener(
|
||||
BJobStateListener* listener);
|
||||
|
||||
bool IsRunnable() const;
|
||||
status_t AddDependency(BJob* job);
|
||||
status_t RemoveDependency(BJob* job);
|
||||
int32 CountDependencies() const;
|
||||
|
||||
Job* DependantJobAt(int32 index) const;
|
||||
BJob* DependantJobAt(int32 index) const;
|
||||
protected:
|
||||
virtual status_t Execute() = 0;
|
||||
virtual void Cleanup(status_t jobResult);
|
||||
@@ -71,27 +77,33 @@ protected:
|
||||
|
||||
void NotifyStateListeners();
|
||||
|
||||
const Context& fContext;
|
||||
const BContext& fContext;
|
||||
|
||||
private:
|
||||
friend class BPrivate::JobQueue;
|
||||
void _SetTicketNumber(uint32 ticketNumber);
|
||||
void _ClearTicketNumber();
|
||||
|
||||
private:
|
||||
status_t fInitStatus;
|
||||
BString fTitle;
|
||||
|
||||
JobState fState;
|
||||
BJobState fState;
|
||||
status_t fResult;
|
||||
BString fErrorString;
|
||||
|
||||
typedef BObjectList<Job> JobList;
|
||||
uint32 fTicketNumber;
|
||||
|
||||
typedef BObjectList<BJob> JobList;
|
||||
JobList fDependencies;
|
||||
JobList fDependantJobs;
|
||||
|
||||
typedef BObjectList<JobStateListener> StateListenerList;
|
||||
typedef BObjectList<BJobStateListener> StateListenerList;
|
||||
StateListenerList fStateListeners;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__JOB_H_
|
||||
#endif // _PACKAGE__JOB_H_
|
||||
|
||||
@@ -2,26 +2,23 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__ROSTER_H_
|
||||
#define _HAIKU__PACKAGE__ROSTER_H_
|
||||
#ifndef _PACKAGE__ROSTER_H_
|
||||
#define _PACKAGE__ROSTER_H_
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Path.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
template <class T> class BObjectList;
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
struct RepositoryConfigVisitor {
|
||||
virtual ~RepositoryConfigVisitor()
|
||||
struct BRepositoryConfigVisitor {
|
||||
virtual ~BRepositoryConfigVisitor()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,14 +26,14 @@ struct RepositoryConfigVisitor {
|
||||
};
|
||||
|
||||
|
||||
class RepositoryCache;
|
||||
class RepositoryConfig;
|
||||
class BRepositoryCache;
|
||||
class BRepositoryConfig;
|
||||
|
||||
|
||||
class Roster {
|
||||
class BPackageRoster {
|
||||
public:
|
||||
Roster();
|
||||
~Roster();
|
||||
BPackageRoster();
|
||||
~BPackageRoster();
|
||||
|
||||
status_t GetCommonRepositoryCachePath(BPath* path,
|
||||
bool create = false) const;
|
||||
@@ -51,26 +48,24 @@ public:
|
||||
status_t GetRepositoryNames(BObjectList<BString>& names);
|
||||
|
||||
status_t VisitCommonRepositoryConfigs(
|
||||
RepositoryConfigVisitor& visitor);
|
||||
BRepositoryConfigVisitor& visitor);
|
||||
status_t VisitUserRepositoryConfigs(
|
||||
RepositoryConfigVisitor& visitor);
|
||||
BRepositoryConfigVisitor& visitor);
|
||||
|
||||
status_t GetRepositoryCache(const BString& name,
|
||||
RepositoryCache* repositoryCache);
|
||||
BRepositoryCache* repositoryCache);
|
||||
status_t GetRepositoryConfig(const BString& name,
|
||||
RepositoryConfig* repositoryConfig);
|
||||
BRepositoryConfig* repositoryConfig);
|
||||
private:
|
||||
status_t _GetRepositoryPath(BPath* path, bool create,
|
||||
directory_which whichDir) const;
|
||||
status_t _VisitRepositoryConfigs(const BPath& path,
|
||||
RepositoryConfigVisitor& visitor);
|
||||
BRepositoryConfigVisitor& visitor);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__ROSTER_H_
|
||||
#endif // _PACKAGE__ROSTER_H_
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
#define _HAIKU__PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
#ifndef _PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
#define _PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
@@ -14,43 +14,41 @@
|
||||
#include <package/Request.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
class ValidateChecksumJob;
|
||||
}
|
||||
using Private::ValidateChecksumJob;
|
||||
using BPrivate::ValidateChecksumJob;
|
||||
|
||||
class RefreshRepositoryRequest : public Request {
|
||||
typedef Request inherited;
|
||||
|
||||
class BRefreshRepositoryRequest : public BRequest {
|
||||
typedef BRequest inherited;
|
||||
|
||||
public:
|
||||
RefreshRepositoryRequest(const Context& context,
|
||||
const RepositoryConfig& repoConfig);
|
||||
virtual ~RefreshRepositoryRequest();
|
||||
BRefreshRepositoryRequest(
|
||||
const BContext& context,
|
||||
const BRepositoryConfig& repoConfig);
|
||||
virtual ~BRefreshRepositoryRequest();
|
||||
|
||||
virtual status_t CreateInitialJobs();
|
||||
|
||||
protected:
|
||||
// JobStateListener
|
||||
virtual void JobSucceeded(Job* job);
|
||||
// BJobStateListener
|
||||
virtual void JobSucceeded(BJob* job);
|
||||
|
||||
private:
|
||||
status_t _FetchRepositoryCache();
|
||||
|
||||
BEntry fFetchedChecksumFile;
|
||||
RepositoryConfig fRepoConfig;
|
||||
BRepositoryConfig fRepoConfig;
|
||||
|
||||
ValidateChecksumJob* fValidateChecksumJob;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
#endif // _PACKAGE__REFRESH_REPOSITORY_REQUEST_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__REPOSITORY_CACHE_H_
|
||||
#define _HAIKU__PACKAGE__REPOSITORY_CACHE_H_
|
||||
#ifndef _PACKAGE__REPOSITORY_CACHE_H_
|
||||
#define _PACKAGE__REPOSITORY_CACHE_H_
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
@@ -13,19 +13,17 @@
|
||||
class BEntry;
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
//class RepositoryHeader;
|
||||
|
||||
|
||||
class RepositoryCache {
|
||||
class BRepositoryCache {
|
||||
public:
|
||||
RepositoryCache();
|
||||
RepositoryCache(const BEntry& entry);
|
||||
virtual ~RepositoryCache();
|
||||
BRepositoryCache();
|
||||
BRepositoryCache(const BEntry& entry);
|
||||
virtual ~BRepositoryCache();
|
||||
|
||||
status_t SetTo(const BEntry& entry);
|
||||
status_t InitCheck() const;
|
||||
@@ -45,9 +43,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__REPOSITORY_CACHE_H_
|
||||
#endif // _PACKAGE__REPOSITORY_CACHE_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__REPOSITORY_CONFIG_H_
|
||||
#define _HAIKU__PACKAGE__REPOSITORY_CONFIG_H_
|
||||
#ifndef _PACKAGE__REPOSITORY_CONFIG_H_
|
||||
#define _PACKAGE__REPOSITORY_CONFIG_H_
|
||||
|
||||
|
||||
#include <Archivable.h>
|
||||
@@ -14,22 +14,20 @@
|
||||
class BEntry;
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class RepositoryConfig : public BArchivable {
|
||||
class BRepositoryConfig : public BArchivable {
|
||||
typedef BArchivable inherited;
|
||||
|
||||
public:
|
||||
RepositoryConfig();
|
||||
RepositoryConfig(const BString& name,
|
||||
BRepositoryConfig();
|
||||
BRepositoryConfig(const BString& name,
|
||||
const BString& url,
|
||||
uint8 priority = kDefaultPriority);
|
||||
RepositoryConfig(const BEntry& entry);
|
||||
RepositoryConfig(BMessage* data);
|
||||
virtual ~RepositoryConfig();
|
||||
BRepositoryConfig(const BEntry& entry);
|
||||
BRepositoryConfig(BMessage* data);
|
||||
virtual ~BRepositoryConfig();
|
||||
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
@@ -52,7 +50,7 @@ public:
|
||||
void SetIsUserSpecific(bool isUserSpecific);
|
||||
|
||||
public:
|
||||
static RepositoryConfig* Instantiate(BMessage* data);
|
||||
static BRepositoryConfig* Instantiate(BMessage* data);
|
||||
|
||||
static const uint8 kDefaultPriority;
|
||||
static const char* kNameField;
|
||||
@@ -71,9 +69,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__REPOSITORY_CONFIG_H_
|
||||
#endif // _PACKAGE__REPOSITORY_CONFIG_H_
|
||||
|
||||
@@ -2,46 +2,48 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__REQUEST_H_
|
||||
#define _HAIKU__PACKAGE__REQUEST_H_
|
||||
#ifndef _PACKAGE__REQUEST_H_
|
||||
#define _PACKAGE__REQUEST_H_
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <package/JobQueue.h>
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
|
||||
namespace Package {
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class Context;
|
||||
using Private::JobQueue;
|
||||
class BContext;
|
||||
namespace BPrivate {
|
||||
class JobQueue;
|
||||
}
|
||||
using BPrivate::JobQueue;
|
||||
|
||||
|
||||
class Request : protected JobStateListener {
|
||||
class BRequest : protected BJobStateListener {
|
||||
public:
|
||||
Request(const Context& context);
|
||||
virtual ~Request();
|
||||
BRequest(const BContext& context);
|
||||
virtual ~BRequest();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
virtual status_t CreateInitialJobs() = 0;
|
||||
|
||||
Job* PopRunnableJob();
|
||||
BJob* PopRunnableJob();
|
||||
|
||||
protected:
|
||||
status_t QueueJob(Job* job);
|
||||
status_t QueueJob(BJob* job);
|
||||
|
||||
const Context& fContext;
|
||||
const BContext& fContext;
|
||||
|
||||
private:
|
||||
JobQueue fJobQueue;
|
||||
status_t fInitStatus;
|
||||
JobQueue* fJobQueue;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__REQUEST_H_
|
||||
#endif // _PACKAGE__REQUEST_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
#ifndef _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
#define _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
@@ -13,19 +13,17 @@
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class ActivateRepositoryCacheJob : public Job {
|
||||
typedef Job inherited;
|
||||
class ActivateRepositoryCacheJob : public BJob {
|
||||
typedef BJob inherited;
|
||||
|
||||
public:
|
||||
ActivateRepositoryCacheJob(
|
||||
const Context& context,
|
||||
const BContext& context,
|
||||
const BString& title,
|
||||
const BEntry& fetchedRepoCacheEntry,
|
||||
const BString& repositoryName,
|
||||
@@ -42,11 +40,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
#endif // _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CACHE_JOB_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
#ifndef _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
#define _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
@@ -13,19 +13,17 @@
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class ActivateRepositoryConfigJob : public Job {
|
||||
typedef Job inherited;
|
||||
class ActivateRepositoryConfigJob : public BJob {
|
||||
typedef BJob inherited;
|
||||
|
||||
public:
|
||||
ActivateRepositoryConfigJob(
|
||||
const Context& context,
|
||||
const BContext& context,
|
||||
const BString& title,
|
||||
const BEntry& archivedRepoConfigEntry,
|
||||
const BString& repositoryBaseURL,
|
||||
@@ -48,11 +46,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
#endif // _PACKAGE__PRIVATE__ACTIVATE_REPOSITORY_CONFIG_JOB_H_
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
#ifndef _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
#define _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class ChecksumAccessor {
|
||||
@@ -51,11 +49,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
#endif // _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
#ifndef _PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
#define _PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
@@ -12,18 +12,16 @@
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class FetchFileJob : public Job {
|
||||
typedef Job inherited;
|
||||
class FetchFileJob : public BJob {
|
||||
typedef BJob inherited;
|
||||
|
||||
public:
|
||||
FetchFileJob(const Context& context,
|
||||
FetchFileJob(const BContext& context,
|
||||
const BString& title,
|
||||
const BString& fileURL,
|
||||
const BEntry& targetEntry);
|
||||
@@ -39,11 +37,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
#endif // _PACKAGE__PRIVATE__FETCH_FILE_JOB_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__JOB_QUEUE_H_
|
||||
#define _HAIKU__PACKAGE__JOB_QUEUE_H_
|
||||
#ifndef _PACKAGE__PRIVATE__JOB_QUEUE_H_
|
||||
#define _PACKAGE__PRIVATE__JOB_QUEUE_H_
|
||||
|
||||
|
||||
#include <Locker.h>
|
||||
@@ -12,44 +12,55 @@
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class JobQueue : public JobStateListener {
|
||||
class JobQueue : private BJobStateListener {
|
||||
public:
|
||||
JobQueue();
|
||||
~JobQueue();
|
||||
virtual ~JobQueue();
|
||||
|
||||
status_t AddJob(Job* job);
|
||||
status_t RemoveJob(Job* job);
|
||||
status_t InitCheck() const;
|
||||
|
||||
Job* Pop();
|
||||
status_t AddJob(BJob* job);
|
||||
// takes ownership
|
||||
status_t RemoveJob(BJob* job);
|
||||
// gives up ownership
|
||||
|
||||
// JobStateListener
|
||||
virtual void JobSucceeded(Job* job);
|
||||
virtual void JobFailed(Job* job);
|
||||
BJob* Pop();
|
||||
// caller owns job
|
||||
|
||||
void Close();
|
||||
|
||||
private:
|
||||
// BJobStateListener
|
||||
virtual void JobSucceeded(BJob* job);
|
||||
virtual void JobFailed(BJob* job);
|
||||
|
||||
private:
|
||||
struct JobPriorityLess;
|
||||
class JobPriorityQueue;
|
||||
|
||||
private:
|
||||
void _UpdateDependantJobsOf(Job* job);
|
||||
status_t _Init();
|
||||
|
||||
void _RequeueDependantJobsOf(BJob* job);
|
||||
void _RemoveDependantJobsOf(BJob* job);
|
||||
|
||||
BLocker fLock;
|
||||
uint32 fNextTicketNumber;
|
||||
JobPriorityQueue* fQueuedJobs;
|
||||
sem_id fHaveRunnableJobSem;
|
||||
|
||||
status_t fInitStatus;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__JOB_QUEUE_H_
|
||||
#endif // _PACKAGE__PRIVATE__JOB_QUEUE_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
#ifndef _PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
#define _PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
@@ -12,11 +12,9 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class TempfileManager {
|
||||
@@ -37,11 +35,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
#endif // _PACKAGE__PRIVATE__TEMPFILE_MANAGER_H_
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright 2011, Oliver Tappe <[email protected]>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HAIKU__PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
#define _HAIKU__PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
#ifndef _PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
#define _PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
@@ -14,19 +14,17 @@
|
||||
#include <package/Job.h>
|
||||
|
||||
|
||||
namespace Haiku {
|
||||
namespace BPackageKit {
|
||||
|
||||
namespace Package {
|
||||
|
||||
namespace Private {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class ValidateChecksumJob : public Job {
|
||||
typedef Job inherited;
|
||||
class ValidateChecksumJob : public BJob {
|
||||
typedef BJob inherited;
|
||||
|
||||
public:
|
||||
ValidateChecksumJob(
|
||||
const Context& context,
|
||||
const BContext& context,
|
||||
const BString& title,
|
||||
ChecksumAccessor* expectedChecksumAccessor,
|
||||
ChecksumAccessor* realChecksumAccessor,
|
||||
@@ -47,11 +45,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Private
|
||||
} // namespace BPrivate
|
||||
|
||||
} // namespace Package
|
||||
|
||||
} // namespace Haiku
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
#endif // _HAIKU__PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
#endif // _PACKAGE__PRIVATE__VALIDATE_CHECKSUM_JOB_H_
|
||||
|
||||
Reference in New Issue
Block a user