pulumi/pkg/backend/filestate
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
..
backend.go filestate: Make currentProject an atomic.Pointer 2023-03-22 16:33:57 -07:00
backend_test.go filestate: Track a state metadata file (.pulumi/Pulumi.yaml) 2023-03-22 12:25:13 -07:00
bucket.go Revert "Support projects in the file state backend" 2023-02-02 15:26:26 -08:00
bucket_test.go filestate: Plumb context through constructor 2023-03-13 13:24:32 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
lock.go filestate/internal: Use stack reference, not name 2023-03-16 14:44:33 -07:00
meta.go filestate: Track a state metadata file (.pulumi/Pulumi.yaml) 2023-03-22 12:25:13 -07:00
meta_test.go filestate: Track a state metadata file (.pulumi/Pulumi.yaml) 2023-03-22 12:25:13 -07:00
snapshot.go filestate/internal: Use stack reference, not name 2023-03-16 14:44:33 -07:00
stack.go filestate/internal: Use stack reference, not name 2023-03-16 14:44:33 -07:00
state.go filestate: Introduce referenceStore to control layout 2023-03-17 12:05:43 -07:00
store.go filestate: Introduce referenceStore to control layout 2023-03-17 12:05:43 -07:00
store_test.go filestate: Introduce referenceStore to control layout 2023-03-17 12:05:43 -07:00