TensorFlow Serving C++ API Documentation
prefix_storage_path_source_adapter.h
1 /* Copyright 2019 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_PREFIX_STORAGE_PATH_SOURCE_ADAPTER_H_
17 #define TENSORFLOW_SERVING_CORE_PREFIX_STORAGE_PATH_SOURCE_ADAPTER_H_
18 
19 #include "tensorflow/core/lib/core/status.h"
20 #include "tensorflow/core/platform/macros.h"
21 #include "tensorflow_serving/core/source_adapter.h"
22 #include "tensorflow_serving/core/storage_path.h"
23 
24 namespace tensorflow {
25 namespace serving {
26 
27 // A SourceAdapter that adds a prefix to StoragePath.
28 //
29 // This can be useful for filesystems which wrap other filesystems via namespace
30 // prefixes, adding additional functionality like buffering for example.
32  : public UnarySourceAdapter<StoragePath, StoragePath> {
33  public:
34  explicit PrefixStoragePathSourceAdapter(const std::string& prefix);
36 
37  protected:
38  Status Convert(const StoragePath& source, StoragePath* destination) final;
39 
40  private:
41  const std::string prefix_;
42 
43  TF_DISALLOW_COPY_AND_ASSIGN(PrefixStoragePathSourceAdapter);
44 };
45 
46 } // namespace serving
47 } // namespace tensorflow
48 
49 #endif // TENSORFLOW_SERVING_CORE_PREFIX_STORAGE_PATH_SOURCE_ADAPTER_H_