MCPcopy Create free account
hub / github.com/dagger/dagger / moduleImplementationScoped

Method moduleImplementationScoped

core/schema/module.go:3016–3042  ·  view source on GitHub ↗
(
	ctx context.Context,
	parentMod dagql.ObjectResult[*core.Module],
	args struct{},
)

Source from the content-addressed store, hash-verified

3014}
3015
3016func (s *moduleSchema) moduleImplementationScoped(
3017 ctx context.Context,
3018 parentMod dagql.ObjectResult[*core.Module],
3019 args struct{},
3020) (inst dagql.ObjectResult[*core.Module], err error) {
3021 if !parentMod.Self().Source.Valid {
3022 return inst, fmt.Errorf("failed to get source implementation digest for module: no module source available")
3023 }
3024 sourceDigest, err := parentMod.Self().Source.Value.Self().SourceImplementationDigest(ctx)
3025 if err != nil {
3026 return inst, fmt.Errorf("failed to get source implementation digest for module: %w", err)
3027 }
3028 scopedDigestInputs := []string{"Module._implementationScoped", sourceDigest.String()}
3029 if parentMod.Self().AsModuleVariantDigest != "" {
3030 scopedDigestInputs = append(scopedDigestInputs, parentMod.Self().AsModuleVariantDigest)
3031 }
3032 scopedDigest := hashutil.HashStrings(scopedDigestInputs...)
3033 dag, err := core.CurrentDagqlServer(ctx)
3034 if err != nil {
3035 return inst, fmt.Errorf("failed to get dag server: %w", err)
3036 }
3037 inst, err = dagql.NewObjectResultForCurrentCall(ctx, dag, parentMod.Self().Clone())
3038 if err != nil {
3039 return inst, err
3040 }
3041 return inst.WithContentDigest(ctx, scopedDigest)
3042}

Callers

nothing calls this directly

Calls 8

HashStringsFunction · 0.92
CurrentDagqlServerFunction · 0.92
SelfMethod · 0.80
StringMethod · 0.65
CloneMethod · 0.65
WithContentDigestMethod · 0.45

Tested by

no test coverage detected