Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSink ¶
ByteSink represents a location to which bytes can be written. The ByteSink should be closed after all bytes have been written.
type FifoByteSink ¶
type FifoByteSink struct {
// contains filtered or unexported fields
}
Not safe for concurrent access, as writes to underlying pipe are atomic only if len(buf) is less than the OS-specific PIPE_BUF value.
func NewFifo ¶
func NewFifo() (*FifoByteSink, error)
NewFifo creates a FIFO pipe and returns a pointer to a FifoByteSink, which satisfies the ByteSink interface. The FIFO pipe is used to stream bytes to rust-fil-proofs from Go during the piece-adding flow. Writes to the pipe are buffered automatically by the OS; the size of the buffer varies.
func (*FifoByteSink) Close ¶
func (s *FifoByteSink) Close() (retErr error)
Close ensures that the underlying file is closed and removed.
func (*FifoByteSink) ID ¶
func (s *FifoByteSink) ID() string
Id produces a string-identifier for this byte sink. For now, this is just the path of the FIFO file. This string may get more structured in the future.
func (*FifoByteSink) Open ¶
func (s *FifoByteSink) Open() error
Open prepares the sink for writing by opening the backing FIFO file. Open will block until someone opens the FIFO file for reading.
func (*FifoByteSink) Write ¶
func (s *FifoByteSink) Write(buf []byte) (int, error)
Write writes the provided buffer to the underlying pipe. Write will block until the provided buffer's bytes have been read from the read end of the pipe.
Warning: Writes are atomic only if len(buf) is less than the OS-specific PIPE_BUF value. For more information, see:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html