randring

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 3 Imported by: 0

README

randring

Package randring provides a ring buckets for multi-producer & one-consumer which will drop messages if buckets full and won't guarantee order.

randring only cares about memory corruption.

Documentation

Overview

Package randring provides a ring buckets for multi-producer & one-consumer which will drop messages if buckets full and won't guarantee order. randring only cares about memory corruption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring added in v0.0.2

type Ring struct {
	// contains filtered or unexported fields
}

Ring provides a ring buckets for multi-producer & one-consumer.

func New

func New(n uint64) *Ring

New creates a ring. ring size = 2 ^ n.

func (*Ring) Push added in v0.0.2

func (r *Ring) Push(data unsafe.Pointer)

Push puts the data in ring in the next bucket no matter what in it.

func (*Ring) TryPop added in v0.0.2

func (r *Ring) TryPop() (unsafe.Pointer, bool)

TryPop tries to pop data from the next bucket, return (nil, false) if no data available.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL