util

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPCRequestIDMetadataKey = "request-id"
)

Variables

This section is empty.

Functions

func AudienceEquals

func AudienceEquals(a, b *protos.Audience) bool

func AudienceFromStr

func AudienceFromStr(s string) *protos.Audience

AudienceFromStr will parse a string into an Audience. If the string is invalid, nil will be returned.

func AudienceToStr

func AudienceToStr(audience *protos.Audience) string

func ConvertConfigStrAudience

func ConvertConfigStrAudience(config map[*protos.Audience][]string) map[string]*protos.GetAllResponsePipelines

func CounterName

func CounterName(name string, labels map[string]string) string

func CtxMetadata

func CtxMetadata(ctx context.Context) map[string]string

CtxMetadata will return a map[string]string of the metadata in the given context (if md exists). NOTE: Will use only first value in metadata value slice.

func CtxRequestId

func CtxRequestId(ctx context.Context) string

func CtxStringValue

func CtxStringValue(ctx context.Context, key string) string

func GenInferSchemaPipeline

func GenInferSchemaPipeline(aud *protos.Audience) *protos.Command

func GenerateKVRequest

func GenerateKVRequest(action shared.KVAction, kvs []*protos.KVObject, overwrite bool) *protos.KVRequest

GenerateKVRequest is used for converting from plain KVObjects to instructions. This func is used to simplify transforming KV HTTP requests -> KV broadcast requests.

func GenerateNodeID added in v0.0.10

func GenerateNodeID(installID, nodeName string) string

GenerateNodeID will generate a uuid node ID from the given install ID and node name This ensures that the node ID is deterministic and consistent across restarts since we have no local storage.

func GenerateUUID

func GenerateUUID() string

func GenerateWasmMapping

func GenerateWasmMapping(commands ...*protos.Command) map[string]*protos.WasmModule

GenerateWasmMapping will generate a map of WASM modules from the given command(s). NOTE: This is primarily useful for commands that have Steps which contain Wasm fields (like AttachCommand). For commands that do not have Steps w/ Wasm, this will do nothing.

func GetStepSubType added in v0.0.10

func GetStepSubType(step *protos.PipelineStep) string

GetStepSubType transforms a protobuf enum into a string for use with telemetry This is used for detective, transform, and KV steps.

func GetStepType added in v0.0.10

func GetStepType(step *protos.PipelineStep) string

GetStepType transforms a protobuf enum of a step type into a string for use with telemetry

func GrpcMethodCounterName added in v0.0.10

func GrpcMethodCounterName(method string) string

GrpcMethodCounterName turns a gRPC method name into a counter name for statsd This turns a string such as "/protos.External/GetSchema" into "grpc_method_external_get_schema_total"

func ParseConfigKey

func ParseConfigKey(key string) (*protos.Audience, string)

func Pointer added in v0.0.10

func Pointer[T any](val T) *T

func PopulateWASMFields

func PopulateWASMFields(pipeline *protos.Pipeline, prefix string) error

func StandardResponse

func StandardResponse(ctx context.Context, code protos.ResponseCode, msg string) *protos.StandardResponse

func StripWASMFields

func StripWASMFields(pipeline *protos.Pipeline)

Types

This section is empty.

Jump to

Keyboard shortcuts

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