Class HistoricalNodeVersionList<N extends HistoricalNode & Comparable<? super N>>

java.lang.Object
com.inductiveautomation.historian.gateway.api.query.HistoricalNodeVersionList<N>
Type Parameters:
N - the HistoricalNode subtype stored; its compareTo must order by HistoricalNode.createdTime()

public class HistoricalNodeVersionList<N extends HistoricalNode & Comparable<? super N>> extends Object
The versions of one node identity, sorted by created timestamp ascending, with lookups by exact created timestamp and by point in time.

Versions may be added in any order relative to the existing ones; equal versions (per Object.equals(Object)) at the same created timestamp are kept once.

Thread-safe: reads share a lock and mutations are exclusive.

  • Constructor Details

    • HistoricalNodeVersionList

      public HistoricalNodeVersionList(Function<Instant,N> timestampKeyFactory)
      Parameters:
      timestampKeyFactory - builds a probe node that carries only the given created time.
  • Method Details

    • add

      public boolean add(N node)
      Adds a node in created-timestamp order, skipping it when an equal node already exists at the same created timestamp.
      Parameters:
      node - the node to add.
      Returns:
      true if the node was added, false if an equal node already existed.
    • getAllNodeVersions

      public List<N> getAllNodeVersions()
      Returns an immutable snapshot of all versions, sorted by created time.
    • findNodeByCreatedTimestamp

      public Optional<@NonNull N> findNodeByCreatedTimestamp(Instant createdTimestamp)
      Finds the version with exactly the given created timestamp.
      Parameters:
      createdTimestamp - the created timestamp to match.
      Returns:
      the matching version, or empty if none.
    • findActiveNodeAt

      public Optional<@NonNull N> findActiveNodeAt(Instant timestamp)
      Finds the version that was active at the given time.
      Parameters:
      timestamp - the point in time.
      Returns:
      the active version, or empty if none was (for example, the time precedes the first version).
    • findCurrentActiveNode

      public Optional<@NonNull N> findCurrentActiveNode()
      Finds the current version: the newest, provided it has not been retired.
      Returns:
      the current version, or empty if the list is empty or the newest version is retired.
    • remove

      public boolean remove(N node)
      Removes the given node instance.
      Parameters:
      node - the exact instance to remove.
      Returns:
      true if the node was removed.
    • findNodeCoveringTimestamp

      public Optional<@NonNull N> findNodeCoveringTimestamp(Instant timestamp)
      Finds the version whose [created, retired) interval contains the given time.
      Parameters:
      timestamp - the time to check.
      Returns:
      the covering version, or empty if none.