count

package
v0.0.0-...-084e4ab Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitialCount

func InitialCount() *traits.Count

func WithCountApiClientFactory

func WithCountApiClientFactory(f func(name string) (traits.CountApiClient, error)) router.Option

WithCountApiClientFactory instructs the router to create a new client the first time Get is called for that name.

func WithCountInfoClientFactory

func WithCountInfoClientFactory(f func(name string) (traits.CountInfoClient, error)) router.Option

WithCountInfoClientFactory instructs the router to create a new client the first time Get is called for that name.

func WrapApi

WrapApi adapts a traits.CountApiServer and presents it as a traits.CountApiClient

func WrapInfo

WrapInfo adapts a traits.CountInfoServer and presents it as a traits.CountInfoClient

Types

type ApiRouter

type ApiRouter struct {
	traits.UnimplementedCountApiServer

	router.Router
}

ApiRouter is a traits.CountApiServer that allows routing named requests to specific traits.CountApiClient

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.CountApiClient.

func (*ApiRouter) AddCountApiClient

func (r *ApiRouter) AddCountApiClient(name string, client traits.CountApiClient) traits.CountApiClient

func (*ApiRouter) GetCount

func (r *ApiRouter) GetCount(ctx context.Context, request *traits.GetCountRequest) (*traits.Count, error)

func (*ApiRouter) GetCountApiClient

func (r *ApiRouter) GetCountApiClient(name string) (traits.CountApiClient, error)

func (*ApiRouter) HoldsType

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

func (*ApiRouter) PullCounts

func (r *ApiRouter) PullCounts(request *traits.PullCountsRequest, server traits.CountApi_PullCountsServer) error

func (*ApiRouter) Register

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

func (*ApiRouter) RemoveCountApiClient

func (r *ApiRouter) RemoveCountApiClient(name string) traits.CountApiClient

func (*ApiRouter) ResetCount

func (r *ApiRouter) ResetCount(ctx context.Context, request *traits.ResetCountRequest) (*traits.Count, error)

func (*ApiRouter) UpdateCount

func (r *ApiRouter) UpdateCount(ctx context.Context, request *traits.UpdateCountRequest) (*traits.Count, error)

type InfoRouter

type InfoRouter struct {
	traits.UnimplementedCountInfoServer

	router.Router
}

InfoRouter is a traits.CountInfoServer that allows routing named requests to specific traits.CountInfoClient

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.CountInfoClient.

func (*InfoRouter) AddCountInfoClient

func (r *InfoRouter) AddCountInfoClient(name string, client traits.CountInfoClient) traits.CountInfoClient

func (*InfoRouter) DescribeCount

func (r *InfoRouter) DescribeCount(ctx context.Context, request *traits.DescribeCountRequest) (*traits.CountSupport, error)

func (*InfoRouter) GetCountInfoClient

func (r *InfoRouter) GetCountInfoClient(name string) (traits.CountInfoClient, error)

func (*InfoRouter) HoldsType

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

func (*InfoRouter) Register

func (r *InfoRouter) Register(server *grpc.Server)

func (*InfoRouter) RemoveCountInfoClient

func (r *InfoRouter) RemoveCountInfoClient(name string) traits.CountInfoClient

type MemoryDevice

type MemoryDevice struct {
	traits.UnimplementedCountApiServer
	// contains filtered or unexported fields
}

func NewMemoryDevice

func NewMemoryDevice() *MemoryDevice

func (*MemoryDevice) GetCount

func (*MemoryDevice) PullCounts

func (*MemoryDevice) ResetCount

func (t *MemoryDevice) ResetCount(_ context.Context, request *traits.ResetCountRequest) (*traits.Count, error)

func (*MemoryDevice) UpdateCount

func (t *MemoryDevice) UpdateCount(_ context.Context, request *traits.UpdateCountRequest) (*traits.Count, error)

Jump to

Keyboard shortcuts

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