-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT: Integrate outport data provider factory in runType
- Loading branch information
1 parent
cf40302
commit 428bc9a
Showing
15 changed files
with
158 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
outport/process/factory/sovereignOutportDataProviderFactory.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package factory | ||
|
||
import ( | ||
"github.com/multiversx/mx-chain-go/outport" | ||
"github.com/multiversx/mx-chain-go/outport/process" | ||
"github.com/multiversx/mx-chain-go/outport/process/disabled" | ||
) | ||
|
||
type sovereignOutportDataProviderFactory struct { | ||
} | ||
|
||
// NewSovereignOutportDataProviderFactory creates a new outport data provider factory for sovereign chain | ||
func NewSovereignOutportDataProviderFactory() *sovereignOutportDataProviderFactory { | ||
return &sovereignOutportDataProviderFactory{} | ||
} | ||
|
||
// CreateOutportDataProvider will create a new instance of outport.DataProviderOutport | ||
func (f *sovereignOutportDataProviderFactory) CreateOutportDataProvider(arg ArgOutportDataProviderFactory) (outport.DataProviderOutport, error) { | ||
if !arg.HasDrivers { | ||
return disabled.NewDisabledOutportDataProvider(), nil | ||
} | ||
|
||
argsOutport, err := createArgs(arg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
odp, err := process.NewOutportDataProvider(*argsOutport) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return process.NewSovereignOutportDataProvider(odp) | ||
} | ||
|
||
// IsInterfaceNil returns true if there is no value under the interface | ||
func (f *sovereignOutportDataProviderFactory) IsInterfaceNil() bool { | ||
return f == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package factory | ||
|
||
import ( | ||
"github.com/multiversx/mx-chain-go/outport" | ||
"github.com/multiversx/mx-chain-go/outport/process/factory" | ||
outportStub "github.com/multiversx/mx-chain-go/testscommon/outport" | ||
) | ||
|
||
// OutportDataProviderFactoryMock - | ||
type OutportDataProviderFactoryMock struct { | ||
CreateOutportDataProviderCalled func(arg factory.ArgOutportDataProviderFactory) (outport.DataProviderOutport, error) | ||
} | ||
|
||
// CreateOutportDataProvider - | ||
func (f *OutportDataProviderFactoryMock) CreateOutportDataProvider(arg factory.ArgOutportDataProviderFactory) (outport.DataProviderOutport, error) { | ||
if f.CreateOutportDataProviderCalled != nil { | ||
return f.CreateOutportDataProviderCalled(arg) | ||
} | ||
|
||
return &outportStub.OutportDataProviderStub{}, nil | ||
} | ||
|
||
// IsInterfaceNil - | ||
func (f *OutportDataProviderFactoryMock) IsInterfaceNil() bool { | ||
return f == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters