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

vicky: Task Builder #25

Merged
merged 8 commits into from
Apr 24, 2024
Merged

vicky: Task Builder #25

merged 8 commits into from
Apr 24, 2024

Conversation

Kek5chen
Copy link
Contributor

A task builder for tasks to replace:

Task {
    id: Uuid::new_v4(),
    display_name: String::from("Test 1"),
    status: TaskStatus::NEW,
    locks: vec![Lock::WRITE {
        name: String::from("foo1"),
    }],
    flake_ref: FlakeRef {
        flake: String::from(""),
        args: vec![],
    },
    features: vec![],
},

with:

Task::builder()
    .with_display_name("Test 1")
    .with_write_lock("foo1")
    // has .into() so no .build() is strictly required PROVIDED rust can infer the type, which it sometimes is too stupid to do

@Kek5chen Kek5chen added the enhancement New feature or request label Apr 24, 2024
@Kek5chen Kek5chen added this to the v0.1 milestone Apr 24, 2024
@Kek5chen Kek5chen self-assigned this Apr 24, 2024
@Kek5chen Kek5chen linked an issue Apr 24, 2024 that may be closed by this pull request
@johannwagner
Copy link
Contributor

Would you mind adding the previously written validation to the builder?

@Kek5chen
Copy link
Contributor Author

Kek5chen commented Apr 24, 2024

I don't think that's optimal, since stale tasks, MAY exist while being stale. For example in the database. I wouldn't want a creation of a task to fail because it's stale, after for example a database read. But rejecting is the right case here I think. It's already implemented in #24

@Kek5chen Kek5chen merged commit 0094ea7 into main Apr 24, 2024
4 checks passed
@Kek5chen Kek5chen deleted the feature/task-builder branch April 24, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vicky: Task Builder Pattern
2 participants