Пример #1
0
Try<Owned<VolumeManager>> VolumeManager::create(
    const http::URL& agentUrl,
    const string& rootDir,
    const CSIPluginInfo& info,
    const hashset<Service>& services,
    const string& containerPrefix,
    const Option<string>& authToken,
    Metrics* metrics)
{
  if (services.empty()) {
    return Error(
        "Must specify at least one service for CSI plugin type '" +
        info.type() + "' and name '" + info.name() + "'");
  }

  return new v0::VolumeManager(
      agentUrl,
      rootDir,
      info,
      services,
      containerPrefix,
      authToken,
      Runtime(),
      metrics);
}
Пример #2
0
bool QUBOHeuristic::Report() {
  double rt = Runtime();
  if (qc_) {
    return qc_->Report(past_solutions_[past_solutions_.size()-1], false, rt);
  } else {
    return rt < runtime_limit_;
  }
}
Пример #3
0
bool QUBOHeuristic::Report(const BaseSolution& solution) {
  double rt = Runtime();
  bool newBest = NewBest(solution, rt);
  if (qc_) {
    return qc_->Report(past_solutions_[past_solutions_.size()-1], newBest, rt);
  } else {
    return rt < runtime_limit_;
  }
}
Пример #4
0
bool MaxCutHeuristic::Report(int iter) {
  double rt = Runtime();
  if (mc_) {
    return mc_->Report(past_solutions_[past_solutions_.size()-1], false, rt,
                       iter);
  } else {
    return rt < runtime_limit_;
  }
}
Пример #5
0
QUBOHeuristic::QUBOHeuristic(const QUBOInstance& qi, double runtime_limit,
			     bool validation, QUBOCallback *qc) :
  Heuristic(runtime_limit, validation),
  qi_(qi),
  qc_(qc) {
  // Store a new best solution with objective 0
  past_solutions_.push_back(QUBOSimpleSolution(qi, this, 0));
  past_solution_values_.push_back(0.0);
  past_solution_times_.push_back(Runtime());
}
Пример #6
0
bool MaxCutHeuristic::Report(const BaseSolution& solution, int iter) {
  double rt = Runtime();
  bool newBest = NewBest(solution, rt);
  if (mc_) {
    return mc_->Report(past_solutions_[past_solutions_.size()-1], newBest, rt,
                       iter);
  } else {
    return rt < runtime_limit_;
  }
}
Пример #7
0
MaxCutHeuristic::MaxCutHeuristic(const MaxCutInstance& mi,
				 double runtime_limit, bool validation,
                                 MaxCutCallback *mc) :
  Heuristic(runtime_limit, validation),
  mi_(mi),
  mc_(mc) {
  // Store a new best solution with objective 0
  past_solutions_.push_back(MaxCutSimpleSolution(mi, this, -1));
  past_solution_values_.push_back(0.0);
  past_solution_times_.push_back(Runtime());
}
Пример #8
0
already_AddRefed<DominatorTree>
HeapSnapshot::ComputeDominatorTree(ErrorResult& rv)
{
  Maybe<JS::ubi::DominatorTree> maybeTree;
  {
    auto ccrt = CycleCollectedJSRuntime::Get();
    MOZ_ASSERT(ccrt);
    auto rt = ccrt->Runtime();
    MOZ_ASSERT(rt);
    JS::AutoCheckCannotGC nogc(rt);
    maybeTree = JS::ubi::DominatorTree::Create(rt, nogc, getRoot());
  }

  if (maybeTree.isNothing()) {
    rv.Throw(NS_ERROR_OUT_OF_MEMORY);
    return nullptr;
  }

  return MakeAndAddRef<DominatorTree>(Move(*maybeTree), this, mParent);
}