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