We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes it might be convenient to shift the beginning of the stream by skipping certain amount of time.
Reference implementation for Sample type for finite stream, with added proper sample measurement it would be easy to generalize the implementation:
Sample
@Serializable class SkipStreamParams( val timeToSkip: Long, val timeUnit: TimeUnit ) : BeanParams() class SkipStream( override val input: FiniteStream<Sample>, override val parameters: SkipStreamParams, ) : AbstractOperationBeanStream<Sample, Sample>(input), SinglePartitionBean, SingleBean<Sample>, FiniteStream<Sample> { override fun operationSequence(input: Sequence<Sample>, sampleRate: Float): Sequence<Sample> { val toSkipSamplesCount = timeToSampleIndexCeil(parameters.timeToSkip, parameters.timeUnit, sampleRate).toInt() return input.drop(toSkipSamplesCount) } override fun samplesCount(): Long = input.samplesCount() override fun length(timeUnit: TimeUnit): Long = input.length() } fun FiniteStream<Sample>.skip(timeToSkip: Long, timeUnit: TimeUnit): FiniteStream<Sample> = SkipStream(this, SkipStreamParams(timeToSkip, timeUnit))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sometimes it might be convenient to shift the beginning of the stream by skipping certain amount of time.
Reference implementation for
Sample
type for finite stream, with added proper sample measurement it would be easy to generalize the implementation:The text was updated successfully, but these errors were encountered: