{"modulePath":"github.com/wavetermdev/waveterm/wavesrv","version":"v0.7.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package bufferedpipe\n\nProvides a mechanism for writing data to a buffer and reading it later. The buffer is stored in a map of buffered pipes, which are removed after a certain amount of time. The output of a buffered pipe can be read by sending a GET request to a specific URL.\n\n## Constants\n\n```go\nconst (\n\tBufferedPipeMapTTL    = 30 * time.Second     // The time-to-live for a buffered pipe in the map of buffered pipes.\n\tBufferedPipeGetterUrl = \"/api/buffered-pipe\" // The URL for getting the output of a buffered pipe.\n)\n```\n\n## Functions\n\n```go\nfunc HandleGetBufferedPipeOutput(w http.ResponseWriter, r *http.Request)\n```\nHandle a HTTP GET request to get the output of a buffered pipe, given a key.\n\n```go\nfunc SetBufferedPipe(pipe *BufferedPipe)\n```\nSet a buffered pipe in the map of buffered pipes.\n\n## Types\n\n```go\ntype BufferedPipe struct {\n\tKey string // a unique key for the pipe\n\t// contains filtered or unexported fields\n}\n```\nA pipe that allows for lazy writing to a downstream writer. Data written to the pipe is buffered until WriteTo is called.\n\n```go\nfunc GetBufferedPipe(key string) (*BufferedPipe, bool)\n```\nGet a buffered pipe from the map of buffered pipes, given a key.\n\n```go\nfunc NewBufferedPipe(timeout time.Duration) *BufferedPipe\n```\nCreate a new BufferedPipe with a timeout. The writer will be closed after the timeout\n\n```go\nfunc (pipe *BufferedPipe) Close() error\n```\nClose the pipe. This will cause any blocking WriteTo calls to return.\n\n```go\nfunc (pipe *BufferedPipe) GetOutputUrl() (string, error)\n```\nGet the URL for reading the output of the pipe.\n\n```go\nfunc (pipe *BufferedPipe) Write(p []byte) (n int, err error)\n```\nWrite data to the buffer.\n\n```go\nfunc (pipe *BufferedPipe) WriteTo(w io.Writer) (n int64, err error)\n```\nWrite all buffered data to a waiting writer and block, sending all subsequent data until the pipe is closed. Only one goroutine should call this method.\n\n```go\ntype BufferedPipeMap struct {\n\t// contains filtered or unexported fields\n}\n```\n\n","path":"github.com/wavetermdev/waveterm/wavesrv/pkg/bufferedpipe","name":"bufferedpipe","synopsis":"Provides a mechanism for writing data to a buffer and reading it later.","isRedistributable":true}
