safekeeper: refactor static remote storage usage to use arc #10179
+307
−266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings! Please add
w=1
to github url when viewing diff (sepcificallywal_backup.rs
)Problem
This PR is aimed at addressing the remaining work of #8200. Namely, removing static usage of remote storage in favour of arc. I did not opt to pass
Arc<RemoteStorage>
directly since it is actuallyOptional<RemoteStorage>
as it is not necessarily always configured. I wanted to avoid having to passArc<Optional<RemoteStorage>>
everywhere with individual consuming functions likely needing to handle unwrapping.Instead I've added a
WalBackup
struct that holdsOptional<RemoteStorage>
and handles initialization/unwrapping RemoteStorage internally. wal_backup functions now take self andArc<WalBackup>
is passed as a dependency through the various consumers that need it.Summary of changes
WalBackup
that holdsOptional<RemoteStorage>
and handles initialization and unwrappingWalBackup
as self (Addw=1
to github url when viewing diff here)WalBackup
in safekeeper rootArc<WalBackup>
inGlobalTimelineMap
and pass and store in each Timeline as loadedWalBackup
through Timeline as needed