DPDK's rte_ring implementation in Rust

Overview

rte_ring

Ring library from DPDK ported to Rust.

Based on DPDK 21.11.0.

Features

  • FIFO
  • Maximum size is fixed, the pointers are stored in a table
  • Lockless implementation
  • Multi-consumer or single-consumer dequeue
  • Multi-producer or single-producer enqueue
  • Bulk dequeue -- Dequeues the specified count of objects if successful; otherwise fails
  • Bulk enqueue -- Enqueues the specified count of objects if successful; otherwise fails
  • TBD Burst dequeue -- Dequeue the maximum available objects if the specified count cannot be fulfilled
  • TBD Burst enqueue -- Enqueue the maximum available objects if the specified count cannot be fulfilled

Example

use rte_ring::*;

// A size should be a power of two (real size is `2^n-1`).
// Use `flags` to make one or both ends of the ring not thread-safe.
let r = Ring::<i32>::new(8, flags::NONE).unwrap();

r.enqueue(1);
r.enqueue_bulk(&[2, 3]);
assert_eq!(r.count(), 3);

let x = r.dequeue().unwrap();
assert_eq!(x, 1);

let mut xs = [0; 2];
r.dequeue_bulk(&mut xs);
assert_eq!(vec![2, 3], xs);

assert_eq!(r.count(), 0);

Internals

TBD. For now see Programmer's Guide from DPDK.

TODO

  • Docs.
  • Multithread tests, loom.
  • Bulk-functions (only interface, algorithm already supports).
  • Refactor, split implementation, separate interface from implementation (traits?).
  • More examples.
  • Benchmarks, compare to DPDK.

License

BSD 3-Clause license

You might also like...
A Conway's Game of Life implementation in Rust & WASM
A Conway's Game of Life implementation in Rust & WASM

Rust Wasm Game of Life This repo contains an example implementation of Conway's Game of Life in Rust and WebAssembly. How to use You should have wasm-

KERI implementation in RUST, current development lead by DIF

KERIOX Introduction Features Introduction KERIOX is an open source Rust implementation of the Key Event Receipt Infrastructure (KERI) , a system desig

A rust implementation of the reverse-engineered Glorious mouse protocol

gloryctl This project is an implementation of the vendor-specific HID protocol in use by Glorious mice used to configure parameters such as DPI profil

Rust implementation of the Edge IoT framework

A Rust-based implementation of Edge-rs for the Raspberry Pi Pico Getting started For more details see the following article on getting started for get

The rust implementation of IPLD schemas and some associated functionalities.

Linked Data IPLD schemas and what to do with them. Beacon Directory of user content and metadata. Since this object should not change it can be used a

Rust implementation of Project Fluent

Fluent fluent-rs is a collection of Rust crates implementing Project Fluent. The crates perform the following functions: fluent Umbrella crate combini

A rust bencode encoding/decoding implementation backed by serde.

Bende A rust bencode encoding/decoding implementation backed by serde. About This is one of a few bencode implementations available for rust. Though t

Svix - A pure Rust and fully tested KSUID implementation

Svix - Webhooks as a service Svix-KSUID (Rust) A pure Rust and fully tested KSUID implementation This library is fully compatible with Segment's KSUID

A naive buffered/sync channel implementation in Rust, using the queue data structure

buffered-queue-rs Introduction This is my attempt at a simple and very naive buffered/synced queue implementation in Rust. The base thread-safe queue

Owner
Stepan Repin
Just a russian student-autodidact
Stepan Repin
🦀 Rust-based implementation of a Snowflake Generator which communicates using gRPC

Clawflake Clawflake is a Rust application which implements Twitter Snowflakes and communicates using gRPC. Snowflake ID numbers are 63 bits integers s

n1c00o 5 Oct 31, 2022
Re-implementation of Panda Doodle in Rust targetting WASM, a mobile game originally written in C++

Description This is the source code of my game Panda Doodle, which can be played at https://pandadoodle.lucamoller.com/ (it's best playable on touch s

null 79 Dec 5, 2022
2D Predictive-Corrective Smoothed Particle Hydrodynamics (SPH) implementation in Rust with WASM + WebGL

pcisph-wasm 2D Predictive-Corrective Smoothed Particle Hydrodynamics (SPH) implementation in Rust with WASM + WebGL Reimplementation of my previous Ru

Lucas V. Schuermann 46 Dec 17, 2022
A Rust implementation of fractional indexing.

fractional_index This crate implements fractional indexing, a term coined by Figma in their blog post Realtime Editing of Ordered Sequences. Specifica

null 18 Dec 21, 2022
Pure rust implementation of jq

XQ JQ reimplemented purely in Rust. Caution This program is under development. You probably want to use the original implementation of jq, or pure Go

null 181 Jan 4, 2023
A pure Rust PLONK implementation using arkworks as a backend.

PLONK This is a pure Rust implementation of the PLONK zk proving system Usage use ark_plonk::prelude::*; use ark_ec::bls12::Bls12; use rand_core::OsRn

rust-zkp 201 Dec 31, 2022
A Bancho implementation made in Rust for the *cursed* stack.

cu.rs A Bancho implementation made in Rust for the cursed stack. THIS PROJECT IS REALLY UNFINISHED AND IN ITS EARLY STAGES A drag and drop replacement

RealistikOsu! 5 Feb 1, 2022
Golang like WaitGroup implementation for sync/async Rust.

wg Golang like WaitGroup implementation for sync/async Rust.

Al Liu 8 Dec 6, 2022
Hexdump implementation in Rust

Minimalistic hexdump implementation in Rust

null 1 Oct 25, 2021
Implementation of the WebUSB specification in Rust.

Implementation of the WebUSB specification in Rust.

Divy Srivastava 38 Dec 4, 2022