16 #include "tensorflow_serving/core/test_util/fake_loader_source_adapter.h"
21 #include "tensorflow/core/lib/strings/strcat.h"
22 #include "tensorflow/core/platform/types.h"
23 #include "tensorflow_serving/core/loader.h"
24 #include "tensorflow_serving/core/source_adapter.h"
26 namespace tensorflow {
30 FakeLoaderSourceAdapter::FakeLoaderSourceAdapter(
31 const string& suffix, std::function<
void(
const string&)> call_on_destruct)
32 : SimpleLoaderSourceAdapter(
33 [this](const StoragePath& path,
34 std::unique_ptr<string>* servable_ptr) {
35 const string servable = suffix_.length() > 0
36 ? strings::StrCat(path,
"/", suffix_)
38 servable_ptr->reset(
new string(servable));
41 SimpleLoaderSourceAdapter<StoragePath,
42 string>::EstimateNoResources()),
44 call_on_destruct_(call_on_destruct) {}
46 FakeLoaderSourceAdapter::~FakeLoaderSourceAdapter() {
48 if (call_on_destruct_) {
49 call_on_destruct_(suffix_);
57 const FakeLoaderSourceAdapterConfig& config,
58 std::unique_ptr<
SourceAdapter<StoragePath, std::unique_ptr<Loader>>>*
65 FakeLoaderSourceAdapterConfig);