Implementation:Tensorflow Serving storage path h
| Knowledge Sources | |
|---|---|
| Domains | Model Serving, Core Framework |
| Last Updated | 2026-02-13 00:00 GMT |
Overview
StoragePath is a type alias for string representing file system paths, along with an equality operator for ServableData<StoragePath>.
Description
The StoragePath type is a simple alias for string that represents paths in some storage system (typically a file system). This type alias provides semantic clarity throughout the codebase, making it explicit when a string represents a storage path rather than arbitrary text.
The header also provides an equality operator for ServableData<StoragePath> that compares two instances by checking their ServableId, their status (ok vs. error), and, if both are OK, their data content. If both have error statuses, the error statuses themselves are compared.
This is one of the most commonly used data types in the Source-to-Manager pipeline, as many servable Sources monitor file system paths and emit ServableData<StoragePath> to downstream SourceAdapters that load models from those paths.
Usage
Use StoragePath whenever working with file system paths for servable storage locations. It is the standard data type used in Source<StoragePath>, FileSystemStoragePathSource, and StoragePathSourceAdapter.
Code Reference
Source Location
- Repository: Tensorflow_Serving
- File: tensorflow_serving/core/storage_path.h
- Lines: 1-54
Signature
using StoragePath = string;
bool operator==(const ServableData<StoragePath>& a,
const ServableData<StoragePath>& b);
Import
#include "tensorflow_serving/core/storage_path.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| a | const ServableData<StoragePath>& | Yes | First ServableData instance to compare |
| b | const ServableData<StoragePath>& | Yes | Second ServableData instance to compare |
Outputs
| Name | Type | Description |
|---|---|---|
| operator== | bool | True if both have the same id, same status category, and same data or same error |
Usage Examples
Using StoragePath with ServableData
#include "tensorflow_serving/core/storage_path.h"
#include "tensorflow_serving/core/servable_data.h"
using namespace tensorflow::serving;
ServableId id = {"my_model", 1};
StoragePath path = "/models/my_model/1";
ServableData<StoragePath> data(id, path);
// Access the path
const StoragePath& model_path = data.DataOrDie();
Comparing ServableData StoragePaths
ServableId id = {"my_model", 1};
ServableData<StoragePath> a(id, "/models/my_model/1");
ServableData<StoragePath> b(id, "/models/my_model/1");
bool equal = (a == b); // true