Files
moloapp/src/google/registry/operation_runner.h
T

26 lines
869 B
C++
Raw Normal View History

#pragma once
// Shared by the registry, gateway and policy services: finish a mutation's
// long-running operation, and the read-before-mutate existence probe.
#include <functional>
#include <string>
#include "google/operation.h"
namespace molo::google::registry {
class OperationRunner {
public:
// Takes the reply of a create/patch/delete call. Returns {"operation":name}
// once done; polls through wait_operation (capped) when not yet done.
static clients::body::Json finish(GoogleClient& client, const ServiceEndpoint& endpoint,
const clients::body::Json& reply,
const Sleeper& sleeper);
// True when `probe` returns, false on HTTP 404, rethrows anything else.
static bool exists(const std::function<clients::body::Json()>& probe);
};
} // namespace molo::google::registry