accesspb

package
v0.0.0-...-ee17ca8 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAccessApiClientFactory

func WithAccessApiClientFactory(f func(name string) (traits.AccessApiClient, error)) router.Option

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

Types

type ApiRouter

type ApiRouter struct {
	traits.UnimplementedAccessApiServer

	router.Router
}

ApiRouter is a traits.AccessApiServer that allows routing named requests to specific traits.AccessApiClient

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

func (*ApiRouter) AddAccessApiClient

func (r *ApiRouter) AddAccessApiClient(name string, client traits.AccessApiClient) traits.AccessApiClient

func (*ApiRouter) GetAccessApiClient

func (r *ApiRouter) GetAccessApiClient(name string) (traits.AccessApiClient, error)

func (*ApiRouter) GetLastAccessAttempt

func (r *ApiRouter) GetLastAccessAttempt(ctx context.Context, request *traits.GetLastAccessAttemptRequest) (*traits.AccessAttempt, error)

func (*ApiRouter) HoldsType

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

func (*ApiRouter) PullAccessAttempts

func (*ApiRouter) Register

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

func (*ApiRouter) RemoveAccessApiClient

func (r *ApiRouter) RemoveAccessApiClient(name string) traits.AccessApiClient

type ApiWrapper

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

func WrapApi

func WrapApi(server traits.AccessApiServer) *ApiWrapper

WrapApi adapts a traits.AccessApiServer and presents it as a traits.AccessApiClient

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

UnwrapServer returns the underlying server instance.

func (*ApiWrapper) UnwrapService

func (w *ApiWrapper) 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) GetLastAccessAttempt

func (m *Model) GetLastAccessAttempt(opts ...resource.ReadOption) (*traits.AccessAttempt, error)

func (*Model) PullAccessAttempts

func (m *Model) PullAccessAttempts(ctx context.Context, opts ...resource.ReadOption) <-chan PullAccessAttemptsChange

func (*Model) UpdateLastAccessAttempt

func (m *Model) UpdateLastAccessAttempt(accessAttempt *traits.AccessAttempt, opts ...resource.WriteOption) (*traits.AccessAttempt, error)

type ModelServer

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

func NewModelServer

func NewModelServer(model *Model) *ModelServer

func (*ModelServer) GetLastAccessAttempt

func (m *ModelServer) GetLastAccessAttempt(ctx context.Context, request *traits.GetLastAccessAttemptRequest) (*traits.AccessAttempt, error)

func (*ModelServer) PullAccessAttempts

func (*ModelServer) Register

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

func (*ModelServer) Unwrap

func (m *ModelServer) Unwrap() any

type PullAccessAttemptsChange

type PullAccessAttemptsChange struct {
	Value      *traits.AccessAttempt
	ChangeTime time.Time
}

Jump to

Keyboard shortcuts

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