Documentation ¶
Index ¶
- func WithChannelApiClientFactory(f func(name string) (traits.ChannelApiClient, error)) router.Option
- func WithChannelInfoClientFactory(f func(name string) (traits.ChannelInfoClient, error)) router.Option
- type ApiRouter
- func (r *ApiRouter) Add(name string, client any) any
- func (r *ApiRouter) AddChannelApiClient(name string, client traits.ChannelApiClient) traits.ChannelApiClient
- func (r *ApiRouter) AdjustChannel(ctx context.Context, request *traits.AdjustChannelRequest) (*traits.Channel, error)
- func (r *ApiRouter) ChooseChannel(ctx context.Context, request *traits.ChooseChannelRequest) (*traits.Channel, error)
- func (r *ApiRouter) GetChannelApiClient(name string) (traits.ChannelApiClient, error)
- func (r *ApiRouter) GetChosenChannel(ctx context.Context, request *traits.GetChosenChannelRequest) (*traits.Channel, error)
- func (r *ApiRouter) HoldsType(client any) bool
- func (r *ApiRouter) PullChosenChannel(request *traits.PullChosenChannelRequest, ...) error
- func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
- func (r *ApiRouter) RemoveChannelApiClient(name string) traits.ChannelApiClient
- func (r *ApiRouter) ReturnChannel(ctx context.Context, request *traits.ReturnChannelRequest) (*traits.Channel, error)
- type ApiWrapper
- type InfoRouter
- func (r *InfoRouter) Add(name string, client any) any
- func (r *InfoRouter) AddChannelInfoClient(name string, client traits.ChannelInfoClient) traits.ChannelInfoClient
- func (r *InfoRouter) DescribeChosenChannel(ctx context.Context, request *traits.DescribeChosenChannelRequest) (*traits.ChosenChannelSupport, error)
- func (r *InfoRouter) GetChannelInfoClient(name string) (traits.ChannelInfoClient, error)
- func (r *InfoRouter) HoldsType(client any) bool
- func (r *InfoRouter) Register(server grpc.ServiceRegistrar)
- func (r *InfoRouter) RemoveChannelInfoClient(name string) traits.ChannelInfoClient
- type InfoWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithChannelApiClientFactory ¶
func WithChannelApiClientFactory(f func(name string) (traits.ChannelApiClient, error)) router.Option
WithChannelApiClientFactory instructs the router to create a new client the first time Get is called for that name.
func WithChannelInfoClientFactory ¶
func WithChannelInfoClientFactory(f func(name string) (traits.ChannelInfoClient, error)) router.Option
WithChannelInfoClientFactory instructs the router to create a new client the first time Get is called for that name.
Types ¶
type ApiRouter ¶
type ApiRouter struct { traits.UnimplementedChannelApiServer router.Router }
ApiRouter is a traits.ChannelApiServer that allows routing named requests to specific traits.ChannelApiClient
func NewApiRouter ¶
func (*ApiRouter) Add ¶
Add extends Router.Add to panic if client is not of type traits.ChannelApiClient.
func (*ApiRouter) AddChannelApiClient ¶
func (r *ApiRouter) AddChannelApiClient(name string, client traits.ChannelApiClient) traits.ChannelApiClient
func (*ApiRouter) AdjustChannel ¶
func (*ApiRouter) ChooseChannel ¶
func (*ApiRouter) GetChannelApiClient ¶
func (r *ApiRouter) GetChannelApiClient(name string) (traits.ChannelApiClient, error)
func (*ApiRouter) GetChosenChannel ¶
func (*ApiRouter) PullChosenChannel ¶
func (r *ApiRouter) PullChosenChannel(request *traits.PullChosenChannelRequest, server traits.ChannelApi_PullChosenChannelServer) error
func (*ApiRouter) Register ¶
func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
func (*ApiRouter) RemoveChannelApiClient ¶
func (r *ApiRouter) RemoveChannelApiClient(name string) traits.ChannelApiClient
func (*ApiRouter) ReturnChannel ¶
type ApiWrapper ¶
type ApiWrapper struct { traits.ChannelApiClient // contains filtered or unexported fields }
func WrapApi ¶
func WrapApi(server traits.ChannelApiServer) *ApiWrapper
WrapApi adapts a traits.ChannelApiServer and presents it as a traits.ChannelApiClient
func (*ApiWrapper) Unwrap ¶
func (w *ApiWrapper) Unwrap() any
Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.
func (*ApiWrapper) UnwrapServer ¶
func (w *ApiWrapper) UnwrapServer() traits.ChannelApiServer
UnwrapServer returns the underlying server instance.
func (*ApiWrapper) UnwrapService ¶
func (w *ApiWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)
type InfoRouter ¶
type InfoRouter struct { traits.UnimplementedChannelInfoServer router.Router }
InfoRouter is a traits.ChannelInfoServer that allows routing named requests to specific traits.ChannelInfoClient
func NewInfoRouter ¶
func NewInfoRouter(opts ...router.Option) *InfoRouter
func (*InfoRouter) Add ¶
func (r *InfoRouter) Add(name string, client any) any
Add extends Router.Add to panic if client is not of type traits.ChannelInfoClient.
func (*InfoRouter) AddChannelInfoClient ¶
func (r *InfoRouter) AddChannelInfoClient(name string, client traits.ChannelInfoClient) traits.ChannelInfoClient
func (*InfoRouter) DescribeChosenChannel ¶
func (r *InfoRouter) DescribeChosenChannel(ctx context.Context, request *traits.DescribeChosenChannelRequest) (*traits.ChosenChannelSupport, error)
func (*InfoRouter) GetChannelInfoClient ¶
func (r *InfoRouter) GetChannelInfoClient(name string) (traits.ChannelInfoClient, error)
func (*InfoRouter) HoldsType ¶
func (r *InfoRouter) HoldsType(client any) bool
func (*InfoRouter) Register ¶
func (r *InfoRouter) Register(server grpc.ServiceRegistrar)
func (*InfoRouter) RemoveChannelInfoClient ¶
func (r *InfoRouter) RemoveChannelInfoClient(name string) traits.ChannelInfoClient
type InfoWrapper ¶
type InfoWrapper struct { traits.ChannelInfoClient // contains filtered or unexported fields }
func WrapInfo ¶
func WrapInfo(server traits.ChannelInfoServer) *InfoWrapper
WrapInfo adapts a traits.ChannelInfoServer and presents it as a traits.ChannelInfoClient
func (*InfoWrapper) Unwrap ¶
func (w *InfoWrapper) Unwrap() any
Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.
func (*InfoWrapper) UnwrapServer ¶
func (w *InfoWrapper) UnwrapServer() traits.ChannelInfoServer
UnwrapServer returns the underlying server instance.
func (*InfoWrapper) UnwrapService ¶
func (w *InfoWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)