package ctxio

Import Path
	github.com/jbenet/go-context/io (on go.dev)

Dependency Relation
	imports 2 packages, and imported by one package

Involved Source Files Package ctxio provides io.Reader and io.Writer wrappers that respect context.Contexts. Use these at the interface between your context code and your io. WARNING: read the code. see how writes and reads will continue until you cancel the io. Maybe this package should provide versions of io.ReadCloser and io.WriteCloser that automatically call .Close when the context expires. But for now -- since in my use cases I have long-lived connections with ephemeral io wrappers -- this has yet to be a need.
Package-Level Type Names (total 5, in which 2 are exported)
/* sort exporteds by: | */
( T) Read(p []byte) (n int, err error) github.com/aws/aws-sdk-go/aws.ReaderSeekerCloser github.com/go-git/go-billy/v5.File (interface) github.com/go-git/go-git/v5/plumbing/format/config.Decoder github.com/go-git/go-git/v5/plumbing/format/idxfile.Decoder *github.com/go-git/go-git/v5/plumbing/format/objfile.Reader *github.com/go-git/go-git/v5/plumbing/protocol/packp.UploadPackResponse *github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Demuxer *github.com/jackc/pgx/v4.LargeObject *bufio.Reader bufio.ReadWriter *bytes.Buffer *bytes.Reader *cloud.google.com/go/storage.Reader compress/flate.Reader (interface) *compress/gzip.Reader crypto/cipher.StreamReader *crypto/tls.Conn fmt.ScanState (interface) golang.org/x/crypto/ssh.Channel (interface) *golang.org/x/exp/rand.Rand golang.org/x/net/internal/socks.Conn *golang.org/x/text/transform.Reader *google.golang.org/grpc/internal/transport.Stream image/jpeg.Reader (interface) *internal/poll.FD *io.LimitedReader *io.PipeReader io.ReadCloser (interface) io.Reader (interface) io.ReadSeekCloser (interface) io.ReadSeeker (interface) io.ReadWriteCloser (interface) io.ReadWriter (interface) io.ReadWriteSeeker (interface) *io.SectionReader io/fs.File (interface) io/fs.ReadDirFile (interface) *math/rand.Rand mime/multipart.File (interface) *mime/multipart.Part *mime/quotedprintable.Reader *net.Buffers net.Conn (interface) *net.IPConn *net.TCPConn *net.UDPConn *net.UnixConn net/http.File (interface) *os.File *strings.Reader *vendor/golang.org/x/text/transform.Reader T : io.Reader
( T) Write(p []byte) (n int, err error) *github.com/cespare/xxhash/v2.Digest github.com/go-git/go-billy/v5.File (interface) github.com/go-git/go-git/v5/plumbing.Hasher *github.com/go-git/go-git/v5/plumbing.MemoryObject github.com/go-git/go-git/v5/plumbing/format/diff.UnifiedEncoder github.com/go-git/go-git/v5/plumbing/format/idxfile.Encoder *github.com/go-git/go-git/v5/plumbing/format/objfile.Writer *github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Muxer github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Progress (interface) *github.com/go-git/go-git/v5/storage/filesystem/dotgit.ObjectWriter *github.com/go-git/go-git/v5/storage/filesystem/dotgit.PackWriter *github.com/go-redis/redis/v8/internal/pool.Conn github.com/go-redis/redis/v8/internal/proto.Writer *github.com/jackc/pgx/v4.LargeObject github.com/yuin/goldmark/util.BufWriter (interface) bufio.ReadWriter *bufio.Writer *bytes.Buffer *cloud.google.com/go/storage.Writer *compress/flate.Writer *compress/gzip.Writer *compress/zlib.Writer crypto/cipher.StreamWriter *crypto/tls.Conn fmt.State (interface) *golang.org/x/crypto/poly1305.MAC golang.org/x/crypto/ssh.Channel (interface) *golang.org/x/net/http2/hpack.Decoder golang.org/x/net/internal/socks.Conn *golang.org/x/text/transform.Writer hash.Hash (interface) hash.Hash32 (interface) hash.Hash64 (interface) *internal/poll.FD *io.PipeWriter io.ReadWriteCloser (interface) io.ReadWriter (interface) io.ReadWriteSeeker (interface) io.WriteCloser (interface) io.Writer (interface) io.WriteSeeker (interface) *mime/quotedprintable.Writer net.Conn (interface) *net.IPConn *net.TCPConn *net.UDPConn *net.UnixConn net/http.ResponseWriter (interface) *net/http/httptest.ResponseRecorder net/http/internal.FlushAfterChunkWriter *os.File *strings.Builder *text/tabwriter.Writer *vendor/golang.org/x/crypto/poly1305.MAC *vendor/golang.org/x/net/http2/hpack.Decoder *vendor/golang.org/x/text/transform.Writer T : github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Progress T : io.Writer
Package-Level Functions (total 2, both are exported)
NewReader wraps a reader to make it respect given Context. If there is a blocking read, the returned Reader will return whenever the context is cancelled (the return values are n=0 and err=ctx.Err().) Note well: this wrapper DOES NOT ACTUALLY cancel the underlying write-- there is no way to do that with the standard go io interface. So the read and write _will_ happen or hang. So, use this sparingly, make sure to cancel the read or write as necesary (e.g. closing a connection whose context is up, etc.) Furthermore, in order to protect your memory from being read _before_ you've cancelled the context, this io.Reader will allocate a buffer of the same size, and **copy** into the client's if the read succeeds in time.
NewWriter wraps a writer to make it respect given Context. If there is a blocking write, the returned Writer will return whenever the context is cancelled (the return values are n=0 and err=ctx.Err().) Note well: this wrapper DOES NOT ACTUALLY cancel the underlying write-- there is no way to do that with the standard go io interface. So the read and write _will_ happen or hang. So, use this sparingly, make sure to cancel the read or write as necesary (e.g. closing a connection whose context is up, etc.) Furthermore, in order to protect your memory from being read _after_ you've cancelled the context, this io.Writer will first make a **copy** of the buffer.