Ring Buffer

Blindsight comes with the option to add event buffering to a logger, so that logged entries can be accessible from the application. This can be very useful for debugging and for verifying test output.

A bounded in-memory ring buffer implementation based on org.jctools.queues.MpmcArrayQueue from the JCTools project is provided. This implementation is thread-safe and performant. If you need another implementation (for example, you want to use an off-heap buffer or buffer to disk), then the EventBuffer interface is relatively straightforward to implement.

To add the ringbuffer implementation, add the following resolver:

resolvers += Resolver.bintrayRepo("tersesystems", "maven")

And then add the dependency:

sbt
libraryDependencies += "com.tersesystems.blindsight" %% "blindsight-ringbuffer" % "1.4.0-RC4"
Maven
<properties>
  <scala.binary.version>2.13</scala.binary.version>
</properties>
<dependency>
  <groupId>com.tersesystems.blindsight</groupId>
  <artifactId>blindsight-ringbuffer_${scala.binary.version}</artifactId>
  <version>1.4.0-RC4</version>
</dependency>
Gradle
versions += [
  ScalaBinary: "2.13"
]
dependencies {
  compile group: 'com.tersesystems.blindsight', name: "blindsight-ringbuffer_${versions.ScalaBinary}", version: '1.4.0-RC4'
}
The source code for this page can be found here.