func TryCrossLanguage(
	s Scope,
	urn string,
	payload []byte,
	expansionAddr string,
	namedInputs map[string]PCollection,
	namedOutputTypes map[string]FullType,
) (map[string]PCollection, error) {
	if !s.IsValid() {
		panic(errors.New("invalid scope"))
	}

	inputsMap, inboundLinks := graph.NamedInboundLinks(mapPCollectionToNode(namedInputs))
	outputsMap, outboundLinks := graph.NamedOutboundLinks(s.real, namedOutputTypes)

	// Set the coder for outbound links for downstream validation.
	for n, i := range outputsMap {
		c := NewCoder(namedOutputTypes[n])
		outboundLinks[i].To.Coder = c.coder
	}

	ext := graph.ExternalTransform{
		Urn:           urn,
		Payload:       payload,
		ExpansionAddr: expansionAddr,
	}.WithNamedInputs(inputsMap).WithNamedOutputs(outputsMap)

	// Adding an edge in the graph corresponding to the ExternalTransform
	edge, isBoundedUpdater := graph.NewCrossLanguage(s.real, s.scope, &ext, inboundLinks, outboundLinks)

	// Once the appropriate input and output nodes are added to the edge, a
	// unique namespace can be requested.
	ext.Namespace = graph.NewNamespace()

	// Expand the transform into ext.Expanded.
	if err := xlangx.Expand(edge, &ext); err != nil {
		return nil, errors.WithContext(err, "expanding external transform")
	}

	// Ensures the expected named outputs are present
	graphx.VerifyNamedOutputs(&ext)
	// Using the expanded outputs, the graph's counterpart outputs are updated with bounded values
	graphx.ResolveOutputIsBounded(edge, isBoundedUpdater)

	return mapNodeToPCollection(graphx.ExternalOutputs(edge)), nil
}
// TryCrossLanguage coordinates the core functions required to execute the cross-language transform.
// See CrossLanguage for user documentation.
TryCrossLanguage coordinates the core functions required to execute the cross-language transform.
See CrossLanguage for user documentation.
// TryCrossLanguage coordinates the core functions required to execute the cross - language transform . // See CrossLanguage for user documentation .
func TryCrossLanguage(
	s Scope,
	urn string,
	payload []byte,
	expansionAddr string,
	namedInputs map[string]PCollection,
	namedOutputTypes map[string]FullType,
) (map[string]PCollection, error) {
	if !s.IsValid() {
		panic(errors.New("invalid scope"))
	}
	inputsMap, inboundLinks := graph.NamedInboundLinks(mapPCollectionToNode(namedInputs))
	outputsMap, outboundLinks := graph.NamedOutboundLinks(s.real, namedOutputTypes)
	for n, i := range outputsMap {
		c := NewCoder(namedOutputTypes[n])
		outboundLinks[i].To.Coder = c.coder
	}
	ext := graph.ExternalTransform{
		Urn:           urn,
		Payload:       payload,
		ExpansionAddr: expansionAddr,
	}.WithNamedInputs(inputsMap).WithNamedOutputs(outputsMap)
	edge, isBoundedUpdater := graph.NewCrossLanguage(s.real, s.scope, &ext, inboundLinks, outboundLinks)
	ext.Namespace = graph.NewNamespace()
	if err := xlangx.Expand(edge, &ext); err != nil {
		return nil, errors.WithContext(err, "expanding external transform")
	}
	graphx.VerifyNamedOutputs(&ext)
	graphx.ResolveOutputIsBounded(edge, isBoundedUpdater)
	return mapNodeToPCollection(graphx.ExternalOutputs(edge)), nil
}
func TryCrossLanguage ( s Scope , urn string , payload [ ] byte , expansionAddr string , namedInputs map [ string ] PCollection , namedOutputTypes map [ string ] FullType , ) ( map [ string ] PCollection , error ) { if ! s . IsValid ( ) { panic ( errors . New ( " " ) ) } inputsMap , inboundLinks := graph . NamedInboundLinks ( mapPCollectionToNode ( namedInputs ) ) outputsMap , outboundLinks := graph . NamedOutboundLinks ( s . real , namedOutputTypes ) for n , i := range outputsMap { c := NewCoder ( namedOutputTypes [ n ] ) outboundLinks [ i ] . To . Coder = c . coder } ext := graph . ExternalTransform { Urn : urn , Payload : payload , ExpansionAddr : expansionAddr , } . WithNamedInputs ( inputsMap ) . WithNamedOutputs ( outputsMap ) edge , isBoundedUpdater := graph . NewCrossLanguage ( s . real , s . scope , & ext , inboundLinks , outboundLinks ) ext . Namespace = graph . NewNamespace ( ) if err := xlangx . Expand ( edge , & ext ) ; err != nil { return nil , errors . WithContext ( err , " " ) } graphx . VerifyNamedOutputs ( & ext ) graphx . ResolveOutputIsBounded ( edge , isBoundedUpdater ) return mapNodeToPCollection ( graphx . ExternalOutputs ( edge ) ) , nil }
TryCrossLanguage coordinates the core functions required to execute the cross-language transform.
TryCrossLanguage coordinates the core functions required to execute the cross - language transform .
// Set the coder for outbound links for downstream validation. // Adding an edge in the graph corresponding to the ExternalTransform // Once the appropriate input and output nodes are added to the edge, a // unique namespace can be requested. // Expand the transform into ext.Expanded. // Ensures the expected named outputs are present // Using the expanded outputs, the graph's counterpart outputs are updated with bounded values