dchan

package
v0.0.0-...-5a8c9f9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dchan provides an elastic event channel implementation and a Chan interface, unifying all the go channel types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChan

func NewChan(ch Chan) chanStream

Get an object that implements stream.Stream and backend.Stream interfaces with the Chan object.

Types

type Chan

type Chan interface {
	// Send event to a channel.
	Send(v stream.Event)
	// Receive event and closed flag from a channel.
	Recv() (stream.Event, bool)
	// Number of events in the channel buffer.
	Len() int
	// Maximum possible number of events in the channel buffer.
	Cap() int
	// Close the channel.
	Close()
	// Free the underlying resources of a closed channel.
	// Call this function after Close and before channel is empty.
	Done()
}

Channel interface.

func ChanDyn

func ChanDyn() Chan

Get an implementation of Chan interface for elastic channel: the channel with infinite, dynamically growing buffer.

func ChanDynBuf

func ChanDynBuf(buf int) Chan

Get an implementation of Chan interface for elastic channel: the channel with infinite, dynamically growing buffer with specified initial buffer sise. TODO: make buffefred chennels possible. THe problem now is when isClosed is true and we do not drain the buffered add channel.

func GoChan

func GoChan() Chan

Get an implementation of Chan interface for standart go chan stream.Event.

func GoChanBuf

func GoChanBuf(buf int) Chan

Get an implementation of Chan interface for standart go buffered chan stream.Event with specified buffer sise.

Jump to

Keyboard shortcuts

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