@@ -750,10 +750,37 @@ func hasPlugin(plugins []string, target string) bool {
750
750
}
751
751
752
752
func GetRuntimeContext () (RuntimeContext , error ) {
753
- if ctx , err := parseContext (); err != nil {
753
+ ctx , err := parseContext ()
754
+ if err != nil {
754
755
return nil , err
755
- } else {
756
- return ctx , nil
756
+ }
757
+ return ctx , nil
758
+ }
759
+
760
+ func CloneRuntimeContext (ctx RuntimeContext ) RuntimeContext {
761
+ return & FunctionContext {
762
+
763
+ Name : ctx .GetName (),
764
+ Version : ctx .GetContext ().Version ,
765
+ Inputs : ctx .GetInputs (),
766
+ Outputs : ctx .GetOutputs (),
767
+
768
+ Runtime : ctx .GetRuntime (),
769
+ Port : ctx .GetPort (),
770
+ State : ctx .GetContext ().State ,
771
+
772
+ PrePlugins : ctx .GetPrePlugins (),
773
+ PostPlugins : ctx .GetPostPlugins (),
774
+ PluginsTracing : ctx .GetContext ().PluginsTracing ,
775
+ HttpPattern : ctx .GetHttpPattern (),
776
+
777
+ Event : & EventRequest {},
778
+ SyncRequest : & SyncRequest {},
779
+ mode : ctx .GetMode (),
780
+ podName : ctx .GetPodName (),
781
+ podNamespace : ctx .GetPodNamespace (),
782
+ options : ctx .GetContext ().options ,
783
+ daprClient : ctx .GetContext ().daprClient ,
757
784
}
758
785
}
759
786
0 commit comments