Solving jury duty summons with a CRDT
Quick thought here as I wait in the jury pool.
This is my first time being summoned for jury duty. I’m actually pretty excited to have the chance be a juror for a trial. However, I had a confusing summons process.
I received a summons notice that said I needed to call a special hotline the day before I was supposed to report to jury duty. This hotline would indicate if my jury duty was cancelled. The summons notice stated that if the hotline does not indicate any cancelations, I must report to jury duty no matter what.
However, the night before I was supposed to report I received an email stating my jury duty was canceled. To be sure, I called the hotline again (I had already called earlier in the day but figured it may have changed, given the email). The hotline still stated I had to report to jury duty on my scheduled day.
How does jury duty expect me to resolve the conflict of information from different sources? I’m wondering if my ambiguous jury duty situation could be fixed with a CRDT.
There could be a message that includes a hasBeenCanceled
flag, which can only go from false
to true
.
A: { hasBeenCanceled: false }
B: { hasBeenCanceled: true }
merge(A, A) == { hasBeenCanceled: false }
merge(A, B) == { hasBeenCanceled: true }
merge(B, B) == { hasBeenCanceled: true }
There could be a message that includes a lastStateAt
field and a state
, and the latest update is taken.
A: { lastStateAt: 1, state: 'regular' }
B: { lastStateAt: 2, state: 'canceled' }
merge(A, A) == { lastStateAt: 1, state: 'regular' }
merge(A, B) == { lastStateAt: 2, state: 'canceled' }
merge(B, B) == { lastStateAt: 2, state: 'canceled' }
There could be a prioritization of data source, where the data source is passed along with the state.
A: { source: 'email', state: 'regular' }
B: { source: 'phone', state: 'canceled' }
merge(A, A) == { source: 'email', state: 'regular' }
merge(A, B) == { source: 'phone', state: 'canceled' }
merge(B, B) == { source: 'phone', state: 'canceled' }