/// <summary> /// Publishes the specified stream to the debug partition, allowing debugging visualizers to display the data. /// </summary> /// <typeparam name="T">The type of data in the stream</typeparam> /// <param name="source">The stream to visualize</param> /// <param name="name">The name to use when visualizing the stream</param> /// <param name="deliveryPolicy">An optional delivery policy.</param> /// <returns>The debug name of the stream, either as provided or the generated one if one was not specified</returns> public static string DebugView <T>(this IProducer <T> source, string name = null, DeliveryPolicy deliveryPolicy = null) { var debugName = name ?? source.Out.Name ?? source.Out.Id.ToString(); if (debugStore != null) { lock (syncRoot) { if (!Store.TryGetMetadata(debugPipeline, debugName, out PsiStreamMetadata meta)) { source.Write(debugName, debugStore, deliveryPolicy: deliveryPolicy); } } } return(debugName); }
/// <summary> /// Returns the metadata associated with the specified stream, if the stream is persisted to a store. /// </summary> /// <typeparam name="T">The type of stream messages</typeparam> /// <param name="source">The stream to retrieve metadata about</param> /// <param name="metadata">Upon return, this parameter contains the metadata associated with the stream, or null if the stream is not persisted</param> /// <returns>True if the stream is persisted to a store, false otherwise</returns> public static bool TryGetMetadata <T>(IProducer <T> source, out PsiStreamMetadata metadata) { return(Store.TryGetMetadata(source.Out.Pipeline, source.Out.Name, out metadata)); }