channel

package
v0.0.0-...-97303ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

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

ApiRouter is a traits.ChannelApiServer that allows routing named requests to specific traits.ChannelApiClient

func NewApiRouter

func NewApiRouter(opts ...router.Option) *ApiRouter

func (*ApiRouter) Add

func (r *ApiRouter) Add(name string, client any) any

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 (r *ApiRouter) AdjustChannel(ctx context.Context, request *traits.AdjustChannelRequest) (*traits.Channel, error)

func (*ApiRouter) ChooseChannel

func (r *ApiRouter) ChooseChannel(ctx context.Context, request *traits.ChooseChannelRequest) (*traits.Channel, error)

func (*ApiRouter) GetChannelApiClient

func (r *ApiRouter) GetChannelApiClient(name string) (traits.ChannelApiClient, error)

func (*ApiRouter) GetChosenChannel

func (r *ApiRouter) GetChosenChannel(ctx context.Context, request *traits.GetChosenChannelRequest) (*traits.Channel, error)

func (*ApiRouter) HoldsType

func (r *ApiRouter) HoldsType(client any) bool

func (*ApiRouter) PullChosenChannel

func (*ApiRouter) Register

func (r *ApiRouter) Register(server grpc.ServiceRegistrar)

func (*ApiRouter) RemoveChannelApiClient

func (r *ApiRouter) RemoveChannelApiClient(name string) traits.ChannelApiClient

func (*ApiRouter) ReturnChannel

func (r *ApiRouter) ReturnChannel(ctx context.Context, request *traits.ReturnChannelRequest) (*traits.Channel, error)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL