Skip to content

Instantly share code, notes, and snippets.

@influx6
Last active August 11, 2017 20:22
Show Gist options
  • Save influx6/0b531782474150058658aa2a4dcd565e to your computer and use it in GitHub Desktop.
Save influx6/0b531782474150058658aa2a4dcd565e to your computer and use it in GitHub Desktop.
The baseline interface for a FBP style service provider
// Service defines a baselevel interface that exposes itself as the
// frontal system for a flow based communication network.
type Service ínterface {
// Receive will return a channel which will allow you to continue reading from it till it is closed.
Receive(string) (chan Type, error)
// Send will take the giving channel reading the provided data of that channel till the channel is closed
// to signal the end of the transmission.
Send(string, chan Type) error
// Done defines a signal to other pending services to know whether the service is still servicing
// request.
Done() chan struct{}
// Service defines a function to be called to stop the service internal operation and to close
// all read/write operations.
Stop() error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment