Class MetadataType<T>

java.lang.Object
velox.api.layer1.dynamichistory.metadata.MetadataType<T>
Type Parameters:
T - type of the value returned by getMetadata when 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:

  • Field Details

    • type

      public final Class<T> type
      Type of the value returned by getMetadata for this token.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • firstEventTimeType

      public static MetadataType.FirstEventTimeType 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 to getMetadata, the returned stage: NOTE: All listed exception are wrapped into CompletionException
      Returns:
      a token that makes getMetadata return a FirstEventTime
    • linearMetadataType

      public static MetadataType.LinearMetadataType 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 yields Optional.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 getMetadata return the per-alias catalog as an Optional<LinearDataMetadata>