Skip to content
Snippets Groups Projects
Commit daa1dbb9 authored by Sami Hiltunen's avatar Sami Hiltunen
Browse files

Take a context into GetStorageName

Transactions currently rely on rewriting the relative path of a
repository to implement snapshot isolation. This has the downside
that the relative paths get a prefix such as '+gitaly/staging/xx/yy/...'.
For large parts of the application this is not a problem the handlers
are generally just accessing a repository at a given path. This is a
leaky abstraction though as the prefix is not part of the relative path
and it is visible to the handlers. This has an impact on code that
operates directly on the relative path in some manner. This could be
for example logging, using the relative path as a key, or operating
directly on file paths.

The rewriting could be implemented transparently if we instead
rewrite the storage directory's root path as seen by the transaction.
Storage directory's path doesn't have a meaning unlike the relative
path which is used to identify a repository.

This commit takes the first step towards that by wiring context into
GetStorageName of Locator. The injected context allows us to later
plug transaction scoped logic into Locator that returns the rewritten
storage root of a transaction when attempting to access a given storage.
This way we can wire the indirection through the entire application
without having to touch each site generating storage paths separately.

The comment is large as we access locator to generate storage paths
in many places, and we have to drill the context down into each of
them. The commit simply wires the context through all call sites into
GetStorageName.
parent 68ace201
Showing
with 42 additions and 40 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment