wastepb

package
v0.0.0-...-ac0bb94 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithWasteApiClientFactory

func WithWasteApiClientFactory(f func(name string) (traits.WasteApiClient, error)) router.Option

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

func WithWasteInfoClientFactory

func WithWasteInfoClientFactory(f func(name string) (traits.WasteInfoClient, error)) router.Option

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

Types

type ApiRouter

type ApiRouter struct {
	traits.UnimplementedWasteApiServer

	router.Router
}

ApiRouter is a traits.WasteApiServer that allows routing named requests to specific traits.WasteApiClient

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

func (*ApiRouter) AddWasteApiClient

func (r *ApiRouter) AddWasteApiClient(name string, client traits.WasteApiClient) traits.WasteApiClient

func (*ApiRouter) GetWasteApiClient

func (r *ApiRouter) GetWasteApiClient(name string) (traits.WasteApiClient, error)

func (*ApiRouter) HoldsType

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

func (*ApiRouter) ListWasteRecords

func (*ApiRouter) PullWasteRecords

func (*ApiRouter) Register

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

func (*ApiRouter) RemoveWasteApiClient

func (r *ApiRouter) RemoveWasteApiClient(name string) traits.WasteApiClient

type ApiWrapper

type ApiWrapper struct {
	traits.WasteApiClient
	// contains filtered or unexported fields
}

func WrapApi

func WrapApi(server traits.WasteApiServer) *ApiWrapper

WrapApi adapts a traits.WasteApiServer and presents it as a traits.WasteApiClient

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

UnwrapServer returns the underlying server instance.

func (*ApiWrapper) UnwrapService

func (w *ApiWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)

type InfoRouter

type InfoRouter struct {
	traits.UnimplementedWasteInfoServer

	router.Router
}

InfoRouter is a traits.WasteInfoServer that allows routing named requests to specific traits.WasteInfoClient

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

func (*InfoRouter) AddWasteInfoClient

func (r *InfoRouter) AddWasteInfoClient(name string, client traits.WasteInfoClient) traits.WasteInfoClient

func (*InfoRouter) DescribeWasteRecord

func (r *InfoRouter) DescribeWasteRecord(ctx context.Context, request *traits.DescribeWasteRecordRequest) (*traits.WasteRecordSupport, error)

func (*InfoRouter) GetWasteInfoClient

func (r *InfoRouter) GetWasteInfoClient(name string) (traits.WasteInfoClient, error)

func (*InfoRouter) HoldsType

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

func (*InfoRouter) Register

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

func (*InfoRouter) RemoveWasteInfoClient

func (r *InfoRouter) RemoveWasteInfoClient(name string) traits.WasteInfoClient

type InfoWrapper

type InfoWrapper struct {
	traits.WasteInfoClient
	// contains filtered or unexported fields
}

func WrapInfo

func WrapInfo(server traits.WasteInfoServer) *InfoWrapper

WrapInfo adapts a traits.WasteInfoServer and presents it as a traits.WasteInfoClient

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

UnwrapServer returns the underlying server instance.

func (*InfoWrapper) UnwrapService

func (w *InfoWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewModel

func NewModel(opts ...resource.Option) *Model

func (*Model) AddWasteRecord

func (m *Model) AddWasteRecord(wr *traits.WasteRecord, opts ...resource.WriteOption) (*traits.WasteRecord, error)

AddWasteRecord manually adds a waste record to the model

func (*Model) GenerateWasteRecord

func (m *Model) GenerateWasteRecord(ts *timestamppb.Timestamp) (*traits.WasteRecord, error)

GenerateWasteRecord generates a new waste record with the given timestamp and adds it to the model

func (*Model) GetWasteRecordCount

func (m *Model) GetWasteRecordCount() int

func (*Model) ListWasteRecords

func (m *Model) ListWasteRecords(start, count int) []*traits.WasteRecord

func (*Model) PullWasteRecords

func (m *Model) PullWasteRecords(ctx context.Context, opts ...resource.ReadOption) <-chan *traits.PullWasteRecordsResponse_Change

type ModelServer

type ModelServer struct {
	traits.UnimplementedWasteApiServer
	// contains filtered or unexported fields
}

func NewModelServer

func NewModelServer(model *Model) *ModelServer

func (*ModelServer) ListWasteRecords

func (*ModelServer) PullWasteRecords

PullWasteRecords returns a channel of WasteRecords If updatesOnly is false, only the previous 50 events will be sent before any new events For historical events use ListWasteRecords

func (*ModelServer) Register

func (m *ModelServer) Register(server *grpc.Server)

func (*ModelServer) Unwrap

func (m *ModelServer) Unwrap() any

Jump to

Keyboard shortcuts

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