Documentation
¶
Index ¶
- func TimeseriesMergeFuncFromBytes(unmarshaler timeseries.UnmarshalerFunc) func(*Accumulator, []byte, int) error
- type Accumulator
- func (a *Accumulator) GetGeneric() any
- func (a *Accumulator) GetGenericUnsafe() any
- func (a *Accumulator) GetTSData() timeseries.Timeseries
- func (a *Accumulator) Lock()
- func (a *Accumulator) SetGeneric(data any)
- func (a *Accumulator) SetGenericUnsafe(data any)
- func (a *Accumulator) SetTSData(data timeseries.Timeseries)
- func (a *Accumulator) Unlock()
- type MarshallerPtr
- type MergeFunc
- type MergeFuncLookup
- type MergeFuncPair
- type Mergeable
- type RespondFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TimeseriesMergeFuncFromBytes ¶
func TimeseriesMergeFuncFromBytes(unmarshaler timeseries.UnmarshalerFunc) func(*Accumulator, []byte, int) error
TimeseriesMergeFuncFromBytes creates a MergeFunc that accepts []byte and unmarshals it This is a convenience function for call sites that still have []byte
Types ¶
type Accumulator ¶
type Accumulator struct {
// contains filtered or unexported fields
}
Accumulator is a thread-safe accumulator for merging data It can hold either timeseries.Timeseries or any other mergeable type
func (*Accumulator) GetGeneric ¶
func (a *Accumulator) GetGeneric() any
GetGeneric returns the accumulated generic data (thread-safe)
func (*Accumulator) GetGenericUnsafe ¶
func (a *Accumulator) GetGenericUnsafe() any
GetGenericUnsafe returns the generic data without locking (caller must hold lock)
func (*Accumulator) GetTSData ¶
func (a *Accumulator) GetTSData() timeseries.Timeseries
GetTSData returns the accumulated timeseries data (thread-safe)
func (*Accumulator) Lock ¶
func (a *Accumulator) Lock()
Lock locks the accumulator's mutex (for use by merge functions)
func (*Accumulator) SetGeneric ¶
func (a *Accumulator) SetGeneric(data any)
SetGeneric sets the accumulated generic data (thread-safe)
func (*Accumulator) SetGenericUnsafe ¶
func (a *Accumulator) SetGenericUnsafe(data any)
SetGenericUnsafe sets the generic data without locking (caller must hold lock)
func (*Accumulator) SetTSData ¶
func (a *Accumulator) SetTSData(data timeseries.Timeseries)
SetTSData sets the accumulated timeseries data (thread-safe)
func (*Accumulator) Unlock ¶
func (a *Accumulator) Unlock()
Unlock unlocks the accumulator's mutex (for use by merge functions)
type MarshallerPtr ¶
MarshallerPtr represents pointer types that can start marshaling with an envelope
type MergeFunc ¶
type MergeFunc func(*Accumulator, any, int) error
MergeFunc is a function type that merges unmarshaled data into an accumulator It takes the accumulator, unmarshaled data (either timeseries.Timeseries or a type conforming to Mergeable[T]), and index, and returns an error
func TimeseriesMergeFunc ¶
func TimeseriesMergeFunc(unmarshaler timeseries.UnmarshalerFunc) MergeFunc
TimeseriesMergeFunc creates a MergeFunc for timeseries data The returned function accepts a timeseries.Timeseries and merges it into the accumulator
type MergeFuncLookup ¶
type MergeFuncLookup map[string]*MergeFuncPair
type MergeFuncPair ¶
type MergeFuncPair struct {
Merge MergeFunc
Respond RespondFunc
}
type Mergeable ¶
type Mergeable[T any] interface { *T Merge(...*T) }
Mergeable represents types that can merge with other instances of the same type
type RespondFunc ¶
type RespondFunc func(http.ResponseWriter, *http.Request, *Accumulator, int)
RespondFunc is a function type that writes the merged result to the response writer It takes the response writer, request, accumulator, and status code
func TimeseriesRespondFunc ¶
func TimeseriesRespondFunc(marshaler timeseries.MarshalWriterFunc, requestOptions *timeseries.RequestOptions) RespondFunc
TimeseriesRespondFunc creates a RespondFunc for timeseries data It writes the merged timeseries using the marshaler