Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom task engine #13

Merged
merged 7 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: return None when computer storage fails to be initialized
edfloreshz committed May 8, 2024

Unverified

This user has not yet uploaded their public signing key.
commit e1003fbd5de01b6d6d2ce573e96c4623323d5542
3 changes: 2 additions & 1 deletion src/core/src/service.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,8 @@ impl TaskService {

pub fn get_service(&self) -> Option<Box<dyn TasksProvider>> {
match self.provider {
Provider::Computer => Some(Box::new(ComputerStorage::new(&self.app_id)?)),
Provider::Computer => ComputerStorage::new(&self.app_id)
.map(|storage| Box::new(storage) as Box<dyn TasksProvider>),
}
}

5 changes: 1 addition & 4 deletions src/core/src/services/computer.rs
Original file line number Diff line number Diff line change
@@ -17,10 +17,7 @@ pub struct ComputerStorage {

impl ComputerStorage {
pub(crate) fn new(application_id: &str) -> Option<Self> {
let engine = Self {
engine: ComputerStorageEngine::new(application_id)?,
};
Some(engine)
ComputerStorageEngine::new(application_id).map(|engine| Self { engine })
}
}