TensorFlow Serving C++ API Documentation
manager_test_util.cc
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 #include "tensorflow_serving/core/test_util/manager_test_util.h"
17 
18 #include <utility>
19 
20 namespace tensorflow {
21 namespace serving {
22 namespace test_util {
23 
24 AspiredVersionsManagerTestAccess::AspiredVersionsManagerTestAccess(
25  AspiredVersionsManager* manager)
26  : manager_(manager) {}
27 
28 void AspiredVersionsManagerTestAccess::FlushServables() {
29  manager_->FlushServables();
30 }
31 
32 void AspiredVersionsManagerTestAccess::HandlePendingAspiredVersionsRequests() {
33  manager_->HandlePendingAspiredVersionsRequests();
34 }
35 
36 void AspiredVersionsManagerTestAccess::InvokePolicyAndExecuteAction() {
37  manager_->InvokePolicyAndExecuteAction();
38 }
39 
40 void AspiredVersionsManagerTestAccess::SetNumLoadThreads(
41  const uint32 num_load_threads) {
42  manager_->SetNumLoadThreads(num_load_threads);
43 }
44 
45 uint32 AspiredVersionsManagerTestAccess::num_load_threads() const {
46  return manager_->num_load_threads();
47 }
48 
49 void AspiredVersionsManagerTestAccess::SetCustomSortActions(
50  AspiredVersionsManager::CustomSortActionsFn custom_sort_actions) {
51  manager_->custom_sort_actions_ = std::move(custom_sort_actions);
52 }
53 
54 BasicManagerTestAccess::BasicManagerTestAccess(BasicManager* manager)
55  : manager_(manager) {}
56 
57 void BasicManagerTestAccess::SetNumLoadThreads(const uint32 num_load_threads) {
58  manager_->SetNumLoadThreads(num_load_threads);
59 }
60 
61 uint32 BasicManagerTestAccess::num_load_threads() const {
62  return manager_->num_load_threads();
63 }
64 
65 CachingManagerTestAccess::CachingManagerTestAccess(CachingManager* manager)
66  : manager_(manager) {}
67 
68 int64_t CachingManagerTestAccess::GetLoadMutexMapSize() const {
69  return manager_->GetLoadMutexMapSize();
70 }
71 
72 } // namespace test_util
73 } // namespace serving
74 } // namespace tensorflow