Skip to content

Commit a28b3ca

Browse files
committed
rename CoreImpl and PipelineImpl
1 parent bb380a8 commit a28b3ca

File tree

6 files changed

+95
-95
lines changed

6 files changed

+95
-95
lines changed

module/executiondatasync/optimistic_sync/pipeline/core.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ type workingData struct {
5858
persisted bool
5959
}
6060

61-
var _ optimistic_sync.Core = (*CoreImpl)(nil)
61+
var _ optimistic_sync.Core = (*Core)(nil)
6262

63-
// CoreImpl implements the Core interface for processing execution data.
63+
// Core implements the Core interface for processing execution data.
6464
// It coordinates the download, indexing, and persisting of execution data.
6565
//
6666
// Safe for concurrent use.
67-
type CoreImpl struct {
67+
type Core struct {
6868
log zerolog.Logger
6969
mu sync.Mutex
7070

@@ -74,11 +74,11 @@ type CoreImpl struct {
7474
block *flow.Block
7575
}
7676

77-
// NewCoreImpl creates a new CoreImpl with all necessary dependencies
77+
// NewCore creates a new Core with all necessary dependencies
7878
// Safe for concurrent use.
7979
//
8080
// No error returns are expected during normal operations
81-
func NewCoreImpl(
81+
func NewCore(
8282
logger zerolog.Logger,
8383
executionResult *flow.ExecutionResult,
8484
block *flow.Block,
@@ -93,7 +93,7 @@ func NewCoreImpl(
9393
latestPersistedSealedResult storage.LatestPersistedSealedResult,
9494
protocolDB storage.DB,
9595
lockManager storage.LockManager,
96-
) (*CoreImpl, error) {
96+
) (*Core, error) {
9797
if block.ID() != executionResult.BlockID {
9898
return nil, fmt.Errorf("header ID and execution result block ID must match")
9999
}
@@ -105,7 +105,7 @@ func NewCoreImpl(
105105
Uint64("height", block.Height).
106106
Logger()
107107

108-
return &CoreImpl{
108+
return &Core{
109109
log: coreLogger,
110110
block: block,
111111
executionResult: executionResult,
@@ -137,7 +137,7 @@ func NewCoreImpl(
137137
//
138138
// Expected error returns during normal operation:
139139
// - [context.Canceled]: if the provided context was canceled before completion
140-
func (c *CoreImpl) Download(ctx context.Context) error {
140+
func (c *Core) Download(ctx context.Context) error {
141141
c.mu.Lock()
142142
defer c.mu.Unlock()
143143
if c.workingData == nil {
@@ -206,7 +206,7 @@ func (c *CoreImpl) Download(ctx context.Context) error {
206206
// Calling Index after Abandon is called will return an error.
207207
//
208208
// No error returns are expected during normal operations
209-
func (c *CoreImpl) Index() error {
209+
func (c *Core) Index() error {
210210
c.mu.Lock()
211211
defer c.mu.Unlock()
212212
if c.workingData == nil {
@@ -260,7 +260,7 @@ func (c *CoreImpl) Index() error {
260260
// Calling Persist after Abandon is called will return an error.
261261
//
262262
// No error returns are expected during normal operations
263-
func (c *CoreImpl) Persist() error {
263+
func (c *Core) Persist() error {
264264
c.mu.Lock()
265265
defer c.mu.Unlock()
266266
if c.workingData == nil {
@@ -317,7 +317,7 @@ func (c *CoreImpl) Persist() error {
317317
// the caller should cancel its context to ensure the operation completes in a timely manner.
318318
//
319319
// The method is idempotent. Calling it multiple times has no effect.
320-
func (c *CoreImpl) Abandon() {
320+
func (c *Core) Abandon() {
321321
c.mu.Lock()
322322
defer c.mu.Unlock()
323323

module/executiondatasync/optimistic_sync/pipeline/core_impl_test.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
"github.com/onflow/flow-go/utils/unittest/fixtures"
2222
)
2323

24-
// CoreImplSuite is a test suite for testing the CoreImpl.
25-
type CoreImplSuite struct {
24+
// CoreSuite is a test suite for testing the Core.
25+
type CoreSuite struct {
2626
suite.Suite
2727
execDataRequester *reqestermock.ExecutionDataRequester
2828
txResultErrMsgsRequester *txerrmsgsmock.Requester
@@ -37,24 +37,24 @@ type CoreImplSuite struct {
3737
latestPersistedSealedResult *storagemock.LatestPersistedSealedResult
3838
}
3939

40-
func TestCoreImplSuiteSuite(t *testing.T) {
40+
func TestCoreSuiteSuite(t *testing.T) {
4141
t.Parallel()
42-
suite.Run(t, new(CoreImplSuite))
42+
suite.Run(t, new(CoreSuite))
4343
}
4444

45-
func (c *CoreImplSuite) SetupTest() {
45+
func (c *CoreSuite) SetupTest() {
4646
t := c.T()
4747

4848
c.execDataRequester = reqestermock.NewExecutionDataRequester(t)
4949
c.txResultErrMsgsRequester = txerrmsgsmock.NewRequester(t)
5050
c.txResultErrMsgsRequestTimeout = 100 * time.Millisecond
5151
}
5252

53-
// createTestCoreImpl creates a CoreImpl instance with mocked dependencies for testing.
53+
// createTestCore creates a Core instance with mocked dependencies for testing.
5454
//
55-
// Returns a configured CoreImpl ready for testing.
56-
func (c *CoreImplSuite) createTestCoreImpl(tf *testFixture) *CoreImpl {
57-
core, err := NewCoreImpl(
55+
// Returns a configured Core ready for testing.
56+
func (c *CoreSuite) createTestCore(tf *testFixture) *Core {
57+
core, err := NewCore(
5858
unittest.Logger(),
5959
tf.exeResult,
6060
tf.block,
@@ -130,12 +130,12 @@ func generateFixture(g *fixtures.GeneratorSuite) *testFixture {
130130
}
131131
}
132132

133-
func (c *CoreImplSuite) TestCoreImpl_Constructor() {
133+
func (c *CoreSuite) TestCore_Constructor() {
134134
block := unittest.BlockFixture()
135135
executionResult := unittest.ExecutionResultFixture(unittest.WithBlock(block))
136136

137137
c.Run("happy path", func() {
138-
core, err := NewCoreImpl(
138+
core, err := NewCore(
139139
unittest.Logger(),
140140
executionResult,
141141
block,
@@ -156,7 +156,7 @@ func (c *CoreImplSuite) TestCoreImpl_Constructor() {
156156
})
157157

158158
c.Run("block ID mismatch", func() {
159-
core, err := NewCoreImpl(
159+
core, err := NewCore(
160160
unittest.Logger(),
161161
executionResult,
162162
unittest.BlockFixture(),
@@ -177,9 +177,9 @@ func (c *CoreImplSuite) TestCoreImpl_Constructor() {
177177
})
178178
}
179179

180-
// TestCoreImpl_Download tests the Download method retrieves execution data and transaction error
180+
// TestCore_Download tests the Download method retrieves execution data and transaction error
181181
// messages.
182-
func (c *CoreImplSuite) TestCoreImpl_Download() {
182+
func (c *CoreSuite) TestCore_Download() {
183183
ctx := context.Background()
184184
g := fixtures.NewGeneratorSuite()
185185

@@ -193,7 +193,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
193193

194194
c.Run("successful download", func() {
195195
tf := generateFixture(g)
196-
core := c.createTestCoreImpl(tf)
196+
core := c.createTestCore(tf)
197197

198198
c.execDataRequester.On("RequestExecutionData", mock.Anything).Return(tf.execData, nil).Once()
199199
c.txResultErrMsgsRequester.On("Request", mock.Anything).Return(tf.txErrMsgs, nil).Once()
@@ -211,7 +211,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
211211

212212
c.Run("execution data request error", func() {
213213
tf := generateFixture(g)
214-
core := c.createTestCoreImpl(tf)
214+
core := c.createTestCore(tf)
215215

216216
expectedErr := fmt.Errorf("test execution data request error")
217217

@@ -231,7 +231,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
231231

232232
c.Run("transaction result error messages request error", func() {
233233
tf := generateFixture(g)
234-
core := c.createTestCoreImpl(tf)
234+
core := c.createTestCore(tf)
235235

236236
expectedErr := fmt.Errorf("test tx error messages request error")
237237

@@ -251,7 +251,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
251251

252252
c.Run("context cancellation", func() {
253253
tf := generateFixture(g)
254-
core := c.createTestCoreImpl(tf)
254+
core := c.createTestCore(tf)
255255

256256
ctx, cancel := context.WithCancel(context.Background())
257257
cancel()
@@ -277,7 +277,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
277277

278278
c.Run("txResultErrMsgsRequestTimeout expiration", func() {
279279
tf := generateFixture(g)
280-
core := c.createTestCoreImpl(tf)
280+
core := c.createTestCore(tf)
281281

282282
c.execDataRequester.On("RequestExecutionData", mock.Anything).Return(tf.execData, nil).Once()
283283

@@ -304,7 +304,7 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
304304

305305
c.Run("Download after Abandon returns an error", func() {
306306
tf := generateFixture(g)
307-
core := c.createTestCoreImpl(tf)
307+
core := c.createTestCore(tf)
308308

309309
core.Abandon()
310310
c.Nil(core.workingData)
@@ -314,8 +314,8 @@ func (c *CoreImplSuite) TestCoreImpl_Download() {
314314
})
315315
}
316316

317-
// TestCoreImpl_Index tests the Index method which processes downloaded data.
318-
func (c *CoreImplSuite) TestCoreImpl_Index() {
317+
// TestCore_Index tests the Index method which processes downloaded data.
318+
func (c *CoreSuite) TestCore_Index() {
319319
ctx := context.Background()
320320
g := fixtures.NewGeneratorSuite()
321321

@@ -324,7 +324,7 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
324324
c.txResultErrMsgsRequester.On("Request", mock.Anything).Return(tf.txErrMsgs, nil)
325325

326326
c.Run("successful indexing", func() {
327-
core := c.createTestCoreImpl(tf)
327+
core := c.createTestCore(tf)
328328

329329
err := core.Download(ctx)
330330
c.Require().NoError(err)
@@ -347,7 +347,7 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
347347
})
348348

349349
c.Run("indexer constructor error", func() {
350-
core := c.createTestCoreImpl(tf)
350+
core := c.createTestCore(tf)
351351
core.block = g.Blocks().Fixture()
352352

353353
err := core.Download(ctx)
@@ -359,7 +359,7 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
359359
})
360360

361361
c.Run("failed to index block", func() {
362-
core := c.createTestCoreImpl(tf)
362+
core := c.createTestCore(tf)
363363

364364
err := core.Download(ctx)
365365
c.Require().NoError(err)
@@ -372,7 +372,7 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
372372
})
373373

374374
c.Run("failed to validate transaction result error messages", func() {
375-
core := c.createTestCoreImpl(tf)
375+
core := c.createTestCore(tf)
376376

377377
err := core.Download(ctx)
378378
c.Require().NoError(err)
@@ -388,7 +388,7 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
388388
})
389389

390390
c.Run("Index after Abandon returns an error", func() {
391-
core := c.createTestCoreImpl(tf)
391+
core := c.createTestCore(tf)
392392

393393
core.Abandon()
394394
c.Nil(core.workingData)
@@ -398,16 +398,16 @@ func (c *CoreImplSuite) TestCoreImpl_Index() {
398398
})
399399

400400
c.Run("Index before Download returns an error", func() {
401-
core := c.createTestCoreImpl(tf)
401+
core := c.createTestCore(tf)
402402

403403
err := core.Index()
404404
c.ErrorContains(err, "downloading is not complete")
405405
c.Nil(core.workingData.indexerData)
406406
})
407407
}
408408

409-
// TestCoreImpl_Persist tests the Persist method which persists indexed data to storages and database.
410-
func (c *CoreImplSuite) TestCoreImpl_Persist() {
409+
// TestCore_Persist tests the Persist method which persists indexed data to storages and database.
410+
func (c *CoreSuite) TestCore_Persist() {
411411
t := c.T()
412412
ctx := context.Background()
413413
g := fixtures.NewGeneratorSuite()
@@ -430,7 +430,7 @@ func (c *CoreImplSuite) TestCoreImpl_Persist() {
430430

431431
c.Run("successful persistence of empty data", func() {
432432
resetMocks()
433-
core := c.createTestCoreImpl(tf)
433+
core := c.createTestCore(tf)
434434

435435
err := core.Download(ctx)
436436
c.Require().NoError(err)
@@ -484,7 +484,7 @@ func (c *CoreImplSuite) TestCoreImpl_Persist() {
484484
expectedErr := fmt.Errorf("test persisting registers failure")
485485

486486
resetMocks()
487-
core := c.createTestCoreImpl(tf)
487+
core := c.createTestCore(tf)
488488

489489
err := core.Download(ctx)
490490
c.Require().NoError(err)
@@ -503,7 +503,7 @@ func (c *CoreImplSuite) TestCoreImpl_Persist() {
503503
expectedErr := fmt.Errorf("test persisting events failure")
504504

505505
resetMocks()
506-
core := c.createTestCoreImpl(tf)
506+
core := c.createTestCore(tf)
507507

508508
err := core.Download(ctx)
509509
c.Require().NoError(err)
@@ -530,7 +530,7 @@ func (c *CoreImplSuite) TestCoreImpl_Persist() {
530530

531531
c.Run("Persist after Abandon returns an error", func() {
532532
resetMocks()
533-
core := c.createTestCoreImpl(tf)
533+
core := c.createTestCore(tf)
534534

535535
core.Abandon()
536536
c.Nil(core.workingData)
@@ -541,7 +541,7 @@ func (c *CoreImplSuite) TestCoreImpl_Persist() {
541541

542542
c.Run("Persist before Index returns an error", func() {
543543
resetMocks()
544-
core := c.createTestCoreImpl(tf)
544+
core := c.createTestCore(tf)
545545
err := core.Persist()
546546
c.ErrorContains(err, "indexing is not complete")
547547
})

0 commit comments

Comments
 (0)