Skip to content

Commit

Permalink
vicky: rename lock..object to lock..name
Browse files Browse the repository at this point in the history
  • Loading branch information
Kek5chen committed Apr 24, 2024
1 parent c2d7ed8 commit 8589f4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions vicky/src/lib/documents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub enum TaskStatus {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum Lock {
WRITE { object: String },
READ { object: String },
WRITE { name: String },
READ { name: String },
}

type FlakeURI = String;
Expand Down
42 changes: 21 additions & 21 deletions vicky/src/lib/vicky/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ trait ConstraintMgmt {
impl ConstraintMgmt for Constraints {
fn get_map_key(lock: &Lock) -> &String {
match lock {
Lock::WRITE { object } => object,
Lock::READ { object } => object,
Lock::WRITE { name: object } => object,
Lock::READ { name: object } => object,
}
}

Expand Down Expand Up @@ -66,10 +66,10 @@ impl LockSum {

pub fn can_add_lock(&self, lock: &Lock) -> bool {
match (&self.lock, lock) {
(Lock::WRITE { object: _ }, Lock::WRITE { object: _ }) => false,
(Lock::WRITE { object: _ }, Lock::READ { object: _ }) => false,
(Lock::READ { object: _ }, Lock::WRITE { object: _ }) => false,
(Lock::READ { object }, Lock::READ { object: object2 }) => object == object2,
(Lock::WRITE { name: _ }, Lock::WRITE { name: _ }) => false,
(Lock::WRITE { name: _ }, Lock::READ { name: _ }) => false,
(Lock::READ { name: _ }, Lock::WRITE { name: _ }) => false,
(Lock::READ { name: object }, Lock::READ { name: object2 }) => object == object2,
}
}

Expand All @@ -80,7 +80,7 @@ impl LockSum {
}

match lock {
Lock::READ { object: _ } => {
Lock::READ { name: _ } => {
self.count += 1;
Ok(())
}
Expand Down Expand Up @@ -192,7 +192,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::READ {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -205,7 +205,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::RUNNING,
locks: vec![Lock::READ {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -226,7 +226,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -239,7 +239,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo2"),
name: String::from("foo2"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -260,7 +260,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -273,7 +273,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -295,7 +295,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -308,7 +308,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::NEW,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -331,7 +331,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -344,7 +344,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::NEW,
locks: vec![Lock::WRITE {
object: String::from("foo2"),
name: String::from("foo2"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -367,7 +367,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::READ {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -380,7 +380,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::NEW,
locks: vec![Lock::READ {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -403,7 +403,7 @@ mod tests {
display_name: String::from("Test 1"),
status: TaskStatus::RUNNING,
locks: vec![Lock::WRITE {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand All @@ -416,7 +416,7 @@ mod tests {
display_name: String::from("Test 2"),
status: TaskStatus::NEW,
locks: vec![Lock::READ {
object: String::from("foo1"),
name: String::from("foo1"),
}],
flake_ref: FlakeRef {
flake: String::from(""),
Expand Down

0 comments on commit 8589f4d

Please sign in to comment.