Documentation ¶
Index ¶
- Variables
- func BindContext[A any](ctx context.Context, f func(context.Context) A) func() A
- func BindContext2[A, B any](ctx context.Context, f func(context.Context) (A, B)) func() (A, B)
- func DecodeStruct[T any](input interface{}) (*T, error)
- func DeepCopy[T any](in *T) *T
- func DeepCopyInto[T any](out, in *T)
- func DialProtocol(ctx context.Context, addr string) (net.Conn, error)
- func FieldByName[T proto.Message](name string) protoreflect.FieldDescriptor
- func FieldIndexByName[T proto.Message](name string) int
- func GenerateRandomString(length int) []byte
- func HashString(s string) uint64
- func HashStrings(strings []string) string
- func Humanize(i any) (string, error)
- func Humanize1024(i any) (string, error)
- func Indexed[T any, U any](f func(T) U) func(T, int) U
- func IsInterfaceNil(i interface{}) bool
- func LoadClientMTLSConfig(certs *v1beta1.MTLSSpec) (*tls.Config, error)
- func LoadServingCertBundle(certsSpec v1beta1.CertsSpec) (*tls.Certificate, *x509.CertPool, error)
- func Must[T any](t T, err ...error) T
- func NewMessage[T proto.Message]() T
- func NewProtocolListener(addr string) (net.Listener, error)
- func ParsePEMEncodedCert(data []byte) (*x509.Certificate, error)
- func ParsePEMEncodedCertChain(chain []byte) ([]*x509.Certificate, error)
- func ProtoClone[T proto.Message](msg T) T
- func ReadString(r io.Reader) string
- func RemoveFirstOccurence[S ~[]T, T comparable](items S, remove T) S
- func ReplaceFirstOccurrence[S ~[]T, T comparable](items S, old T, new T) S
- func ServeHandler(ctx context.Context, handler http.Handler, listener net.Listener) error
- func SplitChunksWithLimit(request *prompb.WriteRequest, limit WriteLimit) ([]*prompb.WriteRequest, error)
- func StatusCode(err error) codes.Code
- func StatusError(code codes.Code) error
- func WaitAll(ctx context.Context, ca context.CancelFunc, channels ...<-chan error) error
- type DelimiterCodec
- type Initializer
- type LockMap
- type MultiErrGroup
- type ServicePack
- type ServicePackInterface
- type WriteLimit
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedProtocolScheme = errors.New("unsupported protocol scheme")
Functions ¶
func BindContext ¶ added in v0.5.4
func BindContext2 ¶ added in v0.5.4
func DecodeStruct ¶ added in v0.4.1
func DeepCopyInto ¶ added in v0.4.1
func DeepCopyInto[T any](out, in *T)
func DialProtocol ¶ added in v0.5.4
func FieldByName ¶ added in v0.12.0
func FieldByName[T proto.Message](name string) protoreflect.FieldDescriptor
func GenerateRandomString ¶ added in v0.3.1
func HashString ¶ added in v0.8.3
func HashStrings ¶ added in v0.8.3
func Humanize1024 ¶ added in v0.12.0
func Indexed ¶ added in v0.6.0
Used with lo.Map to wrap functions that do not take an index argument
func IsInterfaceNil ¶ added in v0.5.4
func IsInterfaceNil(i interface{}) bool
func LoadClientMTLSConfig ¶ added in v0.4.1
func LoadServingCertBundle ¶ added in v0.4.1
func NewMessage ¶ added in v0.12.0
func NewProtocolListener ¶ added in v0.4.1
func ParsePEMEncodedCert ¶ added in v0.4.1
func ParsePEMEncodedCert(data []byte) (*x509.Certificate, error)
func ParsePEMEncodedCertChain ¶ added in v0.4.1
func ParsePEMEncodedCertChain(chain []byte) ([]*x509.Certificate, error)
func ProtoClone ¶ added in v0.5.4
func ReadString ¶ added in v0.6.0
func RemoveFirstOccurence ¶ added in v0.7.0
func RemoveFirstOccurence[S ~[]T, T comparable](items S, remove T) S
func ReplaceFirstOccurrence ¶ added in v0.7.0
func ReplaceFirstOccurrence[S ~[]T, T comparable](items S, old T, new T) S
func ServeHandler ¶ added in v0.6.0
ServeHandler serves a http.Handler with the given listener. If the context is canceled, the server will be closed.
func SplitChunksWithLimit ¶ added in v0.11.0
func SplitChunksWithLimit(request *prompb.WriteRequest, limit WriteLimit) ([]*prompb.WriteRequest, error)
func StatusCode ¶ added in v0.5.4
Like status.Code(), but supports wrapped errors.
func StatusError ¶ added in v0.5.4
func WaitAll ¶ added in v0.6.0
WaitAll waits for all the given channels to be closed, under the following rules: 1. The lifetime of the task represented by each channel is directly tied to the provided context. 2. If a task exits with an error before the context is canceled, the context should be canceled. 3. If a task exits successfully, the context should not be canceled and other tasks should continue to run.
Types ¶
type DelimiterCodec ¶ added in v0.4.1
type DelimiterCodec struct {
// contains filtered or unexported fields
}
Implements rbac.Codec
func NewDelimiterCodec ¶ added in v0.4.1
func NewDelimiterCodec(key string, delimiter string) DelimiterCodec
func (DelimiterCodec) Decode ¶ added in v0.4.1
func (d DelimiterCodec) Decode(s string) []string
func (DelimiterCodec) Encode ¶ added in v0.4.1
func (d DelimiterCodec) Encode(ids []string) string
func (DelimiterCodec) Key ¶ added in v0.4.1
func (d DelimiterCodec) Key() string
type Initializer ¶ added in v0.6.0
type Initializer struct {
// contains filtered or unexported fields
}
func (*Initializer) InitOnce ¶ added in v0.6.0
func (i *Initializer) InitOnce(f func())
func (*Initializer) Initialized ¶ added in v0.6.0
func (i *Initializer) Initialized() bool
func (*Initializer) WaitForInit ¶ added in v0.6.0
func (i *Initializer) WaitForInit()
func (*Initializer) WaitForInitContext ¶ added in v0.6.0
func (i *Initializer) WaitForInitContext(ctx context.Context) error
type LockMap ¶ added in v0.5.4
type LockMap[K comparable, L sync.Locker] interface { Get(key K) L Delete(key K) }
func NewLockMap ¶ added in v0.5.4
func NewLockMap[K comparable, L locker[T], T any]() LockMap[K, L]
type MultiErrGroup ¶ added in v0.10.0
tasks := []func() error{/* */}
for _, task := range tasks { eg.Go(func() error { return task() } }
eg.Wait()
if err := eg.Error(); err != nil { // handle error }
func (*MultiErrGroup) Add ¶ added in v0.10.0
func (i *MultiErrGroup) Add(tasks int)
func (*MultiErrGroup) Done ¶ added in v0.10.0
func (i *MultiErrGroup) Done()
func (*MultiErrGroup) Error ¶ added in v0.10.0
func (i *MultiErrGroup) Error() error
func (*MultiErrGroup) Errors ¶ added in v0.11.0
func (i *MultiErrGroup) Errors() []error
func (*MultiErrGroup) Go ¶ added in v0.10.0
func (i *MultiErrGroup) Go(fn func() error)
func (*MultiErrGroup) Wait ¶ added in v0.10.0
func (i *MultiErrGroup) Wait()
type ServicePack ¶ added in v0.5.4
type ServicePack[T any] struct { // contains filtered or unexported fields }
func PackService ¶ added in v0.5.4
func PackService[T any](desc *grpc.ServiceDesc, impl T) ServicePack[T]
func (ServicePack[T]) Unpack ¶ added in v0.5.4
func (s ServicePack[T]) Unpack() (*grpc.ServiceDesc, any)
type ServicePackInterface ¶ added in v0.6.0
type ServicePackInterface interface {
Unpack() (*grpc.ServiceDesc, any)
}
type WriteLimit ¶ added in v0.11.0
type WriteLimit struct { // GrpcMaxBytes is the maximum siz of a message that can be sent over the grpc connection. GrpcMaxBytes int // CortexIngestionRateLimit is the maximum number of samples that can be sent to cortex per second. CortexIngestionRateLimit int }
func DefaultWriteLimit ¶ added in v0.11.0
func DefaultWriteLimit() WriteLimit
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This file contains the implementation of proto.Merge, with new merge options.
|
This file contains the implementation of proto.Merge, with new merge options. |
Package for abstracting agent downstream updates and notifying upstream
|
Package for abstracting agent downstream updates and notifying upstream |