(ctx context.Context, ref string)
| 5452 | } |
| 5453 | |
| 5454 | func (n *daemonNativeTools) memoryWorkspaceIdentity(ctx context.Context, ref string) (string, string, error) { |
| 5455 | trimmed := strings.TrimSpace(ref) |
| 5456 | if trimmed != "" && n.deps.Workspaces != nil { |
| 5457 | resolved, err := n.deps.Workspaces.Resolve(ctx, trimmed) |
| 5458 | switch { |
| 5459 | case err == nil: |
| 5460 | root := firstNonEmpty(resolved.RootDir, trimmed) |
| 5461 | workspaceRoot, resolveErr := core.ResolveMemoryWorkspace(root) |
| 5462 | workspaceID := strings.TrimSpace(resolved.WorkspaceID) |
| 5463 | if workspaceID == "" { |
| 5464 | return "", "", errors.New("daemon: resolved workspace_id is empty") |
| 5465 | } |
| 5466 | return workspaceID, workspaceRoot, resolveErr |
| 5467 | case !errors.Is(err, workspacepkg.ErrWorkspaceNotFound): |
| 5468 | return "", "", err |
| 5469 | } |
| 5470 | if workspacepkg.IsWorkspaceID(trimmed) { |
| 5471 | return "", "", err |
| 5472 | } |
| 5473 | } |
| 5474 | workspaceRoot, err := core.ResolveMemoryWorkspace(trimmed) |
| 5475 | if err != nil { |
| 5476 | return "", "", err |
| 5477 | } |
| 5478 | identity, err := workspacepkg.EnsureIdentity(ctx, workspaceRoot) |
| 5479 | if err != nil { |
| 5480 | return "", "", fmt.Errorf("daemon: resolve memory workspace identity: %w", err) |
| 5481 | } |
| 5482 | return identity.WorkspaceID, workspaceRoot, nil |
| 5483 | } |
| 5484 | |
| 5485 | func memoryHeaderPayloadFromHeader( |
| 5486 | header memcontract.Header, |
no test coverage detected