Giter Site home page Giter Site logo

go-ringbuffer's Introduction

Build Status

ringbuffer

Simple RingBuffer pacakge Ringbuffer is non blocking for readers and writers, writers will overwrite older data in a circular fashion. Readers will read from the current position and update it.

Usage

type RingBuffer

type RingBuffer struct {
	Size      int           // Size of the Ringbuffer
	Container []interface{} // Array container of objects
	Reader    int           // Reader position
	Writer    int           // Writer Position
}

RingBuffer Structure

func NewRingBuffer

func NewRingBuffer(size int) *RingBuffer

Create a new RingBuffer of initial size "size" Returns a pointer to the new RingBuffer

func (*RingBuffer) Read

func (r *RingBuffer) Read() interface{}

Read single object from the RingBuffer

func (*RingBuffer) Write

func (r *RingBuffer) Write(v interface{})

Write object into the RingBuffer

go-ringbuffer's People

Contributors

sahmad98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-ringbuffer's Issues

Consider a release including a patch version

Dear sahmad98,

Using go modules I seem unable to import your package directly, as the release tags are lacking a patch version.

As a workaround, for now I've forked this repository in order to create the an additional release including the patch version (v1.1.0).

You might want to add such a release to this repo as well, as it will make it easier for others to use the code. Also, I'd rather reference this repo, as future updates/fixes might be published here first.

If you don't feel like you want to add it, just close this issue :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.