2020-09-12 00:08:04 +08:00
|
|
|
// Copyright 2020 Google LLC
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-09-15 21:22:47 +08:00
|
|
|
#include "jsonnet_base_sandbox.h"
|
2020-09-12 00:08:04 +08:00
|
|
|
|
2020-09-15 00:24:21 +08:00
|
|
|
class JsonnetTransaction : public sapi::Transaction {
|
|
|
|
public:
|
|
|
|
JsonnetTransaction(std::string in_file, std::string out_file)
|
2020-09-15 18:16:00 +08:00
|
|
|
: sapi::Transaction(
|
2020-09-15 21:22:47 +08:00
|
|
|
std::make_unique<JsonnetBaseSandbox>(in_file, out_file)),
|
2020-09-15 18:16:00 +08:00
|
|
|
in_file_(in_file),
|
|
|
|
out_file_(out_file) {
|
|
|
|
sapi::Transaction::set_retry_count(0); // Try once, no retries
|
|
|
|
sapi::Transaction::SetTimeLimit(0); // Infinite time limit
|
2020-09-15 00:24:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string in_file_;
|
|
|
|
std::string out_file_;
|
|
|
|
|
2020-09-15 18:16:00 +08:00
|
|
|
absl::Status Main() override;
|
2020-09-15 00:24:21 +08:00
|
|
|
};
|