netchan

command module
Version: v0.0.0-...-4413804 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

README

netchan

As you can guess, netchan makes Golang channel work over network. Both ends of the channel can talk synchronously or asychronously.

Example:

  // a sending process
  ch := sender.NewChannel("my_log")
  for line := range lines {
    ch <- []byte(line)
  }
  
  // a receiving process, on a different machine
  ch := receiver.NewChannel("my_log")
  for line := range ch {
    println(string(line))
  }

Both channels are chan []byte. Of course, sender channel is send-only, and receiver channel is receive-only.

Simple, right? Read on. It's more sophisticated underneath.

Design

netchan has 2 or 3 components: optional Leader, Sender, Receiver

Leader

Leader is solely for service discovery. Basically, mapping a name to a service location.

This can be skipped if everything runs intranet, where we just need a simple network broadcast.

Current Leader implementation is a simple http server. Later, service discovery can use Etcd, Zookeeper, etc.

Sender and Receiver

It's actually not Sender sends messages to Receiver, but Receivers pull messages out of Sender.

Sender stores all messages on disk locally for a configurable time, depending on avaiable disk space. This makes asynchronous message passing possible. When a Receiver requests the data by a timestamp, Sender will respond with corresponding data.

If a Receiver catches up, Sender will pass the most recent messages to the Receiver.

One Sender can have multiple Receivers.

Receiver can give Sender a filter, so that Receiver only receives filtered results.

Comparison

netchan usage is similar to common messaging systems. However, netchan does not need a separate messaging system such as Kafka, NATS, etc. The data is stored on the sender directly.

Work in progress

Welcome any sorts of help, discussion, pull requests, tests, etc.

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Directories

Path Synopsis
driver/cmd
Package cmd is a generated protocol buffer package.
Package cmd is a generated protocol buffer package.
lib
This example demonstrates a priority queue built using the heap interface.
This example demonstrates a priority queue built using the heap interface.
flow
flow
service_discovery
leader
Leader acts as a transient team leader It register each service's active locations.
Leader acts as a transient team leader It register each service's active locations.

Jump to

Keyboard shortcuts

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