Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Destination ¶
Destination is an interface that writes data to data storage, messaging queue or something like that.
type Hatchery ¶
type Hatchery struct {
// contains filtered or unexported fields
}
Hatchery is a main manager of this tool.
type Option ¶
type Option func(*Hatchery)
func WithLogger ¶
WithLogger is an option to set a logger to the hatchery. The logger is used to log messages from the hatchery. This option is prioritized over other settings (e.g. CLI option)
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe is a struct that contains a destination. It is middle layer between source and destination and source function receives the Pipe object as the argument. This has a Spout method that outputs the data from the source to the destination.
Example:
func someSource(ctx context.Context, p *hatchery.Pipe) error { var r io.ReadCloser // // Load data from somewhere to r // defer r.Close() return p.Spout(ctx, r, metadata.MetaData{}) }
func NewPipe ¶
func NewPipe(dst Destination) *Pipe
NewPipe creates a new Pipe object with the destination. It is for testing.
type Source ¶
Source is an interface that loads data from a source to a destination. The function loads data from a source to a destination. It should be called periodically to get data from the source. The interval of calling Load depends on command execution of hatchery.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is a pipeline of data processing.
func NewStream ¶
func NewStream(src Source, dst Destination, options ...StreamOption) *Stream
NewStream creates a new Stream object with source and destination. It can be customized by options.
type StreamOption ¶
type StreamOption func(*Stream)
func WithID ¶
func WithID(id string) StreamOption
WithID is an option to set ID to the stream. If not set, it will be generated by UUID.
func WithTags ¶
func WithTags(tags ...string) StreamOption
WithTags is an option to set tags to the stream.