binarychunk

package
v0.50.0-beta-1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MAXIMUM_CHUNK_SIZE = 1024 * 1024 * 50

Variables

View Source
var ErrBufferChunkFilled = errors.New("this buffer is already full")

Functions

This section is empty.

Types

type BinaryReference

type BinaryReference struct {
	Offset int `json:"offset"`
	Length int `json:"len"`
	Buffer int `json:"buffer"`
}

type Builder

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

Builder builds the list of binary data from given sequence of byte arrays.

func NewBuilder

func NewBuilder(compressor Compressor, tmpFolderPath string) *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, writer io.Writer, progress *inspectionmetadata.TaskProgressMetadata) (int, error)

Build amends all the binary buffers to the given writer in KHI format. Returns the written byte size.

func (*Builder) Read

func (b *Builder) Read(ref *BinaryReference) ([]byte, error)

func (*Builder) Write

func (b *Builder) Write(binaryBody []byte) (*BinaryReference, error)

Write amends the givenBinary in some binary chunk. If same body was given previously, it will return the reference from the cache.

type Compressor

type Compressor interface {
	// Compress reads all bytes from given reader and returns a reader for the compressed buffer.
	Compress(ctx context.Context, reader io.Reader) (io.ReadCloser, error)
}

type FileSystemBinaryWriter

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

FileSystemBinaryWriter is a basic implementation of the LargeTextWriter.

func NewFileSystemBinaryWriter

func NewFileSystemBinaryWriter(tmpPath string, bufferIndex int, maxSize int) (*FileSystemBinaryWriter, error)

func (*FileSystemBinaryWriter) ChunkReader

func (w *FileSystemBinaryWriter) ChunkReader() (io.ReadCloser, error)

func (*FileSystemBinaryWriter) Read

func (w *FileSystemBinaryWriter) Read(ref *BinaryReference) ([]byte, error)

func (*FileSystemBinaryWriter) Seal

func (w *FileSystemBinaryWriter) Seal() error

Seal implements LargeBinaryWriter.

func (*FileSystemBinaryWriter) Write

func (w *FileSystemBinaryWriter) Write(data []byte) (*BinaryReference, error)

type FileSystemGzipCompressor

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

func NewFileSystemGzipCompressor

func NewFileSystemGzipCompressor(temporaryFolder string) *FileSystemGzipCompressor

func (*FileSystemGzipCompressor) Compress

func (c *FileSystemGzipCompressor) Compress(ctx context.Context, reader io.Reader) (io.ReadCloser, error)

type LargeBinaryWriter

type LargeBinaryWriter interface {
	// Write the specified text and returns the BinaryReference
	Write(data []byte) (*BinaryReference, error)
	// Read buffer from a BinaryReference
	Read(ref *BinaryReference) ([]byte, error)
	// ChunkReader returns a read closer for the result binary chunk.
	ChunkReader() (io.ReadCloser, error)
	// Seal marks this writer done writing.
	Seal() error
}

LargeBinaryWriter stores text as a large binary chunk and returns BinaryReference points the buffer location.

Jump to

Keyboard shortcuts

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