StreamingPrefetchingSupplier

class Object
trait Matchable
class Any

Type members

Classlikes

A PrefetchingSupplier trait that is fed from a stream of updates, not a batch job.

A PrefetchingSupplier trait that is fed from a stream of updates, not a batch job.

Type parameters:
T

the type of the pre-fetched value

Value parameters:
lastOkUpdate

holds the last time the value was updated successfully

prefetchedValueRef

the Ref pointing to the currently held pre-fetched value

streamConsumptionFiber

the fiber that consumes from the stream

Value members

Concrete methods

def fromStream[T : Tag](initialValue: T, supplyingStream: UStream[T], prefetcherName: String): ZIO[Clock & ZEnv, Nothing, StreamingPrefetchingSupplier[T]]

Builds a pre-fetcher that is fed from a stream of updates.

Builds a pre-fetcher that is fed from a stream of updates.

Outside of updates provided by the 'supplyingStream', no mutation of the pre-fetched value occurs.

Type parameters:
I

Type of the incoming stream

Value parameters:
initialValue

the value that will be available immediately. Note that it will be overridden immediately if the passed stream already contains a value.

supplyingStream

the stream of updates that will replace the value held in this prefetcher. This stream is expected to be infinite and blocking (a separate process feeds updates into it). It will continuously and asynchronously be drained. No recovery will be attempted if it fails.