git/objectpool: Verify object pool existence when instantiating object
We have recently refactored the git/objectpool
package so that we
really only have three different constructors of object pool objects:
- `Create()` to create an object pool.
- `FromProto()` and `FromRepository()` to create the object for an
already-existing object pool.
To further tighten guarantees around object pools, we're about to change
Create()
to only ever return success in case the target directory does
not exist yet. And in accordance to that it also makes sense to tighten
checks for the other two constructors to only return success in case the
object pool really existed in the first place.
Refactor the code to check the validity of object pools in FromProto()
and FromRepository()
. While it would be nice to start returning errors
in all cases where an object pool really ought to exist, for now we just
ignore any such errors in the DeleteObjectPool()
RPC. This is done to
retain current semantics, where deleting a non-existent object pool will
not return an error. Ultimately though we should change this case to
return an error, as well.