bpack

package
v0.0.0-...-2bab971 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxHeaderSize = 8 * 1024
)

Variables

View Source
var (
	DefaultPool = PackPool{}
)

Functions

func Release

func Release(p *Packer)

Types

type Dictionary

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

func (*Dictionary) Get

func (dict *Dictionary) Get(i int) (name []byte, value []byte)

Get field by index.

when length of name is 0, means not exist.

when length if value is 0, means name existed but value not exist.

func (*Dictionary) Index

func (dict *Dictionary) Index(name []byte, value []byte) (int, int)

Index get header field index, return i and j.

when i < 0, means not found.

when i > -1 and j > -1, means found field, the j is the field index.

when i > -1 and j < 0, means found field name, the i is the name index.

func (*Dictionary) Load

func (dict *Dictionary) Load(fields []HeaderField)

func (*Dictionary) Range

func (dict *Dictionary) Range(f func(i int, name []byte, value []byte) bool)

func (*Dictionary) Reset

func (dict *Dictionary) Reset()

type HeadValueIndex

type HeadValueIndex struct {
	Index  int
	Values map[string]int
}

type HeaderField

type HeaderField struct {
	Name  string
	Value []byte
}

type HeaderFields

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

func (*HeaderFields) Set

func (h *HeaderFields) Set(name []byte, value []byte) (err error)

type HeaderIterator

type HeaderIterator iter.Seq2[[]byte, []byte]

type HeaderWriter

type HeaderWriter interface {
	Set(key []byte, value []byte) error
}

type Option

type Option func(*Options) error

func Field

func Field(name string, values ...string) Option

func MaxHeaderSize

func MaxHeaderSize(n int) Option

type Options

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

type PackPool

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

func (*PackPool) Acquire

func (pp *PackPool) Acquire() *Packer

func (*PackPool) Release

func (pp *PackPool) Release(p *Packer)

type Packer

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

func Acquire

func Acquire() *Packer

func New

func New(options ...Option) (pack *Packer, err error)

func (*Packer) DumpTo

func (packer *Packer) DumpTo(w io.Writer) (err error)

func (*Packer) LoadFrom

func (packer *Packer) LoadFrom(r io.Reader) (err error)

func (*Packer) PackTo

func (packer *Packer) PackTo(w io.Writer, iter HeaderIterator) (err error)

func (*Packer) Reset

func (packer *Packer) Reset(fields []HeaderField)

func (*Packer) UnpackFrom

func (packer *Packer) UnpackFrom(r io.Reader, header HeaderWriter) (err error)

Jump to

Keyboard shortcuts

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