PendingBlockKey returns the blocks-pending index key for this job, or empty string if this job type does not claim a block. The key is used by Work to maintain the pendingBlocks index for fast IsBlockBusy lookups (O(1) pending check). Adding a new job type that needs block-pending tracking only requ
()
| 176 | // check). Adding a new job type that needs block-pending tracking only requires |
| 177 | // a new branch here; work.go stays type-agnostic. |
| 178 | func (j *Job) PendingBlockKey() string { |
| 179 | j.mtx.Lock() |
| 180 | defer j.mtx.Unlock() |
| 181 | |
| 182 | switch j.Type { |
| 183 | case tempopb.JobType_JOB_TYPE_REDACTION: |
| 184 | if j.JobDetail.Redaction == nil { |
| 185 | return "" |
| 186 | } |
| 187 | return j.JobDetail.Tenant + "\x00" + j.JobDetail.Redaction.BlockId |
| 188 | default: |
| 189 | return "" |
| 190 | } |
| 191 | } |
no outgoing calls
no test coverage detected