Class MetadataType<T>
java.lang.Object
velox.api.layer1.dynamichistory.metadata.MetadataType<T>
- Type Parameters:
T- type of the value returned bygetMetadatawhen this token is used
- Direct Known Subclasses:
MetadataType.FirstEventTimeType,MetadataType.LinearMetadataType
public abstract sealed class MetadataType<T>
extends Object
permits MetadataType.FirstEventTimeType, MetadataType.LinearMetadataType
Selects which piece of metadata to request from
getMetadata.
Pass one of the tokens returned by the static methods of this class to getMetadata; the type of value you get
back is determined by the token you pass. For example:
FirstEventTime first = accessInterface.getMetadata(dataSource, instrumentInfo, MetadataType.firstEventTimeType())
.toCompletableFuture()
.orTimeout(5, TimeUnit.SECONDS)
.join();
Available metadata:
firstEventTimeType()— returnsFirstEventTime, the timestamp of the earliest event available for the instrument. Or nothing if metadata is not availablelinearMetadataType()— returnsOptional<LinearDataMetadata>, the catalog of linear data structures recorded for the instrument, orOptional.empty()if the server records none
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMetadata token forFirstEventTime; obtain it fromfirstEventTimeType().static final classMetadata token forLinearDataMetadata, obtain it fromlinearMetadataType() -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionRequests the time of the earliest available event for the instrument.Discovers which linear data structures (per-interval block series, e.g.toString()
-
Field Details
-
type
Type of the value returned bygetMetadatafor this token.
-
-
Method Details
-
toString
-
firstEventTimeType
Requests the time of the earliest available event for the instrument. Can return response or nothing if there is no metadata for the given instrument, in case there is no history for it, or the server was unavailable at the moment when the request was made. When passed togetMetadata, the returned stage:- yields
FirstEventTime.Foundwith the earliest event time, orFirstEventTime.HistoryNotAvailableif the instrument has no history; - completes exceptionally (cause is
RequestTimeoutException) if the request times out. - completes exceptionally (cause is
ServerNotAvailableException) if the server is unavailable.
- Returns:
- a token that makes
getMetadatareturn aFirstEventTime
- yields
-
linearMetadataType
Discovers which linear data structures (per-interval block series, e.g. zoom-out candles) the server has recorded for the given instrument, and — per interval — how many blocks are finalized and when the series starts. Use it to decide which structure and interval to request and which time range is worth requesting; the server translates time to block indices, so a consumer never computes indices itself.When passed to
getMetadata, the returned stage never blocks the calling thread and is guaranteed to complete: the fetch is bounded by the client's request timeouts plus a hard cap. It yieldsOptional.empty()when the server records no linear data for the instrument (re-checked periodically, since recording can start mid-session); a transient failure (server unreachable, timeout) completes the stage exceptionally and is not cached — the next call retries. The catalog is cached briefly, so block counts may lag the server by about a minute.- Returns:
- a token that makes
getMetadatareturn the per-alias catalog as anOptional<LinearDataMetadata>
-