All Projects → xorxornop → RingBuffer

xorxornop / RingBuffer

Licence: Apache-2.0 license
Classic ringbuffer with optional Stream interface

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to RingBuffer

Framework
Asynchronous & Fault-tolerant PHP Framework for Distributed Applications.
Stars: ✭ 1,125 (+2022.64%)
Mutual labels:  stream, asynchronous
futura
Asynchronous Swift made easy. The project was made by Miquido. https://www.miquido.com/
Stars: ✭ 34 (-35.85%)
Mutual labels:  stream, asynchronous
ring-channel
Bounded MPMC channel abstraction on top of a ring buffer
Stars: ✭ 24 (-54.72%)
Mutual labels:  asynchronous, ring-buffer
RingBuffer
模仿 kfifo 实现的环形缓冲区
Stars: ✭ 64 (+20.75%)
Mutual labels:  buffer, ring-buffer
Corrode
A batteries-included library for reading binary data.
Stars: ✭ 116 (+118.87%)
Mutual labels:  stream, buffer
Write
Write data to the file system, creating any intermediate directories if they don't already exist. Used by flat-cache and many others!
Stars: ✭ 68 (+28.3%)
Mutual labels:  stream, buffer
cpsfy
🚀 Tiny goodies for Continuation-Passing-Style functions, fully tested
Stars: ✭ 58 (+9.43%)
Mutual labels:  stream, asynchronous
Rapscallion
Asynchronous React VirtualDOM renderer for SSR.
Stars: ✭ 1,405 (+2550.94%)
Mutual labels:  stream, asynchronous
Tributary
Streaming reactive and dataflow graphs in Python
Stars: ✭ 231 (+335.85%)
Mutual labels:  stream, asynchronous
node-pg-large-object
Large object support for PostgreSQL clients using the node-postgres library.
Stars: ✭ 31 (-41.51%)
Mutual labels:  stream, buffer
lwjson
Lightweight JSON parser for embedded systems
Stars: ✭ 66 (+24.53%)
Mutual labels:  stream
watsor
Object detection for video surveillance
Stars: ✭ 203 (+283.02%)
Mutual labels:  stream
react-cool-form
😎 📋 React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+364.15%)
Mutual labels:  asynchronous
remoting
Jetlang Remoting - asynchronous distributed messaging
Stars: ✭ 27 (-49.06%)
Mutual labels:  asynchronous
workerman
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.4.
Stars: ✭ 10,005 (+18777.36%)
Mutual labels:  asynchronous
files-io
Read many files with node
Stars: ✭ 19 (-64.15%)
Mutual labels:  stream
anime-scraper
[partially working] Scrape and add anime episode stream URLs to uGet (Linux) or IDM (Windows) ~ Python3
Stars: ✭ 21 (-60.38%)
Mutual labels:  stream
go-streams
Stream Collections for Go. Inspired in Java 8 Streams and .NET Linq
Stars: ✭ 127 (+139.62%)
Mutual labels:  stream
Flutter-Chat-Application
Realtime Chat application using stream and linking with firebase firestore database build using flutter and firebase
Stars: ✭ 33 (-37.74%)
Mutual labels:  stream
TaskManager
A C++14 Task Manager / Scheduler
Stars: ✭ 81 (+52.83%)
Mutual labels:  asynchronous

RingByteBuffer

Classic ringbuffer (with optional .NET BCL System.IO.Stream interface), in C#. Packaged as a portable class library (PCL).


How to use it

Buffer is available through use of SequentialRingBuffer/ConcurrentRingBuffer, or RingBufferStream. It supports overwriting instead of throwing exceptions when capacity is filled, for use-cases such as multimedia streaming.

Asynchronous I/O from streams is supported to boost performance. When compiled with the #INCLUDE_UNSAFE compiler directive (easily accessible through ReleaseWithUnsafe build configuration), high-performance copying is available. As an fallback from this, Buffer.BlockCopy is used to accelerate copying of data. The extension methods that enable this are public-scoped, so they can be used outside of RingByteBuffer.

SequentialRingBuffer/ConcurrentRingBuffer (derived from RingBuffer abstract class) methods:

  • ctor: (int capacity, bool allowOverwrite = false) , (int capacity, byte[] buffer, bool allowOverwrite = false)
  • Put : (byte input) , (byte[] buffer) , (byte[] buffer, int offset, int count)
  • PutFrom (Stream source, int count)
  • PutFromAsync (Stream source, int count, CancellationToken cancellationToken)
  • Take : () => byte , () => byte[] , (int count) => byte[] , (byte[] buffer, int offset, int count)
  • TakeTo (Stream destination, int count)
  • TakeToAsync (Stream destination, int count, CancellationToken cancellationToken)
  • Skip (int count)
  • Reset()
  • ToArray() => byte[]

It has these properties:

  • Overwriteable
  • MaximumCapacity
  • CurrentLength
  • Spare

There is no significant difference between the sequential and concurrent implementations other than speed in their respective use-cases.

RingBufferStream exposes these methods through common System.IO.Stream methods, e.g. Write is mapped to Put. It also exposes the PutFrom and TakeTo performance methods (and their async variants) as WriteFrom and ReadTo, respectively. Use of these methods allows no-copy transfers between streams. Asynchronous versions of the stream-oriented methods are available for maximum performance potential.


Licensed under the Apache License Version 2.0 - so basically you can use it in whatever you want so long as you leave the license text in the files, and if you modify the code, a note of this is made in the file. It is also GPL-compatible.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].