TensorFlow Serving C++ API Documentation
static_storage_path_source.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_SOURCES_STORAGE_PATH_STATIC_STORAGE_PATH_SOURCE_H_
17 #define TENSORFLOW_SERVING_SOURCES_STORAGE_PATH_STATIC_STORAGE_PATH_SOURCE_H_
18 
19 #include <memory>
20 
21 #include "tensorflow/core/lib/core/status.h"
22 #include "tensorflow/core/platform/macros.h"
23 #include "tensorflow/core/platform/types.h"
24 #include "tensorflow_serving/core/source.h"
25 #include "tensorflow_serving/core/storage_path.h"
26 #include "tensorflow_serving/sources/storage_path/static_storage_path_source.pb.h"
27 
28 namespace tensorflow {
29 namespace serving {
30 
31 // A StoragePathSource that calls the aspired-versions callback exactly once,
32 // with a single hard-coded servable and version path.
33 // Useful for testing and experimental deployments.
34 class StaticStoragePathSource : public Source<StoragePath> {
35  public:
36  static Status Create(const StaticStoragePathSourceConfig& config,
37  std::unique_ptr<StaticStoragePathSource>* result);
38  ~StaticStoragePathSource() override = default;
39 
40  void SetAspiredVersionsCallback(AspiredVersionsCallback callback) override;
41 
42  private:
43  StaticStoragePathSource() = default;
44 
45  StaticStoragePathSourceConfig config_;
46 
47  TF_DISALLOW_COPY_AND_ASSIGN(StaticStoragePathSource);
48 };
49 
50 } // namespace serving
51 } // namespace tensorflow
52 
53 #endif // TENSORFLOW_SERVING_SOURCES_STORAGE_PATH_STATIC_STORAGE_PATH_SOURCE_H_
std::function< void(const StringPiece servable_name, std::vector< ServableData< StoragePath > > versions)> AspiredVersionsCallback
Definition: source.h:88