TensorFlow Serving C++ API Documentation
|
#include <source.h>
Public Types | |
using | AspiredVersionsCallback = std::function< void(const StringPiece servable_name, std::vector< ServableData< T > > versions)> |
Public Member Functions | |
virtual void | SetAspiredVersionsCallback (AspiredVersionsCallback callback)=0 |
Supplies an AspiredVersionsCallback to use. Can be called at most once. | |
An abstraction for a module that sources servables to load, or, more precisely, handles to data that can be used to load those servables. Examples of such data handles are:
A Source monitors some external resource (e.g. file system, RPC calls) to find out about new servables and/or new versions of servables and/or the need to unload servable versions. It uses the provided callback to instruct a Target module (e.g. AspiredVersionsManager) which version(s) of a given servable to load. Furthermore, depending on the semantics of the Target module, the Source implicitly instructs it which ones to unload by omitting those servables.
A common case is that a Source emits versions for exactly one servable. An even simpler case is that a servable has a single, static version for the lifetime of the server.
Sources can house state that is shared among multiple emitted servables, e.g.
using tensorflow::serving::Source< T >::AspiredVersionsCallback = std::function<void( const StringPiece servable_name, std::vector<ServableData<T> > versions)> |
A callback for a Source to supply version(s) of a servable to a Target, to be loaded.
A single invocation of the callback pertains to a single servable stream (given by 'servable_name'). All versions supplied in a call must be for the servable identified in 'servable_name'. Invocations on different servable streams are orthogonal to one another.
Multiple invocations may supply servable-data objects with identical ids (i.e. same servable name and version). Such servable-data objects are treated as semantically equivalent. The recipient will ultimately retain one and discard the rest.
If a servable version V is supplied in a first invocation, and subsequently omitted from a second invocation, the implication of omitting V depends on the semantics of the Target of the callback. Certain Targets will interpret V's omission as an implicit instruction to unload V. Each Target must document its semantics in this regard.