Implementation:Tensorflow Serving Static Storage Path Source
| Knowledge Sources | |
|---|---|
| Domains | Model Serving, Source Management |
| Last Updated | 2026-02-13 00:00 GMT |
Overview
A simple StoragePathSource that fires the aspired-versions callback exactly once with a single hard-coded servable version path, useful for testing and experimental deployments.
Description
StaticStoragePathSource implements the Source<StoragePath> interface to provide a minimal, non-polling source that serves a single, static model version. Unlike FileSystemStoragePathSource which continuously monitors a directory for new versions, StaticStoragePathSource calls the aspired-versions callback exactly once with a fixed servable name and version path specified in its configuration.
The class is configured via StaticStoragePathSourceConfig protobuf, which specifies the servable name, version number, and filesystem path. The Create static factory method initializes the source from the configuration. When SetAspiredVersionsCallback is called (by the serving manager), it triggers the callback with the configured single version.
Key characteristics:
- No filesystem polling or monitoring
- Single version only; no automatic version updates
- Lightweight and deterministic behavior
- Copy construction disabled via TF_DISALLOW_COPY_AND_ASSIGN
Usage
Use this source for testing scenarios where a fixed model version is needed without filesystem monitoring overhead. It is also suitable for experimental or embedded deployments where models are loaded once and never updated. For production deployments with version management, use FileSystemStoragePathSource instead.
Code Reference
Source Location
- Repository: Tensorflow_Serving
- File:
tensorflow_serving/sources/storage_path/static_storage_path_source.h(lines 1-53)
Signature
class StaticStoragePathSource : public Source<StoragePath> {
public:
static Status Create(const StaticStoragePathSourceConfig& config,
std::unique_ptr<StaticStoragePathSource>* result);
~StaticStoragePathSource() override = default;
void SetAspiredVersionsCallback(AspiredVersionsCallback callback) override;
};
Import
#include "tensorflow_serving/sources/storage_path/static_storage_path_source.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | StaticStoragePathSourceConfig |
Yes | Configuration with servable name, version, and filesystem path |
Outputs
| Name | Type | Description |
|---|---|---|
| result | std::unique_ptr<StaticStoragePathSource>* |
Created source instance |
| (callback) | AspiredVersionsCallback |
Called once with a single aspired version when SetAspiredVersionsCallback is invoked |
Usage Examples
Creating a Static Source
StaticStoragePathSourceConfig config;
config.set_servable_name("my_model");
config.set_version_num(1);
config.set_version_path("/models/my_model/1");
std::unique_ptr<StaticStoragePathSource> source;
TF_RETURN_IF_ERROR(StaticStoragePathSource::Create(config, &source));
// Connect to a target (e.g., SourceAdapter -> Manager)