Documentation ¶
Overview ¶
Package parts contains various pre-made bits and pieces to combine into the graph.
Index ¶
- type Aggregator
- func (*Aggregator) AssociateEditor(t *template.Template) error
- func (p *Aggregator) Channels() (read, written source.StringSet)
- func (p *Aggregator) Clone() interface{}
- func (*Aggregator) Help() template.HTML
- func (p *Aggregator) Impl() (head, body, tail string)
- func (*Aggregator) Imports() []string
- func (p *Aggregator) RenameChannel(from, to string)
- func (*Aggregator) TypeKey() string
- func (p *Aggregator) Update(req *http.Request) error
- type Broadcast
- func (b *Broadcast) AssociateEditor(tmpl *template.Template) error
- func (b *Broadcast) Channels() (read, written source.StringSet)
- func (b *Broadcast) Clone() interface{}
- func (*Broadcast) Help() template.HTML
- func (b *Broadcast) Impl() (head, body, tail string)
- func (*Broadcast) Imports() []string
- func (b *Broadcast) RenameChannel(from, to string)
- func (*Broadcast) TypeKey() string
- func (b *Broadcast) Update(r *http.Request) error
- type Code
- func (c *Code) AssociateEditor(tmpl *template.Template) error
- func (c *Code) Channels() (read, written source.StringSet)
- func (c *Code) Clone() interface{}
- func (*Code) Help() template.HTML
- func (c *Code) Impl() (Head, Body, Tail string)
- func (*Code) Imports() []string
- func (c *Code) LineCount() struct{ ... }
- func (c *Code) MarshalJSON() ([]byte, error)
- func (c *Code) RenameChannel(from, to string)
- func (*Code) TypeKey() string
- func (c *Code) UnmarshalJSON(j []byte) error
- func (c *Code) Update(r *http.Request) error
- type Filter
- func (f *Filter) AssociateEditor(tmpl *html.Template) error
- func (f *Filter) Channels() (read, written source.StringSet)
- func (f *Filter) ChannelsWritten() []string
- func (f *Filter) Clone() interface{}
- func (*Filter) Help() html.HTML
- func (f *Filter) Impl() (head, body, tail string)
- func (*Filter) Imports() []string
- func (f *Filter) RenameChannel(from, to string)
- func (*Filter) TypeKey() string
- func (f *Filter) Update(r *http.Request) error
- type HTTPServer
- func (*HTTPServer) AssociateEditor(t *template.Template) error
- func (p *HTTPServer) Channels() (read, written source.StringSet)
- func (p *HTTPServer) Clone() interface{}
- func (*HTTPServer) Help() template.HTML
- func (p *HTTPServer) Impl() (head, body, tail string)
- func (*HTTPServer) Imports() []string
- func (p *HTTPServer) Paths() []struct{ ... }
- func (p *HTTPServer) RenameChannel(from, to string)
- func (*HTTPServer) TypeKey() string
- func (p *HTTPServer) Update(req *http.Request) error
- type Multiplexer
- type PartTemplate
- func (*PartTemplate) AssociateEditor(t *template.Template) error
- func (p *PartTemplate) Channels() (read, written source.StringSet)
- func (p *PartTemplate) Clone() interface{}
- func (*PartTemplate) Help() template.HTML
- func (p *PartTemplate) Impl() (head, body, tail string)
- func (*PartTemplate) Imports() []string
- func (p *PartTemplate) RenameChannel(from, to string)
- func (*PartTemplate) TypeKey() string
- func (p *PartTemplate) Update(req *http.Request) error
- type StaticSend
- func (p *StaticSend) AllItems() string
- func (*StaticSend) AssociateEditor(t *template.Template) error
- func (p *StaticSend) Channels() (read, written source.StringSet)
- func (p *StaticSend) Clone() interface{}
- func (*StaticSend) Help() template.HTML
- func (p *StaticSend) Impl() (head, body, tail string)
- func (*StaticSend) Imports() []string
- func (p *StaticSend) RenameChannel(from, to string)
- func (*StaticSend) TypeKey() string
- func (p *StaticSend) Update(req *http.Request) error
- type TextFileReader
- func (r *TextFileReader) AssociateEditor(t *template.Template) error
- func (r *TextFileReader) Channels() (read, written source.StringSet)
- func (r *TextFileReader) Clone() interface{}
- func (*TextFileReader) Help() template.HTML
- func (r *TextFileReader) Impl() (head, body, tail string)
- func (*TextFileReader) Imports() []string
- func (r *TextFileReader) RenameChannel(from, to string)
- func (*TextFileReader) TypeKey() string
- func (r *TextFileReader) Update(req *http.Request) error
- type Unslicer
- func (*Unslicer) AssociateEditor(t *template.Template) error
- func (p *Unslicer) Channels() (read, written source.StringSet)
- func (p *Unslicer) Clone() interface{}
- func (*Unslicer) Help() template.HTML
- func (p *Unslicer) Impl() (head, body, tail string)
- func (*Unslicer) Imports() []string
- func (p *Unslicer) RenameChannel(from, to string)
- func (*Unslicer) TypeKey() string
- func (p *Unslicer) Update(req *http.Request) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct { Input string `json:"input"` Output string `json:"output"` Aggregation string `json:"aggr"` Value string `json:"value"` ValueType string `json:"value_type"` Key string `json:"key"` KeyType string `json:"key_type"` }
Aggregator aggregates some expression of input over some keys.
func (*Aggregator) AssociateEditor ¶
func (*Aggregator) AssociateEditor(t *template.Template) error
AssociateEditor associates a template called "part_view" with the given template.
func (*Aggregator) Channels ¶
func (p *Aggregator) Channels() (read, written source.StringSet)
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*Aggregator) Clone ¶
func (p *Aggregator) Clone() interface{}
Clone returns a copy of this part.
func (*Aggregator) Help ¶
func (*Aggregator) Help() template.HTML
Help returns useful help information.
func (*Aggregator) Impl ¶
func (p *Aggregator) Impl() (head, body, tail string)
Impl returns Go source code implementing the part.
func (*Aggregator) Imports ¶
func (*Aggregator) Imports() []string
Imports returns any extra import lines needed.
func (*Aggregator) RenameChannel ¶
func (p *Aggregator) RenameChannel(from, to string)
RenameChannel renames any uses of the channel "from" to the channel "to".
func (*Aggregator) TypeKey ¶
func (*Aggregator) TypeKey() string
TypeKey returns the string "Aggregator"
type Broadcast ¶
Broadcast sends each input message to every output, closing all the outputs when the input is closed.
func (*Broadcast) AssociateEditor ¶
AssociateEditor adds a "part_view" template to the given template.
func (*Broadcast) Clone ¶
func (b *Broadcast) Clone() interface{}
Clone returns a copy of this part.
func (*Broadcast) RenameChannel ¶
RenameChannel renames a channel possibly used by the input or any outputs.
type Code ¶
type Code struct {
Head, Body, Tail string
}
Code is a component containing arbitrary code.
func (*Code) AssociateEditor ¶
AssociateEditor adds a "part_view" template to the given template.
func (*Code) LineCount ¶
LineCount is number of lines in c.Head, c.Body, c.Tail (conveneince function for templates.)
func (*Code) MarshalJSON ¶
MarshalJSON encodes the Code component as JSON.
func (*Code) RenameChannel ¶
RenameChannel does fancy footwork to rename the channel in the code, with a side-effect of nicely formatting it. If a rename issue occurs e.g. because the user's code has a syntax error, the rename is aborted and logged.
func (*Code) UnmarshalJSON ¶
UnmarshalJSON decodes the Code component from JSON.
type Filter ¶
type Filter struct { Input string `json:"input"` Paths []pathway `json:"paths"` }
Filter tests values from the input and passes it on to one or more outputs based on predicates.
func (*Filter) AssociateEditor ¶
AssociateEditor adds a "part_view" template to the given template.
func (*Filter) ChannelsWritten ¶
ChannelsWritten is a convenience function for the template: allows closing outputs only once. (More than one close per channel panics.)
func (*Filter) Clone ¶
func (f *Filter) Clone() interface{}
Clone returns a copy of this Filter part.
func (*Filter) RenameChannel ¶
RenameChannel renames a channel possibly used by the input or any outputs.
type HTTPServer ¶
type HTTPServer struct { Address string `json:"address"` Handlers map[string]string `json:"handlers"` Errors string `json:"errors"` }
HTTPServer is a simple HTTP server that farms out requests to channels of type partlib.HTTPRequest, as defined by the handlers map.
func (*HTTPServer) AssociateEditor ¶
func (*HTTPServer) AssociateEditor(t *template.Template) error
AssociateEditor associates a template called "part_view" with the given template.
func (*HTTPServer) Channels ¶
func (p *HTTPServer) Channels() (read, written source.StringSet)
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*HTTPServer) Clone ¶
func (p *HTTPServer) Clone() interface{}
Clone returns a copy of this part.
func (*HTTPServer) Help ¶
func (*HTTPServer) Help() template.HTML
Help returns useful help information.
func (*HTTPServer) Impl ¶
func (p *HTTPServer) Impl() (head, body, tail string)
Impl returns Go source code implementing the part.
func (*HTTPServer) Imports ¶
func (*HTTPServer) Imports() []string
Imports returns any extra import lines needed.
func (*HTTPServer) Paths ¶
func (p *HTTPServer) Paths() []struct{ Pattern, Channel string }
Paths returns each handler as a struct. This is for the benefit of the editor template.
func (*HTTPServer) RenameChannel ¶
func (p *HTTPServer) RenameChannel(from, to string)
RenameChannel renames any uses of the channel "from" to the channel "to".
func (*HTTPServer) TypeKey ¶
func (*HTTPServer) TypeKey() string
TypeKey returns the string "HTTPServer"
type Multiplexer ¶
Multiplexer reads from N input channels and writes values into a single output channel. All the channels must have the same or compatible types. Once all input channels are closed, the output channel is also closed.
func (*Multiplexer) Channels ¶
func (m *Multiplexer) Channels() (read, written []string)
Channels returns the names of all channels used by this goroutine.
func (*Multiplexer) Impl ¶
func (m *Multiplexer) Impl() string
Impl returns the content of a goroutine implementing the multiplexer.
func (*Multiplexer) Refresh ¶
func (m *Multiplexer) Refresh() error
Refresh refreshes any cached information.
type PartTemplate ¶
type PartTemplate struct {
Something string `json:"something"`
}
PartTemplate is a mostly blank template for a part, to make it easier to write more parts. TODO: Add necessary fields and write a good doc comment.
func (*PartTemplate) AssociateEditor ¶
func (*PartTemplate) AssociateEditor(t *template.Template) error
AssociateEditor associates a template called "part_view" with the given template.
func (*PartTemplate) Channels ¶
func (p *PartTemplate) Channels() (read, written source.StringSet)
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*PartTemplate) Clone ¶
func (p *PartTemplate) Clone() interface{}
Clone returns a copy of this part.
func (*PartTemplate) Help ¶
func (*PartTemplate) Help() template.HTML
Help returns useful help information.
func (*PartTemplate) Impl ¶
func (p *PartTemplate) Impl() (head, body, tail string)
Impl returns Go source code implementing the part.
func (*PartTemplate) Imports ¶
func (*PartTemplate) Imports() []string
Imports returns any extra import lines needed.
func (*PartTemplate) RenameChannel ¶
func (p *PartTemplate) RenameChannel(from, to string)
RenameChannel renames any uses of the channel "from" to the channel "to".
func (*PartTemplate) TypeKey ¶
func (*PartTemplate) TypeKey() string
TypeKey returns the string "PartTemplate"
type StaticSend ¶
StaticSend is a mostly blank template for a part, to make it easier to write more parts. TODO: Add necessary fields and write a good doc comment.
func (*StaticSend) AllItems ¶
func (p *StaticSend) AllItems() string
AllItems returns all the Items in a single string.
func (*StaticSend) AssociateEditor ¶
func (*StaticSend) AssociateEditor(t *template.Template) error
AssociateEditor associates a template called "part_view" with the given template.
func (*StaticSend) Channels ¶
func (p *StaticSend) Channels() (read, written source.StringSet)
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*StaticSend) Clone ¶
func (p *StaticSend) Clone() interface{}
Clone returns a copy of this part.
func (*StaticSend) Help ¶
func (*StaticSend) Help() template.HTML
Help returns useful help information.
func (*StaticSend) Impl ¶
func (p *StaticSend) Impl() (head, body, tail string)
Impl returns Go source code implementing the part.
func (*StaticSend) Imports ¶
func (*StaticSend) Imports() []string
Imports returns any extra import lines needed.
func (*StaticSend) RenameChannel ¶
func (p *StaticSend) RenameChannel(from, to string)
RenameChannel renames any uses of the channel "from" to the channel "to".
func (*StaticSend) TypeKey ¶
func (*StaticSend) TypeKey() string
TypeKey returns the string "StaticSend"
type TextFileReader ¶
type TextFileReader struct { PathInput string `json:"path_input"` Output string `json:"output"` Error string `json:"errors"` }
TextFileReader waits for the path of a file to read to arrive, the reads the file, and streams the lines of text to an output channel typed string, closing the output channel when done. If an error occurs, it stops reading and the error is sent to an error channel, which is not closed.
func (*TextFileReader) AssociateEditor ¶
func (r *TextFileReader) AssociateEditor(t *template.Template) error
AssociateEditor associates a template called "part_view" with the given template.
func (*TextFileReader) Channels ¶
func (r *TextFileReader) Channels() (read, written source.StringSet)
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*TextFileReader) Clone ¶
func (r *TextFileReader) Clone() interface{}
Clone returns a copy of this part.
func (*TextFileReader) Help ¶
func (*TextFileReader) Help() template.HTML
Help returns useful help information.
func (*TextFileReader) Impl ¶
func (r *TextFileReader) Impl() (head, body, tail string)
Impl returns Go source code implementing the part.
func (*TextFileReader) Imports ¶
func (*TextFileReader) Imports() []string
Imports returns any extra import lines needed.
func (*TextFileReader) RenameChannel ¶
func (r *TextFileReader) RenameChannel(from, to string)
RenameChannel renames any uses of the channel "from" to the channel "to".
func (*TextFileReader) TypeKey ¶
func (*TextFileReader) TypeKey() string
TypeKey returns the string "TextFileReader"
type Unslicer ¶
Unslicer ranges over items that arrive via the input, and sends them individually to the output.
func (*Unslicer) AssociateEditor ¶
AssociateEditor associates a template called "part_view" with the given template.
func (*Unslicer) Channels ¶
Channels returns any channels used. Anything returned that is not a channel is ignored.
func (*Unslicer) RenameChannel ¶
RenameChannel renames any uses of the channel "from" to the channel "to".