MCPcopy Index your code
hub / github.com/bytebase/bytebase / getEngineType

Method getEngineType

backend/api/lsp/handler.go:159–178  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

157}
158
159func (h *Handler) getEngineType(ctx context.Context) storepb.Engine {
160 instanceID := h.getInstanceID()
161 if instanceID == "" {
162 return storepb.Engine_ENGINE_UNSPECIFIED
163 }
164
165 instance, err := h.store.GetInstance(ctx, &store.FindInstanceMessage{
166 Workspace: common.GetWorkspaceIDFromContext(ctx),
167 ResourceID: &instanceID,
168 })
169 if err != nil {
170 slog.Error("Failed to get instance", log.BBError(err))
171 return storepb.Engine_ENGINE_UNSPECIFIED
172 }
173 if instance == nil {
174 slog.Error("Instance not found", slog.String("instanceID", instanceID))
175 return storepb.Engine_ENGINE_UNSPECIFIED
176 }
177 return instance.Metadata.GetEngine()
178}
179
180func (h *Handler) checkInitialized(req *jsonrpc2.Request) error {
181 h.mu.Lock()

Callers 2

runDiagnosticsMethod · 0.80

Calls 7

getInstanceIDMethod · 0.95
BBErrorFunction · 0.92
GetInstanceMethod · 0.65
StringMethod · 0.65
ErrorMethod · 0.45
GetEngineMethod · 0.45

Tested by

no test coverage detected