pulumi/pkg/backend
Abhinav Gupta e4529562cf
filestate: Make currentProject an atomic.Pointer
The currentProject is stored as a plain field on the local backend.
This is fine right now because SetCurrentProject
is not expected to be called concurrently with anything else.

However, in #12437 (project-scoped stacks),
we need to be able to access the current project in a context
where there are no guarantees about SetCurrentProject being called
concurrently with other operations.

This switches the currentProject into an atomic.Pointer
that we can Load and Swap in a thread-safe manner.

Note that this does not protect us from data races caused by
concurrent mutations to the workspace.Project struct's fields,
but that doesn't appear to be a concern;
the code treats that object as a blob of constant values.

Extracted from #12437
2023-03-22 16:33:57 -07:00
..
display all: Fix revive issues 2023-03-21 08:55:11 -07:00
filestate filestate: Make currentProject an atomic.Pointer 2023-03-22 16:33:57 -07:00
httpstate Merge #11974 2023-03-21 19:36:53 +00:00
state [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
apply.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
backend.go CreateStackOptions: interface => struct 2023-03-20 14:32:14 -07:00
backend_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
errors.go Add a link to docs for the 409 Conflict error message (#3207) 2019-09-10 13:25:08 -07:00
mock.go CreateStackOptions: interface => struct 2023-03-20 14:32:14 -07:00
policypack.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
query.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
snapshot.go pkg/backend: Prefer contract.Assertf over Assert 2023-02-21 15:13:16 -08:00
snapshot_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
stack.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
updates.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
watch.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00