Documentation
¶
Overview ¶
Package stdin is the stream source adapter ("stdin"): it reads one stream, such as standard input, whole and emits it as one chunk with Location kind stdin and target {stdin, stdin, unknown}.
Index ¶
Constants ¶
const DisplayName = "-"
DisplayName is the display name and Location path of standard input.
const Name = "stdin"
Name is the adapter name.
Variables ¶
var ErrNoReader = errors.New("stdin source: no reader")
ErrNoReader is returned for a spec without a reader.
var Target = model.Target{Kind: model.TargetStdin, ID: "stdin", Visibility: model.VisibilityUnknown}
Target is the target of a stream without a TargetID.
Functions ¶
Types ¶
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source reads one stream.
func (*Source) Scan ¶
func (s *Source) Scan(ctx context.Context, emit func(candidate.Chunk) bool, warn func(model.Warning)) error
Scan reads the whole stream and emits it as one chunk. A read error becomes a read_failed warning; a stream over the size limit emits nothing and becomes a file_too_large warning, and the rest of the stream is read and discarded. A read that blocks past ctx is abandoned: Scan returns ctx.Err() and the reading goroutine ends when the stream does.