GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jeffutter/ets_buffer: Simple Event Buffer in ETS

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
test
test
 
 
.formatter.exs
.formatter.exs
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mix.exs
mix.exs
 
 
mix.lock
mix.lock
 
 

Repository files navigation

ETSBuffer

ETSBuffer is a simple buffer that stores a maximum of N events, keeping only the N events with the greatest sort keys.

ETSBuffer is backed by an ordered set ETS table, and thus the buffer is ordered using erlang term ordering of the sort key to determine which events are the greatest.

ETSBuffer also uses a protected, read concurrent optimized ETS table so that the buffer can be read concurrently by many processes, but must be updated through a single process.

Example

iex(1)> buffer = ETSBuffer.init(max_size: 5)

iex(1)> ETSBuffer.push(buffer, 1, 1)
iex(2)> ETSBuffer.push(buffer, 2, 2)
iex(3)> ETSBuffer.push(buffer, 3, 3)
iex(4)> ETSBuffer.push(buffer, 0, 0)
iex(5)> ETSBuffer.push(buffer, 6, 6)
iex(6)> ETSBuffer.push(buffer, 5, 5)

iex(7)> ETSBuffer.list()
[2,3,4,5,6]

About

Simple Event Buffer in ETS

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.