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

Method loadWorkspaceLockStateLocked

engine/server/session.go:1692–1725  ·  view source on GitHub ↗
(
	ctx context.Context,
	client *daggerClient,
	ws *core.Workspace,
	key workspaceLockKey,
	lockPath string,
)

Source from the content-addressed store, hash-verified

1690}
1691
1692func (srv *Server) loadWorkspaceLockStateLocked(
1693 ctx context.Context,
1694 client *daggerClient,
1695 ws *core.Workspace,
1696 key workspaceLockKey,
1697 lockPath string,
1698) (*workspaceLockState, error) {
1699 sess := client.daggerSession
1700 if sess.lockFiles == nil {
1701 sess.lockFiles = make(map[workspaceLockKey]*workspaceLockState)
1702 }
1703 if state, ok := sess.lockFiles[key]; ok && state.loaded {
1704 return state, nil
1705 }
1706
1707 workspaceCtx, bk, err := srv.workspaceOwnerAccess(ctx, sess, ws)
1708 if err != nil {
1709 return nil, err
1710 }
1711 lock, err := readWorkspaceLockState(workspaceCtx, bk, ws)
1712 if err != nil {
1713 return nil, err
1714 }
1715
1716 state := &workspaceLockState{
1717 ws: ws.Clone(),
1718 lockPath: lockPath,
1719 lock: lock,
1720 delta: workspace.NewLock(),
1721 loaded: true,
1722 }
1723 sess.lockFiles[key] = state
1724 return state, nil
1725}
1726
1727func (srv *Server) workspaceOwnerAccess(
1728 ctx context.Context,

Callers 2

CurrentWorkspaceLockMethod · 0.95

Calls 4

workspaceOwnerAccessMethod · 0.95
NewLockFunction · 0.92
readWorkspaceLockStateFunction · 0.70
CloneMethod · 0.65

Tested by

no test coverage detected