(ctx context.Context)
| 1602 | return a.Pin() == b.Pin() |
| 1603 | } |
| 1604 | func (srv *Server) CurrentWorkspaceLock(ctx context.Context) (*workspace.Lock, bool, error) { |
| 1605 | client, err := srv.clientFromContext(ctx) |
| 1606 | if err != nil { |
| 1607 | return nil, false, err |
| 1608 | } |
| 1609 | |
| 1610 | ws, key, lockPath, ok, err := srv.currentWorkspaceLockBinding(client) |
| 1611 | if err != nil || !ok { |
| 1612 | return nil, ok, err |
| 1613 | } |
| 1614 | |
| 1615 | sess := client.daggerSession |
| 1616 | |
| 1617 | sess.lockFileMu.RLock() |
| 1618 | if state, ok := sess.lockFiles[key]; ok && state.loaded { |
| 1619 | cloned, err := state.lock.Clone() |
| 1620 | sess.lockFileMu.RUnlock() |
| 1621 | return cloned, true, err |
| 1622 | } |
| 1623 | sess.lockFileMu.RUnlock() |
| 1624 | |
| 1625 | sess.lockFileMu.Lock() |
| 1626 | defer sess.lockFileMu.Unlock() |
| 1627 | |
| 1628 | state, err := srv.loadWorkspaceLockStateLocked(ctx, client, ws, key, lockPath) |
| 1629 | if err != nil { |
| 1630 | return nil, false, err |
| 1631 | } |
| 1632 | cloned, err := state.lock.Clone() |
| 1633 | if err != nil { |
| 1634 | return nil, false, err |
| 1635 | } |
| 1636 | return cloned, true, nil |
| 1637 | } |
| 1638 | |
| 1639 | func (srv *Server) SetCurrentWorkspaceLookup( |
| 1640 | ctx context.Context, |
nothing calls this directly
no test coverage detected