( ctx context.Context, namespace string, operation string, inputs []any, result workspace.LookupResult, )
| 1637 | } |
| 1638 | |
| 1639 | func (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 | |
| 1677 | func (srv *Server) currentWorkspaceLockBinding(client *daggerClient) (*core.Workspace, workspaceLockKey, string, bool, error) { |
| 1678 | ws := client.workspace |
nothing calls this directly
no test coverage detected