Class CurationLock
- All Implemented Interfaces:
Serializable
One row per currently locked dataset, deleted on release. The primary key is the investigation itself, so a dataset cannot be locked twice.
🛑 Advisory, and it must stay that way. The correctness guarantee
for concurrent curation writes is the optimistic-concurrency token —
PUT /datasets/{id}/curation checks baseline.lastModified and
returns 409 when the dataset moved. This lock exists so that 409 rarely
fires and so a curator can see who else is working. It gates exactly one
thing: sign-off, which is the destructive act. Editing and committing stay
advisory. If the baseline check is ever removed because "the lock handles
it", that is the bug.
🛑 Never write this through a curatable update path, and never emit an
audit event for it. Any audit event sets
curationDetails.lastUpdated
(AbstractCuratableDao.updateCurationDetailsFromAuditEvent), and that
field is the concurrency token above — so taking a lock would 409 every
in-flight draft on the dataset. That is the bug bebe778980 fixed for
snapshots. stolenFrom / stolenAt are the record of a
steal, for the same reason the SNAPSHOT row is its own record of a
capture.
Stealing is always permitted. It loses no work: the displaced
curator's DRAFT is a separate AnnotationSet row and is untouched, so
the cost of a steal is that the displaced curator's next commit 409s on a
stale baseline and they re-sync.
Expiry is not swept. An acquire treats expiresAt in the
past as free and overwrites the row, so an abandoned tab frees itself with
no cleanup job to run, monitor and forget.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRunId()booleanbooleanvoidsetAgentName(String agentName) voidsetExpiresAt(Date expiresAt) voidsetInvestigation(Investigation investigation) voidsetLockedAt(Date lockedAt) voidsetLockedBy(String lockedBy) voidvoidsetStolenAt(Date stolenAt) voidsetStolenFrom(String stolenFrom)
-
Constructor Details
-
CurationLock
public CurationLock()
-
-
Method Details
-
getRunId
-
setRunId
-
getAgentName
-
setAgentName
-
getInvestigationId
- Returns:
- the primary key, which is the locked investigation's id.
-
getInvestigation
-
setInvestigation
-
getLockedBy
-
setLockedBy
-
getLockedAt
-
setLockedAt
-
getExpiresAt
-
setExpiresAt
-
getStolenFrom
-
setStolenFrom
-
getStolenAt
-
setStolenAt
-
isExpired
- Parameters:
now- the reference instant, passed in rather than read from the clock so callers can evaluate a batch of locks against one consistent moment- Returns:
- whether the claim has lapsed. An expired lock is treated as free by an acquire; nothing sweeps it.
-
isHeldBy
-