luci: go.chromium.org/luci/config/server/cfgclient/backend/format Index | Files

package format

import "go.chromium.org/luci/config/server/cfgclient/backend/format"

Package format implements a config client Backend that performs formatting on items.

The available formats are registered during init() time via 'Register'.

Index

Package Files

format.go formatters.go

func ClearRegistry Uses

func ClearRegistry()

ClearRegistry removes all registered formatters.

Useful in tests that call Register to setup initial state.

func Register Uses

func Register(rk string, f Formatter)

Register registers a Formatter implementation for given format.

If the supplied key is already registered, Register will panic.

type Backend Uses

type Backend struct {
    // B is the underlying Backend that this Backend will pull data
    // from.
    backend.B
}

Backend is a backend.B implementation that applies Formatter transformations to the various Items that pass through it.

Formatter transformations are registered explicitly to the Resolver descriptions of the types that they operate on. If an Item is already formatted, no further transformations will be applied.

func (*Backend) Get Uses

func (b *Backend) Get(c context.Context, configSet config.Set, path string, p backend.Params) (*config.Config, error)

Get implements backend.B.

func (*Backend) GetAll Uses

func (b *Backend) GetAll(c context.Context, t backend.GetAllTarget, path string, p backend.Params) (
    []*config.Config, error)

GetAll implements backend.B.

type Formatter Uses

type Formatter interface {
    FormatItem(c, fd string) (string, error)
}

Formatter applies a transformation to the data's cached representation.

The Formatter is supplied with the content to format along with the formatter-specific metadata, fd.

Formatter operates on a config.Config's Content via the "format" Backend.

Package format imports 6 packages (graph) and is imported by 2 packages. Updated 2018-10-21. Refresh now. Tools for package owners.