Bump reva deps (#8412)

* bump dependencies

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* bump reva and add config options

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-02-21 10:20:36 +01:00
committed by GitHub
parent c92ebf4b46
commit 5ed57cc09a
490 changed files with 19128 additions and 11161 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import (
"net/http"
)
// NewOptions returns new initialised options
// NewOptions wires options together.
func NewOptions(opts ...Option) Options {
var options Options
for _, o := range opts {
@@ -18,14 +18,14 @@ func NewOptions(opts ...Option) Options {
return options
}
// WithHandler sets the handler being used
// WithHandler sets the handler being used.
func WithHandler(h string) Option {
return func(o *Options) {
o.Handler = h
}
}
// WithNamespace sets the function which determines the namespace for a request
// WithNamespace sets the function which determines the namespace for a request.
func WithNamespace(n func(*http.Request) string) Option {
return func(o *Options) {
o.Namespace = n
+6 -4
View File
@@ -11,13 +11,13 @@ var (
ErrInvalidPath = errors.New("invalid path")
)
// Resolver resolves requests to endpoints
// Resolver resolves requests to endpoints.
type Resolver interface {
Resolve(r *http.Request) (*Endpoint, error)
String() string
}
// Endpoint is the endpoint for a http request
// Endpoint is the endpoint for a http request.
type Endpoint struct {
// e.g greeter
Name string
@@ -29,14 +29,16 @@ type Endpoint struct {
Path string
}
// Options is a struct of available options.
type Options struct {
Handler string
Namespace func(*http.Request) string
Handler string
}
// Option is a helper for a single option.
type Option func(o *Options)
// StaticNamespace returns the same namespace for each request
// StaticNamespace returns the same namespace for each request.
func StaticNamespace(ns string) func(*http.Request) string {
return func(*http.Request) string {
return ns
+4 -1
View File
@@ -1,4 +1,4 @@
// Package vpath resolves using http path and recognised versioned urls
// Package vpath resolves using http path and recognized versioned urls
package vpath
import (
@@ -10,10 +10,12 @@ import (
"go-micro.dev/v4/api/resolver"
)
// NewResolver returns a new vpath resolver.
func NewResolver(opts ...resolver.Option) resolver.Resolver {
return &Resolver{opts: resolver.NewOptions(opts...)}
}
// Resolver is a vpath resolver.
type Resolver struct {
opts resolver.Options
}
@@ -22,6 +24,7 @@ var (
re = regexp.MustCompile("^v[0-9]+$")
)
// Resolve resolves a http.Request to an grpc Endpoint.
func (r *Resolver) Resolve(req *http.Request) (*resolver.Endpoint, error) {
if req.URL.Path == "/" {
return nil, errors.New("unknown name")