| 40 | } |
| 41 | |
| 42 | func NewRuntimeClient(c *RuntimeConfigOptions, s *DispatcherV2Options, rtMap RuntimeDispatcher) (rc *RuntimeClient, err error) { |
| 43 | dispatchServer := NewDispatchServerV2(s, rtMap) |
| 44 | dispatchServer.ListenAndServe() |
| 45 | lt := UserLogType(s.UserLogType) |
| 46 | if !lt.Valid() { |
| 47 | err = fmt.Errorf("log type [%s] is invalid, should be plain or json", lt) |
| 48 | return nil, err |
| 49 | } |
| 50 | return &RuntimeClient{ |
| 51 | dispatchServer: dispatchServer, |
| 52 | config: c, |
| 53 | userlogType: lt, |
| 54 | }, nil |
| 55 | } |
| 56 | |
| 57 | func (s *RuntimeClient) createRequest(input *InvocationInput) *RequestInfo { |
| 58 | logs.V(5).Info("recv request.", zap.String("runtimeID", input.Runtime.RuntimeID)) |