Improve the ActionCache class hierarchy
Context
BuildGrid supports multiple types of ActionCache, similar to the approach of supporting different storage backends for CAS. However, unlike the CAS implementation, the ActionCache types have no common parent class which makes type checking for validation (see !409 (closed) for the storage type checking) more complicated than it needs to be. This also means that code common to all the AC implementations is duplicated, and also makes the way this part of the code actually works confusing, since its so notably inconsistent with the approach taken for our other pluggable components.
Implementing more ActionCache types (see #280) will only make this problem worse if we don't settle on a cleaner abstraction here. We should refactor the ActionCache implementations (https://gitlab.com/BuildGrid/buildgrid/-/tree/master/buildgrid/server/actioncache) to share common code and implement a defined interface in a similar way to the CAS storage backends.
Task Description
-
Decide on an approach -
Refactor the existing ActionCache implementations to share common code and provide a way to do type checking more cleanly than listing every implementation.
Acceptance Criteria
The ActionCache class hierarchy makes more sense and can be type-checked properly.