blob: dd391bf7dd7e09bfdd22c22488ce127d8d5cb62b [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/local_aggregation_1_1/local_aggregate_storage/local_aggregate_storage.h"
#include <memory>
#include "src/local_aggregation_1_1/local_aggregate_storage/delayed_local_aggregate_storage.h"
#include "src/local_aggregation_1_1/local_aggregate_storage/immediate_local_aggregate_storage.h"
#include "src/logging.h"
namespace cobalt::local_aggregation {
std::unique_ptr<LocalAggregateStorage> LocalAggregateStorage::New(
StorageStrategy strategy, std::string base_directory, util::FileSystem *fs,
const logger::ProjectContextFactory *global_project_context_factory) {
switch (strategy) {
case StorageStrategy::Immediate:
return std::make_unique<ImmediateLocalAggregateStorage>(std::move(base_directory), fs,
global_project_context_factory);
case StorageStrategy::Delayed:
return std::make_unique<DelayedLocalAggregateStorage>(std::move(base_directory), fs,
global_project_context_factory);
}
}
} // namespace cobalt::local_aggregation