DataLoaders.RingBuffer

struct defined in module DataLoaders


			
			
			



			RingBuffer
	
			
			(
			
			size
			
			, 
			
			buf
			
			)

A Channel - like data structure that rotates through size buffers . put! s work by mutating one of the buffers:


			
			
			
			
			put!
			
			(
			
			ringbuffer
			
			) 
			
			
			do
			
			 
			
			
			
			
			buf
			
			
    
			
			
			
			rand!
			
			(
			
			buf
			
			)

			
			end

The result can then be take! n:


			
			
			
			
			res
			
			 
			
			= 
			
			
			take!
			
			(
			
			ringbuffer
			
			)
Invalidation

Only one result is valid at a time ! On the next take! , the previous result will be reused as a buffer and be mutated by a put!

Methods

There are 3 methods for RingBuffer:

DataLoaders.RingBuffer(bufs::Vector{T})
ringbuffer.jl:31
DataLoaders.RingBuffer(buffers::Channel{T}, results::Channel{T}, current::T)
ringbuffer.jl:26
DataLoaders.RingBuffer(size, buffer::T)
ringbuffer.jl:42
Backlinks