textproto

package
v0.0.0-...-1643519 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Overview

Package textproto implements a textproto config service Resolver.

It uses the "luci-go" text protobuf multi-line extension. For more information, see: go.chromium.org/luci/common/proto

The textproto protobuf Resolver internally formats its content as a binary protobuf, rather than its raw text content. This has some advantages over raw text content caching:

  • More space-efficient.
  • Decodes faster.
  • If the config service protobuf schema differs from the application's compiled schema, and the schema change is responsible (adding, renaming, repurposing) the binary cache value will continue to load where the text protobuf would fail.

Index

Constants

View Source
const BinaryFormat = "github.com/TriggerMail/luci-go/server/config/TextProto:binary"

BinaryFormat is the resolver's binary protobuf format string.

Variables

This section is empty.

Functions

func Message

func Message(out proto.Message) interface {
	cfgclient.Resolver
	cfgclient.FormattingResolver
}

Message is a cfgclient.Resolver that resolves config data into proto.Message instances by parsing the config data as a text protobuf.

func Slice

func Slice(out interface{}) interface {
	cfgclient.MultiResolver
	cfgclient.FormattingResolver
}

Slice is a cfgclient.MultiResolver which resolves a slice of configurations into a TextProto.

out must be a pointer to a slice of some proto.Message implementation. If it isn't, this function will panic.

For example:

var out []*MyProtoMessages
TextProtoSlice(&out)

Types

type Formatter

type Formatter struct{}

Formatter is a cfgclient.Formatter implementation bound to a specific protobuf message.

It takes a text protobuf representation of that message as input and returns a binary protobuf representation as output.

func (*Formatter) FormatItem

func (f *Formatter) FormatItem(c, fd string) (string, error)

FormatItem implements cfgclient.Formatter.

Jump to

Keyboard shortcuts

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