Skip to content

Commit 017ff3d

Browse files
committed
docs(stovepipe): trim queue transition commentary
1 parent a89ee9b commit 017ff3d

5 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎stovepipe/core/queuelog/materializer.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,21 @@ import (
2727
"github.com/uber/submitqueue/stovepipe/extension/storage"
2828
)
2929

30-
// ErrInconsistentHistory identifies missing or conflicting committed occurrences or projections.
30+
// ErrInconsistentHistory identifies missing or conflicting queue history or summaries.
3131
var ErrInconsistentHistory = errors.New("inconsistent queue history")
3232

33-
// Materializer retains committed queue occurrences and advances their derived summary.
33+
// Materializer retains committed state changes and updates their summary.
3434
type Materializer interface {
3535
// PersistLog idempotently retains an occurrence, then projects its state.
3636
PersistLog(context.Context, storage.Storage, entity.QueueLog) error
3737
}
3838

3939
type materializer struct{ scope tally.Scope }
4040

41-
// NewMaterializer creates a queue history materializer with bounded outcome metrics.
4241
func NewMaterializer(scope tally.Scope) Materializer {
4342
return &materializer{scope: scope.SubScope("queue_log_materializer")}
4443
}
4544

46-
// NewQueueStateLog represents the committed enablement occurrence in an internal queue snapshot.
4745
func NewQueueStateLog(queue entity.Queue) entity.QueueLog {
4846
return entity.QueueLog{ID: entity.QueueLogID(queue.EnablementVersion), Queue: queue.Name,
4947
State: queue.Enablement, QueueStateVersion: queue.EnablementVersion,

‎stovepipe/core/queuelog/queue_summary.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/uber/submitqueue/stovepipe/extension/storage"
2323
)
2424

25-
// LoadSummary pins a valid read model and verifies its occurrence without writing or consulting internal state.
25+
// LoadSummary requires the summary to match its retained history entry.
2626
func LoadSummary(ctx context.Context, stores storage.Storage, queue string) (entity.QueueState, error) {
2727
if err := ctx.Err(); err != nil {
2828
return entity.QueueState{}, err
@@ -47,7 +47,7 @@ func LoadSummary(ctx context.Context, stores storage.Storage, queue string) (ent
4747
return summary.Snapshot(), nil
4848
}
4949

50-
// LoadVersion reads a retained occurrence by its queue-scoped enablement sequence.
50+
// LoadVersion returns ErrInconsistentHistory for missing or invalid history.
5151
func LoadVersion(ctx context.Context, logs storage.QueueLogStore, queue string, version int64) (entity.QueueState, error) {
5252
log, err := logs.Get(ctx, entity.QueueLogID(version))
5353
if err != nil {

‎stovepipe/core/queuestate/queuestate.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ type transitionController struct {
5454
now func() time.Time
5555
}
5656

57-
// NewTransitionController constructs the internal writer over an injected read-model materializer.
5857
func NewTransitionController(stores storage.Factory, sc sourcecontrol.Factory, materializer queuelog.Materializer) TransitionController {
5958
return &transitionController{stores: stores, sourceControl: sc, materializer: materializer, now: time.Now}
6059
}
@@ -200,7 +199,7 @@ func (c *transitionController) Apply(ctx context.Context, change PreparedChange)
200199
if err := c.validatePreparedBoundary(ctx, change); err != nil {
201200
return entity.QueueState{}, err
202201
}
203-
// Recopy the latest operational fields; only enablement is pinned by the prepared decision.
202+
// An enablement change must preserve concurrent pipeline updates.
204203
updated := internal
205204
updated.Enablement, updated.EnablementVersion = change.next.State, stateVersion
206205
updated.EffectiveFromCommitURI, updated.EnablementChangedAtMs = change.next.EffectiveFromCommitURI, change.next.ChangedAtMs

‎stovepipe/core/queuestate/queuestate_test.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ func TestStatePartialLogWriteBlocksNextTransition(t *testing.T) {
275275
require.Equal(t, int64(2), f.state.Version)
276276
f.logCreateErr = nil
277277
f.clock = 9000
278-
// A no-op also repairs the occurrence before returning.
279278
noop, err := f.manager.Prepare(context.Background(), "repo/main", entity.QueueEnablementEnabled)
280279
require.NoError(t, err)
281280
_, err = f.manager.Apply(context.Background(), noop)

‎test/integration/stovepipe/extension/storage/mysql/queue_state_transitions_test.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func testQueueStateTransitions(t *testing.T, ctx context.Context, db *sql.DB, ba
6161
disabled, err := manager.Apply(ctx, disable)
6262
require.NoError(t, err)
6363
require.Equal(t, int64(3), disabled.Version)
64-
// A new manager can replay the captured decision without selecting a new boundary.
6564
restarted := queuestate.NewTransitionController(mysqlFactory{backend: backend}, source, queuelog.NewMaterializer(tally.NoopScope))
6665
replay, err := restarted.Apply(ctx, enable)
6766
require.NoError(t, err)

0 commit comments

Comments
 (0)