Package com.stripe.android.camera.framework

Types

Link copied to clipboard
Link copied to clipboard
interface Analyzer<Input, State, Output>

An analyzer takes some data as an input, and returns an analyzed output. Analyzers should not contain any state. They must define whether they can run on a multithreaded executor, and provide a means of analyzing input data to return some form of result.

Link copied to clipboard

A factory to create analyzers.

Link copied to clipboard

A loop to execute repeated analysis. The loop uses coroutines to run the Analyzer.analyze method. If the Analyzer is threadsafe, multiple coroutines will be used. If not, a single coroutine will be used.

Link copied to clipboard
interface AnalyzerLoopErrorListener
Link copied to clipboard
data class AnalyzerPool<DataFrame, State, Output>(val desiredAnalyzerCount: Int, val analyzers: List<Analyzer<DataFrame, State, Output>>)

A pool of analyzers.

Link copied to clipboard
class FiniteAnalyzerLoop<DataFrame, State, Output>(    analyzerPool: AnalyzerPool<DataFrame, in State, Output>,     resultHandler: TerminatingResultHandler<DataFrame, out State, Output>,     analyzerLoopErrorListener: AnalyzerLoopErrorListener,     timeLimit: Duration = Duration.INFINITE) : AnalyzerLoop<DataFrame, State, Output>

This kind of AnalyzerLoop will process data provided as part of its constructor. Data will be processed in the order provided.

Link copied to clipboard
class ProcessBoundAnalyzerLoop<DataFrame, State, Output>(    analyzerPool: AnalyzerPool<DataFrame, in State, Output>,     resultHandler: StatefulResultHandler<DataFrame, out State, Output, Boolean>,     analyzerLoopErrorListener: AnalyzerLoopErrorListener) : AnalyzerLoop<DataFrame, State, Output>

This kind of AnalyzerLoop will process data until the result handler indicates that it has reached a terminal state and is no longer listening.

Link copied to clipboard
data class RepeatingTaskStats(    val executions: Int,     val startedAt: ClockMark,     val totalDuration: Duration,     val totalCpuDuration: Duration,     val minimumDuration: Duration,     val maximumDuration: Duration)
Link copied to clipboard

The ResultAggregator processes results from analyzers until a condition is met. That condition is part of the aggregator's logic.

Link copied to clipboard
abstract class StatefulResultHandler<Input, State, Output, Verdict>(initialState: State) : ResultHandler<Input, Output, Verdict>

A specialized result handler that has some form of state.

Link copied to clipboard
object Stats
Link copied to clipboard
interface StatTracker

Keep track of a single stat's duration and result

Link copied to clipboard
class StatTrackerImpl(onComplete: suspend (ClockMark, String?) -> Unit) : StatTracker
Link copied to clipboard
data class TaskStats(    val started: ClockMark,     val duration: Duration,     val result: String?)
Link copied to clipboard
abstract class TerminatingResultHandler<Input, State, Output>(initialState: State) : StatefulResultHandler<Input, State, Output, Unit>

A result handler with a method that notifies when all data has been processed.