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 ¶
- type Change
- type Document
- func (d Document) BeginTransaction() (*DocumentTransaction, error)
- func (d Document) Bytes() (int, error)
- func (d Document) FirstByte() (value byte, found bool, err error)
- func (d Document) GapHandle(index int) (*DocumentGapHandle, error)
- func (d Document) LastByte() (value byte, found bool, err error)
- func (d Document) LeafBytes(index int) (int, error)
- func (d Document) LeafHandle(index int) (*DocumentLeafHandle, error)
- func (d Document) Leaves() (int, error)
- func (d Document) SameRoot(other Document) (bool, error)
- func (d Document) String() (string, error)
- func (d Document) ValidateAuthentication() error
- func (d Document) WriteTo(writer io.Writer) (int64, error)
- type DocumentBuilder
- func (b *DocumentBuilder) AppendDocument(document Document) error
- func (b *DocumentBuilder) AppendOutput(output Output) error
- func (b *DocumentBuilder) AppendTextFragment(fragment TextFragment) error
- func (b *DocumentBuilder) Build(previous *Document) (Document, error)
- func (b *DocumentBuilder) Grow(n int)
- func (b *DocumentBuilder) Write(value []byte) (int, error)
- func (b *DocumentBuilder) WriteString(value string) (int, error)
- type DocumentDelta
- type DocumentGapHandle
- type DocumentLeafChange
- type DocumentLeafHandle
- type DocumentTransaction
- func (t *DocumentTransaction) Commit() (Document, *DocumentDelta, error)
- func (t *DocumentTransaction) Delete(expected *DocumentLeafHandle) error
- func (t *DocumentTransaction) InsertDocument(expected *DocumentGapHandle, document Document) error
- func (t *DocumentTransaction) InsertText(expected *DocumentGapHandle, text string) error
- func (t *DocumentTransaction) ReplaceDocument(expected *DocumentLeafHandle, document Document) error
- func (t *DocumentTransaction) ReplaceText(expected *DocumentLeafHandle, text string) error
- type Output
- func (o Output) Apply(changes []Change) (Output, error)
- func (o Output) Bytes() (int, error)
- func (o Output) Delete(key string) (Output, error)
- func (o Output) FirstByte() (value byte, found bool, err error)
- func (o Output) Get(key string) (text string, found bool, err error)
- func (o Output) LastByte() (value byte, found bool, err error)
- func (o Output) Parts() (int, error)
- func (o Output) SameRoot(other Output) (bool, error)
- func (o Output) String() (string, error)
- func (o Output) ValidateAuthentication() error
- func (o Output) Walk(visit func(key, text string) error) error
- func (o Output) WalkText(visit func(text string) error) error
- func (o Output) WithText(key, text string) (Output, error)
- func (o Output) WriteTo(writer io.Writer) (int64, error)
- type TextFragment
- func (f TextFragment) Apply(changes []TextFragmentChange) (TextFragment, error)
- func (f TextFragment) Bytes() (int, error)
- func (f TextFragment) Delete(key string) (TextFragment, error)
- func (f TextFragment) FirstByte() (value byte, present bool, err error)
- func (f TextFragment) Get(key string) (text string, present bool, err error)
- func (f TextFragment) LastByte() (value byte, present bool, err error)
- func (f TextFragment) Parts() (int, error)
- func (f TextFragment) SameRoot(other TextFragment) (bool, error)
- func (f TextFragment) String() (string, error)
- func (f TextFragment) ValidateAuthentication() error
- func (f TextFragment) Walk(visit func(key, text string) error) error
- func (f TextFragment) WithDelimiter(delimiter string) (TextFragment, error)
- func (f TextFragment) WithPart(key, text string) (TextFragment, error)
- func (f TextFragment) WriteTo(writer io.Writer) (int64, error)
- type TextFragmentChange
- type TextPart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) GapHandle ¶
func (d Document) GapHandle(index int) (*DocumentGapHandle, error)
GapHandle returns a proof for the top-level insertion gap at index.
func (Document) LeafHandle ¶
func (d Document) LeafHandle(index int) (*DocumentLeafHandle, error)
LeafHandle returns a proof for the top-level leaf at index.
func (Document) SameRoot ¶
SameRoot reports exact structural identity after authenticating both documents.
func (Document) ValidateAuthentication ¶
ValidateAuthentication verifies the exact immutable root in constant time.
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 ¶
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 ¶
func (t *DocumentTransaction) Commit() (Document, *DocumentDelta, error)
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 FromSorted ¶
FromSorted constructs an output from strictly increasing keys.
func (Output) SameRoot ¶
SameRoot reports exact structural identity after authenticating both values.
func (Output) ValidateAuthentication ¶
ValidateAuthentication verifies the exact immutable root in constant time.
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.
type TextFragmentChange ¶
TextFragmentChange replaces or deletes one keyed part.