| 96 | } |
| 97 | |
| 98 | func (h *Host) callFromPlugin(ctx context.Context, method string, request []byte) ([]byte, error) { |
| 99 | switch method { |
| 100 | case pluginabi.MethodHostModelExecute: |
| 101 | return h.callHostModelExecute(ctx, request) |
| 102 | case pluginabi.MethodHostModelExecuteStream: |
| 103 | return h.callHostModelExecuteStream(ctx, request) |
| 104 | case pluginabi.MethodHostModelStreamRead: |
| 105 | return h.callHostModelStreamRead(ctx, request) |
| 106 | case pluginabi.MethodHostModelStreamClose: |
| 107 | return h.callHostModelStreamClose(request) |
| 108 | case pluginabi.MethodHostHTTPDo: |
| 109 | return h.callHostHTTPDo(ctx, request) |
| 110 | case pluginabi.MethodHostHTTPDoStream: |
| 111 | return h.callHostHTTPDoStream(ctx, request) |
| 112 | case pluginabi.MethodHostHTTPStreamRead: |
| 113 | return h.callHostHTTPStreamRead(ctx, request) |
| 114 | case pluginabi.MethodHostHTTPStreamClose: |
| 115 | return h.callHostHTTPStreamClose(request) |
| 116 | case pluginabi.MethodHostStreamEmit: |
| 117 | return h.callHostStreamEmit(ctx, request) |
| 118 | case pluginabi.MethodHostStreamClose: |
| 119 | return h.callHostStreamClose(request) |
| 120 | case pluginabi.MethodHostLog: |
| 121 | return h.callHostLog(ctx, request) |
| 122 | case pluginabi.MethodHostAuthList: |
| 123 | return h.callHostAuthList(ctx, request) |
| 124 | case pluginabi.MethodHostAuthGet: |
| 125 | return h.callHostAuthGet(ctx, request) |
| 126 | case pluginabi.MethodHostAuthGetRuntime: |
| 127 | return h.callHostAuthGetRuntime(ctx, request) |
| 128 | case pluginabi.MethodHostAuthSave: |
| 129 | return h.callHostAuthSave(ctx, request) |
| 130 | default: |
| 131 | return nil, fmt.Errorf("unsupported host callback %s", method) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | func (h *Host) callbackCallerPluginID(ctx context.Context, callbackID string) string { |
| 136 | if pluginID := hostCallbackPluginIDFromContext(ctx); pluginID != "" { |