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

Method SetCurrentWorkspaceLookup

engine/server/session.go:1639–1675  ·  view source on GitHub ↗
(
	ctx context.Context,
	namespace string,
	operation string,
	inputs []any,
	result workspace.LookupResult,
)

Source from the content-addressed store, hash-verified

1637}
1638
1639func (srv *Server) SetCurrentWorkspaceLookup(
1640 ctx context.Context,
1641 namespace string,
1642 operation string,
1643 inputs []any,
1644 result workspace.LookupResult,
1645) error {
1646 client, err := srv.clientFromContext(ctx)
1647 if err != nil {
1648 return err
1649 }
1650
1651 ws, key, lockPath, ok, err := srv.currentWorkspaceLockBinding(client)
1652 if err != nil {
1653 return err
1654 }
1655 if !ok {
1656 return fmt.Errorf("workspace lock is not available")
1657 }
1658
1659 sess := client.daggerSession
1660 sess.lockFileMu.Lock()
1661 defer sess.lockFileMu.Unlock()
1662
1663 state, err := srv.loadWorkspaceLockStateLocked(ctx, client, ws, key, lockPath)
1664 if err != nil {
1665 return err
1666 }
1667 if err := state.lock.SetLookup(namespace, operation, inputs, result); err != nil {
1668 return err
1669 }
1670 if err := state.delta.SetLookup(namespace, operation, inputs, result); err != nil {
1671 return err
1672 }
1673 state.dirty = true
1674 return nil
1675}
1676
1677func (srv *Server) currentWorkspaceLockBinding(client *daggerClient) (*core.Workspace, workspaceLockKey, string, bool, error) {
1678 ws := client.workspace

Callers

nothing calls this directly

Calls 4

clientFromContextMethod · 0.95
SetLookupMethod · 0.45

Tested by

no test coverage detected