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

Add exclusiveWith for transactions #12

Open
amascare opened this issue Feb 12, 2024 · 1 comment
Open

Add exclusiveWith for transactions #12

amascare opened this issue Feb 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@amascare
Copy link
Collaborator

It would be great to be able to have mutually exclusive transactions like done for the applications. This would allow us to work at a lower level of granularity, which helps to be more precise in some cases.
For example, t_a exclusiveWith t_b.

@amascare amascare added the enhancement New feature or request label Feb 12, 2024
@Gaudeval
Copy link
Collaborator

Gaudeval commented Apr 12, 2024

It can be done.

Understand that exclusiveWith is an interference view operator, so it can only be used during interference rules specification for transactions (respectively applications) in the definition of a PhysicalTableBasedInterferenceSpecification (respectively ApplicativeTableBasedInterferenceSpecification).

We consider the former case, specifying interference for transactions. The process is the following:

  1. Specify interference rules on transactions: We declare a trait that extends PhysicalTableBasedInterferenceSpecification.
  2. Configure the platform to view transactions: We specify the platform to which the specification applies (standard in PML), and configure the platform with a software and a transaction library (not as standard here).
  3. Tag two transactions as exclusive: We tag each transaction as used and retrieve its concrete counterpart. Then we can call the exclusiveWith operator on both concrete transactions.
  4. Repeat 3. as required
/* 1. Specify interference rules on transactions */
trait MyPhysicalTableBasedInterferenceSpecification extends PhysicalTableBasedInterferenceSpecification {
  /* 2. Configure the platform to view transactions. */
  self: SimpleKeystonePlatform with SimpleSoftwareAllocation with SimpleKeystoneTransactionLibrary =>
  /* ... */

  /* 3. Tag two transactions as exclusive */
  for {
    /* Tag each transaction as used, and retrieve its counterpart */
    l <- t12_app1_rd_d1.used.toPhysical 
    r <- t221_app22_rd_d2.used.toPhysical
  } yield {
      l exclusiveWith r /* Tag the selected transactions as exclusive */
  }

@kevin-delmas , I am conscious this is quite an inelegant workaround. I might ping you to discuss how to add an operator on Transaction that does just this.

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

No branches or pull requests

2 participants