Atlas › Test

TestBufferRollbackOrder

Exact test identity: go.temporal.io/server/common/effect/TestBufferRollbackOrder

Package
go.temporal.io/server/common/effect
Suite / test hierarchy
TestBufferRollbackOrder
Test
TestBufferRollbackOrder
Introduced at
buffer.go ×1 Frontier kind: Joint frontier
Covered ranges
4
Covered lines
12
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/effect/buffer.go 12 covered LOC · 4 ranges

Open complete file

20 // OnAfterRollback adds the provided effect function to set of such functions to
21 // be invoked when Buffer.Cancel is called.
22 > func (b *Buffer) OnAfterRollback(effect func(context.Context)) { buffer.go
23 > b.cancels = append(b.cancels, effect)
24 > }
25
26 // Apply invokes the buffered effect functions in the order that they were added
41 // that they were added to this Buffer.
42 // It returns true if any effects were canceled.
43 > func (b *Buffer) Cancel(ctx context.Context) bool { buffer.go
44 > canceled := false
45 > b.effects = nil
46 > for i := len(b.cancels) - 1; i >= 0; i-- {
47 > b.cancels[i](ctx) buffer.go
48 > canceled = true
49 > }
50 > b.cancels = nil buffer.go
51 > return canceled
52 }