Coder Social home page Coder Social logo

collector's Introduction

Collector

Go Reference Coverage Status

This library provides a way to collect different channels of information to a single channel. The library is type-agnostic, using the interface{} type for data transmission, to provide as much flexibility as possible.

Usage

Generally, you would do the following:

  • Create a new Collector.
  • Create a depot for each channel with information you want to receive.
  • Start each depot or Run it in your own thread, as desired, to start receiving information.
  • Close the collector when finished. This also ends all Depot threads.
  • Also Close a Depot when you no longer want it to receive information, or when you're through.

Notes

Depots attempting to send to a closed Collector will not panic, but the Collector will not receive the data.

Channels given to a depot that someone closes automatically ends the Run or Start thread for that Depot.

If you do not care to use a depot, you could use the Collector's Send function instead. You'd gain a benefit of tracking if the channel is closed, gracefully failing in such cases rather than experiencing a panic.

You can use github.com/tvanriper/announcer to do the opposite of what this library does, in that it can take a single channel and send it to many listeners. The two libraries are meant to complement each other.

Installation

go get github.com/tvanriper/collector

collector's People

Contributors

tvanriper avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.