blobs

package
v0.26.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: AGPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedBlobChannel = errors.New("send/receive on closed blob channel")
View Source
var NewBlob = blocks.NewBlock

Functions

func IncomingBlobChannel

func IncomingBlobChannel(maxBlobSize int) (*BlobChannelWriter, *BlobReceiver)

IncomingBlobChannel creates a BlobChannelWriter and BlobReceiver connected to the same underlying blob channel.

func OutgoingBlobChannel

func OutgoingBlobChannel() (*BlobChannelReader, *BlobSender)

OutgoingBlobChannel creates a BlobChannelReader and BlobSender connected to the same underlying blob channel.

Types

type Blob

type Blob = blocks.Block

type BlobChannelReader

type BlobChannelReader struct {
	// contains filtered or unexported fields
}

BlobChannelReader is a reader which reads data from a blob channel.

func (*BlobChannelReader) Close

func (br *BlobChannelReader) Close() error

Close closes the underlying blob channel.

func (*BlobChannelReader) Read

func (br *BlobChannelReader) Read(data []byte) (int, error)

Read reads up to len(data) bytes from the underlying blob channel into data. It returns the number of bytes read (0 <= n <= len(data)) and any error encountered. If some data is available but not len(data) bytes, Read will block until either enough data is available or an error occurs. This is in contrast to the conventional behavior which returns what is available instead of waiting for more.

func (*BlobChannelReader) ReadByte

func (br *BlobChannelReader) ReadByte() (byte, error)

ReadByte reads a single byte from the underlying blob channel. It returns an error if the byte could not be read.

func (*BlobChannelReader) TotalBytesRead

func (br *BlobChannelReader) TotalBytesRead() uint64

type BlobChannelWriter

type BlobChannelWriter struct {
	// contains filtered or unexported fields
}

BlobChannelWriter is a writer which splits the data written to it into blobs and sends them to a blob channel.

func (*BlobChannelWriter) Close

func (bw *BlobChannelWriter) Close() error

Close flushes any buffered data to the underlying blob channel and closes the blob channel.

func (*BlobChannelWriter) Flush

func (bw *BlobChannelWriter) Flush() error

Flush flushes any buffered data to the underlying blob channel as a new blob. It returns an error if the flush failed.

func (*BlobChannelWriter) TotalBytesWritten

func (bw *BlobChannelWriter) TotalBytesWritten() uint64

func (*BlobChannelWriter) Write

func (bw *BlobChannelWriter) Write(data []byte) (int, error)

Write writes len(data) bytes from data to the underlying blob channel. It returns the number of bytes written from data (0 <= n <= len(data)) and any error encountered that caused the write to stop early. It will always return a non-nil error if it returns n < len(data)

func (*BlobChannelWriter) WriteByte

func (bw *BlobChannelWriter) WriteByte(c byte) error

WriteByte writes a single byte to the underlying blob channel. It returns an error if the byte could not be written.

type BlobReceiver

type BlobReceiver struct {
	// contains filtered or unexported fields
}

BlobReceiver receives blobs from a blob channel.

func (*BlobReceiver) Close

func (br *BlobReceiver) Close() error

Close closes the underlying blob channel.

func (*BlobReceiver) Receive

func (br *BlobReceiver) Receive() (Blob, error)

Receive receives a blob from the blob channel. It returns ErrClosedBlobChannel if the channel is closed.

type BlobSender

type BlobSender struct {
	// contains filtered or unexported fields
}

BlobSender sends blobs to a blob channel.

func (*BlobSender) Close

func (bs *BlobSender) Close() error

Close closes the underlying blob channel.

func (*BlobSender) Send

func (bs *BlobSender) Send(blob Blob) error

Send sends a blob to the blob channel. It returns ErrClosedBlobChannel if the channel is closed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL