Atlas › Test

TestBufferApplyOrder

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

Package
go.temporal.io/server/common/effect
Suite / test hierarchy
TestBufferApplyOrder
Test
TestBufferApplyOrder
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

14 // OnAfterCommit adds the provided effect function to set of such functions to
15 // be invoked when Buffer.Apply is called.
16 > func (b *Buffer) OnAfterCommit(effect func(context.Context)) { buffer.go
17 > b.effects = append(b.effects, effect)
18 > }
19
20 // OnAfterRollback adds the provided effect function to set of such functions to
27 // to this Buffer.
28 // It returns true if any effects were applied.
29 > func (b *Buffer) Apply(ctx context.Context) bool { buffer.go
30 > applied := false
31 > b.cancels = nil
32 > for _, effect := range b.effects {
33 > effect(ctx) buffer.go
34 > applied = true
35 > }
36 > b.effects = nil buffer.go
37 > return applied
38 }
39