mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
move server config to drpc config
This commit is contained in:
parent
dad76def2f
commit
c7828d0671
3 changed files with 16 additions and 16 deletions
|
@ -5,16 +5,3 @@ import "errors"
|
||||||
var (
|
var (
|
||||||
ErrUnableToConnect = errors.New("unable to connect")
|
ErrUnableToConnect = errors.New("unable to connect")
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigGetter interface {
|
|
||||||
GetNet() Config
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
Stream StreamConfig `yaml:"stream"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type StreamConfig struct {
|
|
||||||
TimeoutMilliseconds int `yaml:"timeoutMilliseconds"`
|
|
||||||
MaxMsgSizeMb int `yaml:"maxMsgSizeMb"`
|
|
||||||
}
|
|
||||||
|
|
13
net/rpc/drpcconfig.go
Normal file
13
net/rpc/drpcconfig.go
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package rpc
|
||||||
|
|
||||||
|
type ConfigGetter interface {
|
||||||
|
GetDrpc() Config
|
||||||
|
}
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
Stream StreamConfig `yaml:"stream"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StreamConfig struct {
|
||||||
|
MaxMsgSizeMb int `yaml:"maxMsgSizeMb"`
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"github.com/anyproto/any-sync/app"
|
"github.com/anyproto/any-sync/app"
|
||||||
"github.com/anyproto/any-sync/app/logger"
|
"github.com/anyproto/any-sync/app/logger"
|
||||||
"github.com/anyproto/any-sync/metric"
|
"github.com/anyproto/any-sync/metric"
|
||||||
anyNet "github.com/anyproto/any-sync/net"
|
"github.com/anyproto/any-sync/net/rpc"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"net"
|
"net"
|
||||||
"storj.io/drpc"
|
"storj.io/drpc"
|
||||||
|
@ -32,7 +32,7 @@ type DRPCServer interface {
|
||||||
type drpcServer struct {
|
type drpcServer struct {
|
||||||
drpcServer *drpcserver.Server
|
drpcServer *drpcserver.Server
|
||||||
*drpcmux.Mux
|
*drpcmux.Mux
|
||||||
config anyNet.Config
|
config rpc.Config
|
||||||
metric metric.Metric
|
metric metric.Metric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func (s *drpcServer) Name() (name string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *drpcServer) Init(a *app.App) (err error) {
|
func (s *drpcServer) Init(a *app.App) (err error) {
|
||||||
s.config = a.MustComponent("config").(anyNet.ConfigGetter).GetNet()
|
s.config = a.MustComponent("config").(rpc.ConfigGetter).GetDrpc()
|
||||||
s.metric, _ = a.Component(metric.CName).(metric.Metric)
|
s.metric, _ = a.Component(metric.CName).(metric.Metric)
|
||||||
s.Mux = drpcmux.New()
|
s.Mux = drpcmux.New()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue