Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-09-20 16:57:54 +03:00
parent aa667728a1
commit 1cbd1d2bad
17 changed files with 33 additions and 25 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/unistack-org/micro/v3/router"
"github.com/unistack-org/micro/v3/selector"
"github.com/unistack-org/micro/v3/selector/random"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
type Options struct {

View File

@ -5,7 +5,7 @@ import (
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/proxy"
"github.com/unistack-org/micro/v3/router"
"github.com/unistack-org/micro/v3/tunnel"
"github.com/unistack-org/micro/v3/network/tunnel"
)
type Option func(*Options)

View File

@ -7,8 +7,8 @@ import (
"github.com/unistack-org/micro/v3/broker"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/tunnel"
"github.com/unistack-org/micro/v3/network/transport"
"github.com/unistack-org/micro/v3/network/tunnel"
)
type tunBroker struct {

View File

@ -5,7 +5,7 @@ import (
"github.com/google/uuid"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
var (

View File

@ -1,8 +1,8 @@
package transport
import (
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/tunnel"
"github.com/unistack-org/micro/v3/network/transport"
"github.com/unistack-org/micro/v3/network/tunnel"
)
type tunListener struct {

View File

@ -5,8 +5,8 @@ import (
"context"
"fmt"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/tunnel"
"github.com/unistack-org/micro/v3/network/transport"
"github.com/unistack-org/micro/v3/network/tunnel"
)
type tunTransport struct {

View File

@ -5,7 +5,7 @@ import (
"errors"
"time"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
var (

View File

@ -19,7 +19,7 @@ import (
"github.com/unistack-org/micro/v3/server"
"github.com/unistack-org/micro/v3/store"
"github.com/unistack-org/micro/v3/tracer"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
// Options for micro service

View File

@ -10,8 +10,16 @@ type HandlerOptions struct {
Context context.Context
}
func NewHandlerOptions() HandlerOptions {
return HandlerOptions{Context: context.Background()}
func NewHandlerOptions(opts ...HandlerOption) HandlerOptions {
options := HandlerOptions{
Context: context.Background(),
}
for _, o := range opts {
o(&options)
}
return options
}
type SubscriberOption func(*SubscriberOptions)
@ -26,16 +34,16 @@ type SubscriberOptions struct {
}
func NewSubscriberOptions(opts ...SubscriberOption) SubscriberOptions {
opt := SubscriberOptions{
options := SubscriberOptions{
AutoAck: true,
Context: context.Background(),
}
for _, o := range opts {
o(&opt)
o(&options)
}
return opt
return options
}
// EndpointMetadata is a Handler option that allows metadata to be added to

View File

@ -12,7 +12,7 @@ import (
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/registry"
"github.com/unistack-org/micro/v3/tracer"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
type Options struct {

View File

@ -15,7 +15,7 @@ import (
rtreg "github.com/unistack-org/micro/v3/router/registry"
"github.com/unistack-org/micro/v3/server"
grpcsrv "github.com/unistack-org/micro/v3/server/grpc"
tmemory "github.com/unistack-org/micro/v3/transport/memory"
tmemory "github.com/unistack-org/micro/v3/network/transport/memory"
cw "github.com/unistack-org/micro/v3/util/client"
)

View File

@ -4,7 +4,7 @@ package io
import (
"io"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
type rwc struct {

View File

@ -5,7 +5,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
type pool struct {

View File

@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/transport/memory"
"github.com/unistack-org/micro/v3/network/transport"
"github.com/unistack-org/micro/v3/network/transport/memory"
)
func testPool(t *testing.T, size int, ttl time.Duration) {

View File

@ -3,7 +3,7 @@ package pool
import (
"time"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
type Options struct {

View File

@ -4,7 +4,7 @@ package pool
import (
"time"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
// Pool is an interface for connection pooling

View File

@ -4,7 +4,7 @@ package socket
import (
"io"
"github.com/unistack-org/micro/v3/transport"
"github.com/unistack-org/micro/v3/network/transport"
)
// Socket is our pseudo socket for transport.Socket