Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fabric option for a global (channel-wide) batch pin listener #244

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/init_fabric.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ func init() {
initFabricCmd.Flags().StringArrayVar(&initOptions.MSPPaths, "msp", nil, "Path to the MSP directory for an org in your Fabric network")
initFabricCmd.Flags().StringVar(&initOptions.ChannelName, "channel", "", "The name of the Fabric channel on which the FireFly chaincode has been deployed")
initFabricCmd.Flags().StringVar(&initOptions.ChaincodeName, "chaincode", "", "The name given to the FireFly chaincode when it was deployed")
initFabricCmd.Flags().BoolVar(&initOptions.CustomPinSupport, "custom-pin-support", false, "Configure the blockchain listener to listen for BatchPin events from any chaincode on the channel")
initCmd.AddCommand(initFabricCmd)
}
7 changes: 7 additions & 0 deletions internal/stacks/stack_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (s *StackManager) InitStack(options *types.InitOptions) (err error) {
IPFSMode: fftypes.FFEnum(options.IPFSMode),
ChannelName: options.ChannelName,
ChaincodeName: options.ChaincodeName,
CustomPinSupport: options.CustomPinSupport,
}

tokenProviders, err := types.FFEnumArray(s.ctx, options.TokenProviders)
Expand Down Expand Up @@ -911,6 +912,11 @@ func (s *StackManager) runFirstTimeSetup(options *types.StartOptions) (messages
} else {
contractLocation = contractDeploymentResult.DeployedContract.Location
}
options := make(map[string]interface{})
if s.Stack.CustomPinSupport {
options["customPinSupport"] = true
}

newConfig.Namespaces.Predefined[0].Multiparty = &types.MultipartyConfig{
Enabled: true,
Org: orgConfig,
Expand All @@ -921,6 +927,7 @@ func (s *StackManager) runFirstTimeSetup(options *types.StartOptions) (messages
{
Location: contractLocation,
FirstEvent: "0",
Options: options,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions pkg/types/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type MultipartyConfig struct {
type ContractConfig struct {
Location interface{} `yaml:"location"`
FirstEvent string `yaml:"firstEvent,omitempty"`
Options interface{} `yaml:"options"`
}

type MultipartyOrgConfig struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type InitOptions struct {
MSPPaths []string
ChannelName string
ChaincodeName string
CustomPinSupport bool
}

const IPFSMode = "ipfs_mode"
Expand Down
1 change: 1 addition & 0 deletions pkg/types/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Stack struct {
RemoteFabricNetwork bool `json:"remoteFabricNetwork,omitempty"`
ChannelName string `json:"channelName,omitempty"`
ChaincodeName string `json:"chaincodeName,omitempty"`
CustomPinSupport bool `json:"customPinSupport,omitempty"`
InitDir string `json:"-"`
RuntimeDir string `json:"-"`
StackDir string `json:"-"`
Expand Down