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

Method Load

backend/plugin/parser/pg/query_span_loader.go:162–183  ·  view source on GitHub ↗

Load collects every object from metadata, topologically orders them, and installs each either real or (on failure) pseudo. The returned error is non-nil only for catastrophic conditions (nil catalog, ctx cancellation); per-object failures are recorded in degraded/trulyBroken and do not stop the load

(ctx context.Context)

Source from the content-addressed store, hash-verified

160// per-object failures are recorded in degraded/trulyBroken and do not stop
161// the loader.
162func (l *catalogLoader) Load(ctx context.Context) error {
163 if l.cat == nil {
164 return errors.New("catalogLoader: nil catalog")
165 }
166 if l.meta == nil {
167 return nil
168 }
169
170 objects := l.collectObjects()
171 for _, obj := range objects {
172 l.loaderObjects[obj.key()] = true
173 }
174
175 sorted := topoSortObjects(objects)
176 for _, obj := range sorted {
177 if err := ctx.Err(); err != nil {
178 return err
179 }
180 l.installOne(obj)
181 }
182 return nil
183}
184
185// collectObjects flattens DatabaseSchemaMetadata into a list of objectEntry
186// values, one per schema object the loader will install. Schemas themselves

Calls 4

collectObjectsMethod · 0.95
installOneMethod · 0.95
topoSortObjectsFunction · 0.85
keyMethod · 0.45