diff options
author | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-06-19 10:38:45 +0100 |
---|---|---|
committer | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-06-26 16:43:50 +0100 |
commit | d619bd876e4b098b3729d755824d6acee2cb57f6 (patch) | |
tree | 681025f2c3aa8ce9b7e774cc0fef93b7e17c50ec | |
parent | c305958d67169eadcd202bb377ab89b894a2272a (diff) | |
download | buildstream-d619bd876e4b098b3729d755824d6acee2cb57f6.tar.gz |
casserver.py: Add buildstream capabilities service
Part of #915
-rw-r--r-- | src/buildstream/_cas/casserver.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/buildstream/_cas/casserver.py b/src/buildstream/_cas/casserver.py index 203b2f021..774548216 100644 --- a/src/buildstream/_cas/casserver.py +++ b/src/buildstream/_cas/casserver.py @@ -88,6 +88,13 @@ def create_server(repo, *, enable_push, artifact_pb2_grpc.add_ArtifactServiceServicer_to_server( _ArtifactServicer(cas, artifactdir), server) + # Create up reference storage and artifact capabilities + artifact_capabilities = buildstream_pb2.ArtifactCapabilities( + allow_updates=enable_push) + buildstream_pb2_grpc.add_CapabilitiesServicer_to_server( + _BuildStreamCapabilitiesServicer(artifact_capabilities), + server) + return server @@ -501,6 +508,16 @@ class _ArtifactServicer(artifact_pb2_grpc.ArtifactServiceServicer): "Artifact {} specified but not found".format(name)) +class _BuildStreamCapabilitiesServicer(buildstream_pb2_grpc.CapabilitiesServicer): + def __init__(self, artifact_capabilities): + self.artifact_capabilities = artifact_capabilities + + def GetCapabilities(self, request, context): + response = buildstream_pb2.ServerCapabilities() + response.artifact_capabilities.CopyFrom(self.artifact_capabilities) + return response + + def _digest_from_download_resource_name(resource_name): parts = resource_name.split('/') |