16 #ifndef TENSORFLOW_SERVING_SOURCES_STORAGE_PATH_FILE_SYSTEM_STORAGE_PATH_SOURCE_H_
17 #define TENSORFLOW_SERVING_SOURCES_STORAGE_PATH_FILE_SYSTEM_STORAGE_PATH_SOURCE_H_
23 #include "absl/types/variant.h"
24 #include "tensorflow/core/kernels/batching_util/periodic_function.h"
25 #include "tensorflow/core/lib/core/status.h"
26 #include "tensorflow/core/platform/env.h"
27 #include "tensorflow/core/platform/macros.h"
28 #include "tensorflow/core/platform/types.h"
29 #include "tensorflow_serving/config/file_system_storage_path_source.pb.h"
30 #include "tensorflow_serving/core/source.h"
31 #include "tensorflow_serving/core/storage_path.h"
33 namespace tensorflow {
36 class FileSystemStoragePathSourceTestAccess;
41 namespace tensorflow {
64 static Status Create(
const FileSystemStoragePathSourceConfig& config,
65 std::unique_ptr<FileSystemStoragePathSource>* result);
72 Status
UpdateConfig(
const FileSystemStoragePathSourceConfig& config);
76 FileSystemStoragePathSourceConfig config()
const {
91 Status PollFileSystemAndInvokeCallback();
94 Status UnaspireServables(
const std::set<string>& servable_names)
95 TF_EXCLUSIVE_LOCKS_REQUIRED(mu_);
97 template <
typename... Args>
98 void CallAspiredVersionsCallback(Args&&... args) {
99 if (aspired_versions_callback_) {
100 aspired_versions_callback_(std::forward<Args>(args)...);
101 if (aspired_versions_callback_notifier_) {
102 aspired_versions_callback_notifier_();
108 void SetAspiredVersionsCallbackNotifier(std::function<
void()> fn) {
110 aspired_versions_callback_notifier_ = fn;
115 FileSystemStoragePathSourceConfig config_ TF_GUARDED_BY(mu_);
119 std::function<void()> aspired_versions_callback_notifier_ TF_GUARDED_BY(mu_);
123 absl::variant<absl::monostate, PeriodicFunction, std::unique_ptr<Thread>>;
124 std::unique_ptr<ThreadType> fs_polling_thread_ TF_GUARDED_BY(mu_);
Status UpdateConfig(const FileSystemStoragePathSourceConfig &config)
std::function< void(const StringPiece servable_name, std::vector< ServableData< StoragePath > > versions)> AspiredVersionsCallback