rendercontent

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package rendercontent holds the value types a render produces — Output, TextFragment, Document — and the deltas between two of them. The renderer and the dataplane both speak these types; neither HAProxy vocabulary nor Kubernetes vocabulary appears here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Key  string
	Text string
}

Change replaces one ordered part. Empty text deletes the part.

type Document

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

Document is an authenticated immutable concatenation of retained text roots.

func EmptyDocument

func EmptyDocument() Document

EmptyDocument returns the authenticated empty document.

func (Document) BeginTransaction

func (d Document) BeginTransaction() (*DocumentTransaction, error)

BeginTransaction starts an atomic edit against this exact document root.

func (Document) Bytes

func (d Document) Bytes() (int, error)

Bytes returns the complete document length.

func (Document) FirstByte

func (d Document) FirstByte() (value byte, found bool, err error)

FirstByte returns the initial byte without materializing the document.

func (Document) GapHandle

func (d Document) GapHandle(index int) (*DocumentGapHandle, error)

GapHandle returns a proof for the top-level insertion gap at index.

func (Document) LastByte

func (d Document) LastByte() (value byte, found bool, err error)

LastByte returns the final byte without materializing the document.

func (Document) LeafBytes

func (d Document) LeafBytes(index int) (int, error)

LeafBytes returns the byte length of one top-level retained fragment.

func (Document) LeafHandle

func (d Document) LeafHandle(index int) (*DocumentLeafHandle, error)

LeafHandle returns a proof for the top-level leaf at index.

func (Document) Leaves

func (d Document) Leaves() (int, error)

Leaves returns the number of retained fragments.

func (Document) SameRoot

func (d Document) SameRoot(other Document) (bool, error)

SameRoot reports exact structural identity after authenticating both documents.

func (Document) String

func (d Document) String() (string, error)

String materializes the exact document once for this root.

func (Document) ValidateAuthentication

func (d Document) ValidateAuthentication() error

ValidateAuthentication verifies the exact immutable root in constant time.

func (Document) WriteTo

func (d Document) WriteTo(writer io.Writer) (int64, error)

WriteTo streams every retained fragment in order.

type DocumentBuilder

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

DocumentBuilder builds one immutable document while retaining authenticated children.

func (*DocumentBuilder) AppendDocument

func (b *DocumentBuilder) AppendDocument(document Document) error

AppendDocument retains an authenticated child document.

func (*DocumentBuilder) AppendOutput

func (b *DocumentBuilder) AppendOutput(output Output) error

AppendOutput retains an authenticated keyed output root.

func (*DocumentBuilder) AppendTextFragment

func (b *DocumentBuilder) AppendTextFragment(fragment TextFragment) error

AppendTextFragment retains an authenticated ordered text fragment.

func (*DocumentBuilder) Build

func (b *DocumentBuilder) Build(previous *Document) (Document, error)

Build seals the document and reuses previous when every exact leaf is unchanged.

func (*DocumentBuilder) Grow

func (b *DocumentBuilder) Grow(n int)

Grow reserves capacity for n more bytes of pending literal text. A hint only: a wrong n costs nothing but the usual growth.

func (*DocumentBuilder) Write

func (b *DocumentBuilder) Write(value []byte) (int, error)

Write copies bytes into the pending literal fragment.

func (*DocumentBuilder) WriteString

func (b *DocumentBuilder) WriteString(value string) (int, error)

WriteString appends immutable literal text.

type DocumentDelta

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

DocumentDelta is an authenticated transition between exact document roots.

func (*DocumentDelta) Apply

func (d *DocumentDelta) Apply(base Document) (Document, error)

Apply returns the authenticated next root only for this delta's exact base.

func (*DocumentDelta) Changes

func (d *DocumentDelta) Changes() ([]DocumentLeafChange, error)

Changes returns authenticated leaf documents for only the changed positions.

func (*DocumentDelta) RequiresFullValidation

func (d *DocumentDelta) RequiresFullValidation() (bool, error)

RequiresFullValidation reports insertions and deletions whose consumers need a full rebuild.

func (*DocumentDelta) SameRoot

func (d *DocumentDelta) SameRoot() (bool, error)

SameRoot reports whether the delta leaves the exact document unchanged.

func (*DocumentDelta) ValidateAuthentication

func (d *DocumentDelta) ValidateAuthentication() error

ValidateAuthentication verifies the exact base and next roots.

type DocumentGapHandle

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

DocumentGapHandle authenticates one exact gap between top-level leaves.

type DocumentLeafChange

type DocumentLeafChange struct {
	Index  int
	Before Document
	After  Document
}

DocumentLeafChange is one exact top-level leaf transition. A zero Document is absent.

type DocumentLeafHandle

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

DocumentLeafHandle authenticates one exact top-level leaf and its position.

type DocumentTransaction

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

DocumentTransaction atomically path-copies edits from one exact base root.

func (*DocumentTransaction) Commit

Commit seals the next root and its exact base-to-next proof.

func (*DocumentTransaction) Delete

func (t *DocumentTransaction) Delete(expected *DocumentLeafHandle) error

Delete removes the exact leaf proven by expected.

func (*DocumentTransaction) InsertDocument

func (t *DocumentTransaction) InsertDocument(
	expected *DocumentGapHandle,
	document Document,
) error

InsertDocument inserts a child document at the exact gap proven by expected.

func (*DocumentTransaction) InsertText

func (t *DocumentTransaction) InsertText(expected *DocumentGapHandle, text string) error

InsertText inserts literal text at the exact gap proven by expected.

func (*DocumentTransaction) ReplaceDocument

func (t *DocumentTransaction) ReplaceDocument(
	expected *DocumentLeafHandle,
	document Document,
) error

ReplaceDocument replaces the leaf proven by expected with a child document.

func (*DocumentTransaction) ReplaceText

func (t *DocumentTransaction) ReplaceText(expected *DocumentLeafHandle, text string) error

ReplaceText replaces the leaf proven by expected with literal text.

type Output

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

Output is an authenticated immutable ordered text sequence.

func Empty

func Empty() Output

Empty returns an authenticated empty output.

func FromSorted

func FromSorted(parts []Change) (Output, error)

FromSorted constructs an output from strictly increasing keys.

func (Output) Apply

func (o Output) Apply(changes []Change) (Output, error)

Apply replaces a set of parts atomically.

func (Output) Bytes

func (o Output) Bytes() (int, error)

Bytes returns the complete output length.

func (Output) Delete

func (o Output) Delete(key string) (Output, error)

Delete removes one part and returns the same output when it was absent.

func (Output) FirstByte

func (o Output) FirstByte() (value byte, found bool, err error)

FirstByte returns the first output byte without materializing the output.

func (Output) Get

func (o Output) Get(key string) (text string, found bool, err error)

Get returns one part without materializing the complete output.

func (Output) LastByte

func (o Output) LastByte() (value byte, found bool, err error)

LastByte returns the last output byte without materializing the output.

func (Output) Parts

func (o Output) Parts() (int, error)

Parts returns the number of non-empty text parts.

func (Output) SameRoot

func (o Output) SameRoot(other Output) (bool, error)

SameRoot reports exact structural identity after authenticating both values.

func (Output) String

func (o Output) String() (string, error)

String materializes the output once for this immutable root.

func (Output) ValidateAuthentication

func (o Output) ValidateAuthentication() error

ValidateAuthentication verifies the exact immutable root in constant time.

func (Output) Walk

func (o Output) Walk(visit func(key, text string) error) error

Walk visits non-empty parts in key order.

func (Output) WalkText

func (o Output) WalkText(visit func(text string) error) error

WalkText visits non-empty text in key order.

func (Output) WithText

func (o Output) WithText(key, text string) (Output, error)

WithText replaces one part and path-copies only the affected search path.

func (Output) WriteTo

func (o Output) WriteTo(writer io.Writer) (int64, error)

WriteTo streams the output without creating an intermediate string.

type TextFragment

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

TextFragment is an authenticated immutable ordered text sequence.

func EmptyTextFragment

func EmptyTextFragment() TextFragment

EmptyTextFragment returns an authenticated fragment without present parts.

func TextFragmentFromSorted

func TextFragmentFromSorted(parts []TextPart) (TextFragment, error)

TextFragmentFromSorted constructs a fragment from strictly increasing keys.

func (TextFragment) Apply

func (f TextFragment) Apply(changes []TextFragmentChange) (TextFragment, error)

Apply replaces and deletes a set of parts atomically.

func (TextFragment) Bytes

func (f TextFragment) Bytes() (int, error)

Bytes returns the serialized fragment length.

func (TextFragment) Delete

func (f TextFragment) Delete(key string) (TextFragment, error)

Delete removes one part and returns the same fragment when it was absent.

func (TextFragment) FirstByte

func (f TextFragment) FirstByte() (value byte, present bool, err error)

FirstByte returns the initial serialized byte without materializing the fragment.

func (TextFragment) Get

func (f TextFragment) Get(key string) (text string, present bool, err error)

Get returns one part without materializing the complete fragment.

func (TextFragment) LastByte

func (f TextFragment) LastByte() (value byte, present bool, err error)

LastByte returns the final serialized byte without materializing the fragment.

func (TextFragment) Parts

func (f TextFragment) Parts() (int, error)

Parts returns the number of present parts, including empty ones.

func (TextFragment) SameRoot

func (f TextFragment) SameRoot(other TextFragment) (bool, error)

SameRoot reports exact structural identity after authenticating both fragments.

func (TextFragment) String

func (f TextFragment) String() (string, error)

String materializes the fragment once for this immutable root and delimiter.

func (TextFragment) ValidateAuthentication

func (f TextFragment) ValidateAuthentication() error

ValidateAuthentication verifies the exact immutable root in constant time.

func (TextFragment) Walk

func (f TextFragment) Walk(visit func(key, text string) error) error

Walk visits every present part in key order, including empty parts.

func (TextFragment) WithDelimiter

func (f TextFragment) WithDelimiter(delimiter string) (TextFragment, error)

WithDelimiter returns a view that writes delimiter between present parts.

func (TextFragment) WithPart

func (f TextFragment) WithPart(key, text string) (TextFragment, error)

WithPart replaces one present part and path-copies its search path.

func (TextFragment) WriteTo

func (f TextFragment) WriteTo(writer io.Writer) (int64, error)

WriteTo streams the fragment without creating an intermediate string.

type TextFragmentChange

type TextFragmentChange struct {
	Key     string
	Text    string
	Present bool
}

TextFragmentChange replaces or deletes one keyed part.

type TextPart

type TextPart struct {
	Key  string
	Text string
}

TextPart is one present keyed part, including when Text is empty.

Jump to

Keyboard shortcuts

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