[cdc_stream] Add a CLI client to start/stop asset streaming sessions (#4)

Implements the cdc_stream client and adjusts asset streaming in
various places to work better outside of a GGP environment.

This CL tries to get quoting for SSH commands right. It also brings
back the ability to start a streaming session from
asset_stream_manager.

Also cleans up Bazel targets setup. Since the sln file is now in root,
it is no longer necessary to prepend ../ to relative filenames to
make clicking on errors work.
This commit is contained in:
Lutz Justen
2022-11-18 10:59:42 +01:00
committed by GitHub
parent ca84d3dd2e
commit 269fb2be45
38 changed files with 797 additions and 356 deletions
@@ -19,6 +19,7 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "asset_stream_manager/session.h"
#include "asset_stream_manager/session_config.h"
#include "metrics/metrics.h"
#include "proto/local_assets_stream_manager.grpc.pb.h"
@@ -66,6 +67,27 @@ class LocalAssetsStreamManagerServiceImpl final
StopSessionResponse* response) override;
private:
// Internal implementation of StartSession(). Returns the unique session
// identifier |instance_id|, the created or retrieved MultiSession |ms| as
// well as the filled metrics event |evt|.
absl::Status LocalAssetsStreamManagerServiceImpl::StartSessionInternal(
const StartSessionRequest* request, std::string* instance_id,
MultiSession** ms, metrics::DeveloperLogEvent* evt);
// Stadia-specific: Returns a SessionTarget from a gamelet name and fills in
// the gamelet's |instance_id|, |project_id| and |organization_id|.
// Used if request.gamelet_name() is set.
// Fails if the gamelet name fails to parse or if ggp ssh init fails.
absl::StatusOr<SessionTarget> GetTargetForStadia(
const StartSessionRequest& request, std::string* instance_id,
std::string* project_id, std::string* organization_id);
// Returns a SessionTarget from the corresponding fields in |request|.
// |instance_id| is set to [user@]host:mount_dir.
// Used if request.gamelet_name() is not set.
SessionTarget GetTarget(const StartSessionRequest& request,
std::string* instance_id);
// Convert StartSessionRequest enum to metrics enum.
metrics::RequestOrigin ConvertOrigin(StartSessionRequestOrigin origin) const;