Skip to content

Commit

Permalink
renamings + unit test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed Mar 20, 2024
1 parent b6915da commit 0fd8ca9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions factory/wsConnectorFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

func createConfig() config.WebSocketConfig {
return config.WebSocketConfig{
Url: "localhost",
URL: "localhost",
MarshallerType: "json",
RetryDuration: 1,
RetryDurationInSec: 1,
WithAcknowledge: false,
BlockingAckOnError: false,
Mode: data.ModeClient,
Expand All @@ -37,7 +37,7 @@ func TestCreateWSConnector(t *testing.T) {
t.Parallel()

cfg := createConfig()
cfg.RetryDuration = 0
cfg.RetryDurationInSec = 0
ws, err := CreateWSConnector(cfg, websocket.NewNilPayloadHandler())
require.NotNil(t, err)
require.Nil(t, ws)
Expand Down
2 changes: 1 addition & 1 deletion process/blocksPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (bp *blocksPool) initRoundsMap() {
bp.roundsMap = roundsMap
}

func (bp *blocksPool) UpdateMetaRound(round uint64) {
func (bp *blocksPool) UpdateMetaState(round uint64) {
bp.mutMap.Lock()
defer bp.mutMap.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion process/dataProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (dp *dataProcessor) handleMetaOutportBlock(outportBlock *outport.OutportBlo
return err
}

dp.blocksPool.UpdateMetaRound(round)
dp.blocksPool.UpdateMetaState(round)

return nil
}
Expand Down
3 changes: 3 additions & 0 deletions process/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ var ErrNilDataAggregator = errors.New("nil data aggregator provided")

// ErrWrongTypeAssertion signals that a type assertion faled
var ErrWrongTypeAssertion = errors.New("type assertion failed")

// ErrNotSupportedDBType signals that a not supported db type has been provided
var ErrNotSupportedDBType = errors.New("not supported db type")
2 changes: 1 addition & 1 deletion process/firehosePublisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/multiversx/mx-chain-ws-connector-template-go/data"
)

var log = logger.GetOrCreate("firehose")
var log = logger.GetOrCreate("process")

const (
firehosePrefix = "FIRE"
Expand Down
2 changes: 1 addition & 1 deletion process/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ type DataAggregator interface {
type BlocksPool interface {
PutBlock(hash []byte, outportBlock *outport.OutportBlock, round uint64) error
GetBlock(hash []byte) (*outport.OutportBlock, error)
UpdateMetaRound(round uint64)
UpdateMetaState(round uint64)
IsInterfaceNil() bool
}
12 changes: 8 additions & 4 deletions testscommon/blocksPoolStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import "github.com/multiversx/mx-chain-core-go/data/outport"

// BlocksPoolStub -
type BlocksPoolStub struct {
PutBlockCalled func(hash []byte, outportBlock *outport.OutportBlock, round uint64) error
GetBlockCalled func(hash []byte) (*outport.OutportBlock, error)
PutBlockCalled func(hash []byte, outportBlock *outport.OutportBlock, round uint64) error
GetBlockCalled func(hash []byte) (*outport.OutportBlock, error)
UpdateMetaStateCalled func(round uint64)
}

// PutBlock -
Expand All @@ -26,8 +27,11 @@ func (b *BlocksPoolStub) GetBlock(hash []byte) (*outport.OutportBlock, error) {
return &outport.OutportBlock{}, nil
}

// UpdateMetaRound -
func (b *BlocksPoolStub) UpdateMetaRound(round uint64) {
// UpdateMetaState -
func (b *BlocksPoolStub) UpdateMetaState(round uint64) {
if b.UpdateMetaStateCalled != nil {
b.UpdateMetaStateCalled(round)
}
}

// IsInterfaceNil -
Expand Down

0 comments on commit 0fd8ca9

Please sign in to comment.