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
+20 -21
View File
@@ -15,9 +15,9 @@ import (
signalutil "go-micro.dev/v4/util/signal"
)
// Server is a simple micro server abstraction
// Server is a simple micro server abstraction.
type Server interface {
// Initialise options
// Initialize options
Init(...Option) error
// Retrieve the options
Options() Options
@@ -37,7 +37,7 @@ type Server interface {
String() string
}
// Router handle serving messages
// Router handle serving messages.
type Router interface {
// ProcessMessage processes a message
ProcessMessage(context.Context, Message) error
@@ -45,7 +45,7 @@ type Router interface {
ServeRequest(context.Context, Request, Response) error
}
// Message is an async message interface
// Message is an async message interface.
type Message interface {
// Topic of the message
Topic() string
@@ -61,7 +61,7 @@ type Message interface {
Codec() codec.Reader
}
// Request is a synchronous request interface
// Request is a synchronous request interface.
type Request interface {
// Service name requested
Service() string
@@ -83,7 +83,7 @@ type Request interface {
Stream() bool
}
// Response is the response writer for unencoded messages
// Response is the response writer for unencoded messages.
type Response interface {
// Encoded writer
Codec() codec.Writer
@@ -126,7 +126,7 @@ type Handler interface {
// Subscriber interface represents a subscription to a given topic using
// a specific subscriber function or object with endpoints. It mirrors
// the handler in its behaviour.
// the handler in its behavior.
type Subscriber interface {
Topic() string
Subscriber() interface{}
@@ -141,36 +141,35 @@ var (
DefaultName = "go.micro.server"
DefaultVersion = "latest"
DefaultId = uuid.New().String()
DefaultServer Server = newRpcServer()
DefaultServer Server = NewRPCServer()
DefaultRouter = newRpcRouter()
DefaultRegisterCheck = func(context.Context) error { return nil }
DefaultRegisterInterval = time.Second * 30
DefaultRegisterTTL = time.Second * 90
// NewServer creates a new server
NewServer func(...Option) Server = newRpcServer
// NewServer creates a new server.
NewServer func(...Option) Server = NewRPCServer
)
// DefaultOptions returns config options for the default service
// DefaultOptions returns config options for the default service.
func DefaultOptions() Options {
return DefaultServer.Options()
}
// Init initialises the default server with options passed in
func Init(opt ...Option) {
if DefaultServer == nil {
DefaultServer = newRpcServer(opt...)
DefaultServer = NewRPCServer(opt...)
}
DefaultServer.Init(opt...)
}
// NewRouter returns a new router
// NewRouter returns a new router.
func NewRouter() *router {
return newRpcRouter()
}
// NewSubscriber creates a new subscriber interface with the given topic
// and handler using the default server
// and handler using the default server.
func NewSubscriber(topic string, h interface{}, opts ...SubscriberOption) Subscriber {
return DefaultServer.NewSubscriber(topic, h, opts...)
}
@@ -189,19 +188,19 @@ func NewHandler(h interface{}, opts ...HandlerOption) Handler {
}
// Handle registers a handler interface with the default server to
// handle inbound requests
// handle inbound requests.
func Handle(h Handler) error {
return DefaultServer.Handle(h)
}
// Subscribe registers a subscriber interface with the default server
// which subscribes to specified topic with the broker
// which subscribes to specified topic with the broker.
func Subscribe(s Subscriber) error {
return DefaultServer.Subscribe(s)
}
// Run starts the default server and waits for a kill
// signal before exiting. Also registers/deregisters the server
// signal before exiting. Also registers/deregisters the server.
func Run() error {
if err := Start(); err != nil {
return err
@@ -214,20 +213,20 @@ func Run() error {
return Stop()
}
// Start starts the default server
// Start starts the default server.
func Start() error {
config := DefaultServer.Options()
config.Logger.Logf(log.InfoLevel, "Starting server %s id %s", config.Name, config.Id)
return DefaultServer.Start()
}
// Stop stops the default server
// Stop stops the default server.
func Stop() error {
DefaultServer.Options().Logger.Logf(log.InfoLevel, "Stopping server")
return DefaultServer.Stop()
}
// String returns name of Server implementation
// String returns name of Server implementation.
func String() string {
return DefaultServer.String()
}