Documentation
¶
Overview ¶
Package shared provides everything shared between entities.
Index ¶
- Variables
- func Decode(r io.Reader, v any) error
- func Encode(w io.Writer, v any) error
- func ExtractID[T any](t T, idFieldName string) string
- func Flatten2D[T any](data [][]T) []T
- func GenerateIDBasedOnContent(ct string) string
- func GenerateUUID() string
- func GetPaused() int32
- func Marshal(v any) ([]byte, error)
- func ReadAll(r io.Reader) ([]byte, error)
- func SetPaused(val int32)
- func Unmarshal(data []byte, v any) error
- type IMeta
- type IMetrics
- type Run
Constants ¶
This section is empty.
Variables ¶
View Source
var Paused int32 = 0
Paused is a flag that indicates if the pipeline is paused.
Functions ¶
func ExtractID ¶
ExtractID extracts `possibleIDFieldNames` from `v` - an arbitrary struct.
NOTE: Only exported fields are considered.
func Flatten2D ¶
func Flatten2D[T any](data [][]T) []T
Flatten2D takes a 2D slice and returns a 1D slice containing all the elements.
func GenerateIDBasedOnContent ¶
GenerateIDBasedOnContent generates MD5 hash (content-based) for message ID. Good to be used to avoid duplicated messages.
func GenerateUUID ¶
func GenerateUUID() string
GenerateUUID generates a RFC4122 UUID and DCE 1.1: Authentication and Security Services.
Types ¶
type IMeta ¶
type IMeta interface {
// GetName returns the `Name` of the entity.
GetName() string
// GetLogger returns the `Logger` of the entity.
GetLogger() sypl.ISypl
// GetDescription returns the `Description` of the processor.
GetDescription() string
// GetType returns the entity type.
GetType() string
}
IMeta defines what an `Entity` must do.
type IMetrics ¶
type IMetrics interface {
// GetCounterCreated returns the `CounterCreated` metric.
GetCounterCreated() *expvar.Int
// GetCounterRunning returns the `CounterRunning` metric.
GetCounterRunning() *expvar.Int
// GetCounterFailed returns the `CounterFailed` metric.
GetCounterFailed() *expvar.Int
// GetCounterDone returns the `CounterDone` metric.
GetCounterDone() *expvar.Int
// GetStatus returns the `Status` metric.
GetStatus() *expvar.String
}
IMetrics defines how to interact with the metrics.
Click to show internal directories.
Click to hide internal directories.