TensorFlow Serving C++ API Documentation
tensorflow_serving
core
test_util
fake_storage_path_source_adapter.h
1
/* Copyright 2016 Google Inc. All Rights Reserved.
2
3
Licensed under the Apache License, Version 2.0 (the "License");
4
you may not use this file except in compliance with the License.
5
You may obtain a copy of the License at
6
7
http://www.apache.org/licenses/LICENSE-2.0
8
9
Unless required by applicable law or agreed to in writing, software
10
distributed under the License is distributed on an "AS IS" BASIS,
11
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
See the License for the specific language governing permissions and
13
limitations under the License.
14
==============================================================================*/
15
16
#ifndef TENSORFLOW_SERVING_CORE_TEST_UTIL_FAKE_STORAGE_PATH_SOURCE_ADAPTER_H_
17
#define TENSORFLOW_SERVING_CORE_TEST_UTIL_FAKE_STORAGE_PATH_SOURCE_ADAPTER_H_
18
19
#include "tensorflow/core/lib/core/status.h"
20
#include "tensorflow_serving/core/source_adapter.h"
21
#include "tensorflow_serving/core/storage_path.h"
22
23
namespace
tensorflow {
24
namespace
serving {
25
namespace
test_util {
26
27
// A fake storage-path source-adapter that generates simple string servables
28
// from paths. If the supplied path is set to "invalid", an invalid-argument
29
// error is returned upon conversion.
30
//
31
// If path = "/a/simple/path" and suffix = "foo", the servable string becomes
32
// "/a/simple/path/foo".
33
//
34
// To help with verifying the order of destruction of these adapters in tests,
35
// the adapter may take a callback to be invoked upon destruction. The
36
// suffix provided to the source-adapter is passed to the string argument of the
37
// callback when it is invoked.
38
class
FakeStoragePathSourceAdapter
final
39
:
public
UnarySourceAdapter
<StoragePath, StoragePath> {
40
public
:
41
FakeStoragePathSourceAdapter
(
42
const
string
& suffix =
""
,
43
std::function<
void
(
const
string
&)> call_on_destruct = {});
44
45
~
FakeStoragePathSourceAdapter
();
46
47
private
:
48
Status Convert(
const
StoragePath& data,
49
StoragePath*
const
converted_data)
override
;
50
51
const
string
suffix_;
52
std::function<void(
const
string
&)> call_on_destruct_;
53
};
54
55
}
// namespace test_util
56
}
// namespace serving
57
}
// namespace tensorflow
58
59
#endif
// TENSORFLOW_SERVING_CORE_TEST_UTIL_FAKE_STORAGE_PATH_SOURCE_ADAPTER_H_
tensorflow::serving::UnarySourceAdapter
Definition:
source_adapter.h:120
tensorflow::serving::test_util::FakeStoragePathSourceAdapter
Definition:
fake_storage_path_source_adapter.h:39
Generated by
1.9.1