fastchan

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

fast-chan

Based on Gringo and compatible with Gotemplate

Benchmarks work best on GOMAXPROCS=1. In real world usage, this might have to be experimented with

This is created and optimized for SPSC case and might blow up for multiple producers and/or multiple consumers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheItem

type CacheItem interface{}

template type FastChan(CacheItem)

type FastChan

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

FastChan is a minimalist queue replacement for channels with higher throughput

func NewFastChan

func NewFastChan(size uint64) *FastChan

NewFastChan creates a new channel

func (*FastChan) Empty

func (c *FastChan) Empty()

Empty the channel

func (*FastChan) IsEmpty

func (c *FastChan) IsEmpty() bool

IsEmpty checks if the channel is empty

func (*FastChan) IsFull

func (c *FastChan) IsFull() bool

IsFull checks if the channel is full

func (*FastChan) Put

func (c *FastChan) Put(value CacheItem)

Put writes a CacheItem to the front of the channel

func (*FastChan) Read

func (c *FastChan) Read() CacheItem

Read reads and removes a CacheItem from the back of the channel

func (*FastChan) Size

func (c *FastChan) Size() uint64

Size gets the size of the contents in the channel buffer

Jump to

Keyboard shortcuts

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