Documentation
¶
Index ¶
- Constants
- func ChartToEnvoyNode(r *types.Chart) (node *envoyx.Node, err error)
- func ModuleFieldToEnvoyNode(r *types.ModuleField) (node *envoyx.Node, err error)
- func ModuleToEnvoyNode(r *types.Module) (node *envoyx.Node, err error)
- func NamespaceToEnvoyNode(r *types.Namespace) (node *envoyx.Node, err error)
- func PageLayoutToEnvoyNode(r *types.PageLayout) (node *envoyx.Node, err error)
- func PageToEnvoyNode(r *types.Page) (node *envoyx.Node, err error)
- type CsvEncoder
- type RecordDatasource
- func (rd *RecordDatasource) AddRef(id uint64, idents ...string)
- func (rd *RecordDatasource) Next(ctx context.Context, out map[string]string) (ident []string, more bool, err error)
- func (rd *RecordDatasource) Reset(ctx context.Context) (err error)
- func (rd *RecordDatasource) ResolveRef(ref ...any) (out uint64, err error)
- func (rd *RecordDatasource) ResolveRefS(ref ...string) (out uint64, err error)
- func (rd *RecordDatasource) SetProvider(s envoyx.Provider) bool
- type StoreDecoder
- type StoreEncoder
- type YamlDecoder
- type YamlEncoder
Constants ¶
const (
ComposeRecordDatasourceAuxType = "corteza::compose:record-datasource"
)
Variables ¶
This section is empty.
Functions ¶
func ModuleFieldToEnvoyNode ¶
func ModuleFieldToEnvoyNode(r *types.ModuleField) (node *envoyx.Node, err error)
func NamespaceToEnvoyNode ¶
func PageLayoutToEnvoyNode ¶
func PageLayoutToEnvoyNode(r *types.PageLayout) (node *envoyx.Node, err error)
Types ¶
type CsvEncoder ¶
type CsvEncoder struct{}
type RecordDatasource ¶
type RecordDatasource struct { Mapping envoyx.DatasourceMapping Provider envoyx.Provider CheckExisting func(ctx context.Context, ref ...[]string) ([]uint64, error) // contains filtered or unexported fields }
RecordDatasource provides a mechanism for you to access large record datasets optimally
func (*RecordDatasource) AddRef ¶
func (rd *RecordDatasource) AddRef(id uint64, idents ...string)
@todo this should be replaced by some smarter structure
func (*RecordDatasource) ResolveRef ¶
func (rd *RecordDatasource) ResolveRef(ref ...any) (out uint64, err error)
func (*RecordDatasource) ResolveRefS ¶
func (rd *RecordDatasource) ResolveRefS(ref ...string) (out uint64, err error)
func (*RecordDatasource) SetProvider ¶
func (rd *RecordDatasource) SetProvider(s envoyx.Provider) bool
type StoreDecoder ¶
type StoreDecoder struct{}
StoreDecoder is responsible for generating Envoy nodes from already stored resources which can then be managed by Envoy and imported via an encoder.
func (StoreDecoder) Decode ¶
func (d StoreDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)
Decode returns a set of envoy nodes based on the provided params
StoreDecoder expects the DecodeParam of `storer` and `dal` which conform to the store.Storer and dal.FullService interfaces.
type StoreEncoder ¶
type StoreEncoder struct{}
StoreEncoder is responsible for encoding Corteza resources into the database via the Storer or the DAL interface
@todo consider having a different encoder for the DAL resources
func (StoreEncoder) Encode ¶
func (e StoreEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tree envoyx.Traverser) (err error)
Encode encodes the given Corteza resources into the primary store
Encoding should not do any additional processing apart from matching with dependencies and runtime validation
The Encode function is called for every resource type where the resource appears at the root of the dependency tree. All of the root-level resources for that resource type are passed into the function. The encoding function must traverse the branches to encode all of the dependencies.
This flow is used to simplify the flow of how resources are encoded into YAML (and other documents) as well as to simplify batching.
Encode does not receive any placeholder nodes which are used solely for dependency resolution.
func (StoreEncoder) Prepare ¶
func (e StoreEncoder) Prepare(ctx context.Context, p envoyx.EncodeParams, rt string, nn envoyx.NodeSet) (err error)
Prepare performs some initial processing on the resource before it can be encoded
Preparation runs validation, default value initialization, matching with already existing instances, ...
The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.
Prepare does not receive any placeholder nodes which are used solely for dependency resolution.
type YamlDecoder ¶
type YamlDecoder struct{}
YamlDecoder is responsible for decoding YAML documents into Corteza resources which are then managed by envoy and imported via an encoder.
func (YamlDecoder) CanExt ¶
func (d YamlDecoder) CanExt(name string) (ok bool)
CanExt returns true if the provided file extension can be decoded with this decoder
func (YamlDecoder) CanFile ¶
func (d YamlDecoder) CanFile(f *os.File) (ok bool)
CanFile returns true if the provided file can be decoded with this decoder
func (YamlDecoder) Decode ¶
func (d YamlDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)
Decode returns a set of envoy nodes based on the provided params
YamlDecoder expects the DecodeParam of `stream` which conforms to the io.Reader interface.
type YamlEncoder ¶
type YamlEncoder struct{}
YamlEncoder is responsible for encoding Corteza resources into a YAML supported format
func (YamlEncoder) Encode ¶
func (e YamlEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tt envoyx.Traverser) (err error)
Encode encodes the given Corteza resources into some YAML supported format
Encoding should not do any additional processing apart from matching with dependencies and runtime validation
Preparation runs validation, default value initialization, matching with already existing instances, ...
The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.
Prepare does not receive any placeholder nodes which are used solely for dependency resolution.