Documentation ¶
Overview ¶
Package pipeline implements the basic data processing pipeline used by peco
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Acceptor ¶
type Acceptor interface {
Accept(context.Context, chan interface{}, OutputChannel)
}
Acceptor is an object that can accept input, and send to an optional output
type Destination ¶
type Destination interface { Reset() Done() <-chan struct{} Acceptor }
Destination is a special case Acceptor that has no more Acceptors chained to it to consume data
type EndMark ¶
type EndMark struct{}
EndMark is a dummy struct that gets send as an EOL mark of sorts
type OutputChannel ¶
type OutputChannel chan interface{}
OutputChannel is an alias to `chan interface{}`
func (OutputChannel) OutCh ¶
func (oc OutputChannel) OutCh() <-chan interface{}
OutCh returns the channel that acceptors can listen to
func (OutputChannel) Send ¶
func (oc OutputChannel) Send(v interface{}) (err error)
Send sends the data `v` through this channel
func (OutputChannel) SendEndMark ¶
func (oc OutputChannel) SendEndMark(s string) error
SendEndMark sends an end mark
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is encapsulates a chain of `Source`, `ProcNode`s, and `Destination`
func (*Pipeline) Add ¶
Add adds new Acceptor that work on data that goes through the Pipeline. If called during `Run`, this method will block.
func (*Pipeline) Run ¶
Run starts the processing. Mutator methods for `Pipeline` cannot be called while `Run` is running.
func (*Pipeline) SetDestination ¶
func (p *Pipeline) SetDestination(d Destination)
SetDestination sets the destination. If called during `Run`, this method will block.
type Source ¶
type Source interface { // Start should be able to be called repeatedly, producing the // same data to be consumed by the chained Acceptors Start(context.Context, OutputChannel) Reset() }