1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-29 21:47:44 +02:00

feat: add test framework & refactor RPC server (#2579)

Co-authored-by: Rene Jochum <rene@jochum.dev>
This commit is contained in:
David Brouwer
2022-10-20 13:00:50 +02:00
committed by GitHub
parent c25dee7c8a
commit a3980c2308
54 changed files with 3703 additions and 2497 deletions

View File

@@ -8,6 +8,7 @@ import (
"time"
"github.com/google/uuid"
"go-micro.dev/v4/codec"
log "go-micro.dev/v4/logger"
"go-micro.dev/v4/registry"
@@ -140,14 +141,14 @@ 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 func(...Option) Server = NewRPCServer
)
// DefaultOptions returns config options for the default service.
@@ -157,7 +158,7 @@ func DefaultOptions() Options {
func Init(opt ...Option) {
if DefaultServer == nil {
DefaultServer = newRpcServer(opt...)
DefaultServer = NewRPCServer(opt...)
}
DefaultServer.Init(opt...)
}