Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-12-08 00:38:37 +03:00
parent f63ff80d46
commit b7b28f6b9a
29 changed files with 138 additions and 85 deletions

View File

@@ -17,6 +17,7 @@ import (
)
var (
// DefaultCodecs will be used to encode/decode
DefaultCodecs = map[string]codec.Codec{
//"application/json": cjson.NewCodec,
//"application/json-rpc": cjsonrpc.NewCodec,

View File

@@ -16,6 +16,7 @@ import (
"github.com/unistack-org/micro/v3/tracer"
)
// Option func
type Option func(*Options)
// Options server struct

View File

@@ -12,21 +12,33 @@ import (
)
var (
// DefaultServer default server
DefaultServer Server = NewServer()
)
var (
DefaultAddress = ":0"
DefaultName = "server"
DefaultVersion = "latest"
DefaultId = uuid.New().String()
DefaultRegisterCheck = func(context.Context) error { return nil }
// DefaultAddress will be used if no address passed
DefaultAddress = ":0"
// DefaultName will be used if no name passed
DefaultName = "server"
// DefaultVersion will be used if no version passed
DefaultVersion = "latest"
// DefaultId will be used if no id passed
DefaultId = uuid.New().String()
// DefaultRegisterCheck holds func that run before register server
DefaultRegisterCheck = func(context.Context) error { return nil }
// DefaultRegisterInterval holds interval for register
DefaultRegisterInterval = time.Second * 30
DefaultRegisterTTL = time.Second * 90
DefaultNamespace = "micro"
DefaultMaxMsgSize = 1024 * 1024 * 4 // 4Mb
DefaultMaxMsgRecvSize = 1024 * 1024 * 4 // 4Mb
DefaultMaxMsgSendSize = 1024 * 1024 * 4 // 4Mb
// DefaultRegisterTTL holds registry record ttl, must be multiple of DefaultRegisterInterval
DefaultRegisterTTL = time.Second * 90
// DefaultNamespace will be used if no namespace passed
DefaultNamespace = "micro"
// DefaultMaxMsgSize holds default max msg ssize
DefaultMaxMsgSize = 1024 * 1024 * 4 // 4Mb
// DefaultMaxMsgRecvSize holds default max recv size
DefaultMaxMsgRecvSize = 1024 * 1024 * 4 // 4Mb
// DefaultMaxMsgSendSize holds default max send size
DefaultMaxMsgSendSize = 1024 * 1024 * 4 // 4Mb
)
// Server is a simple micro server abstraction