nexus

package
v1.24.0-m3.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssueNamespaceNotSet = "namespace is not set on request"
	IssueNameNotSet      = "name is not set on request"
	IssueURLNotSet       = "url is not set on request"
)

Variables

View Source
var PayloadSerializer nexus.Serializer = payloadSerializer{}
View Source
var RouteDispatchNexusTaskByNamespaceAndTaskQueue = routing.NewBuilder[NamespaceAndTaskQueue]().
	Constant("api", "v1", "namespaces").
	StringVariable("namespace", func(params *NamespaceAndTaskQueue) *string { return &params.Namespace }).
	Constant("task-queues").
	StringVariable("task_queue", func(params *NamespaceAndTaskQueue) *string { return &params.TaskQueue }).
	Constant("nexus-operations").
	Build()
View Source
var RouteDispatchNexusTaskByService = routing.NewBuilder[string]().
	Constant("api", "v1", "nexus", "services").
	StringVariable("service", func(service *string) *string { return service }).
	Constant("operations").
	Build()
View Source
var ServiceNameRegex = regexp.MustCompile(`[a-zA-Z_][a-zA-Z0-9_]*`)

ServiceNameRegex is the regular expression that outgoing service names must match.

Functions

func APIFailureToNexusFailure

func APIFailureToNexusFailure(failure *failurepb.Failure) *nexus.Failure

APIFailureToNexusFailure converts an API proto Failure to a Nexus SDK Failure taking only the failure message to avoid leaking too many details to 3rd party callers. Always returns a non-nil value.

func IncomingServicePersistedEntryToExternalAPI

func IncomingServicePersistedEntryToExternalAPI(entry *persistencepb.NexusIncomingServiceEntry) *nexus.IncomingService

func ProtoFailureToNexusFailure

func ProtoFailureToNexusFailure(failure *nexuspb.Failure) *nexus.Failure

ProtoFailureToNexusFailure converts a proto Nexus Failure to a Nexus SDK Failure. Always returns a non-nil value.

Types

type IncomingServiceRegistry

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

IncomingServiceRegistry manages a cached view of Nexus incoming services. Services are lazily-loaded into memory on the first read. Thereafter, service data is kept up to date by background long polling on matching service ListNexusIncomingServices.

func NewIncomingServiceRegistry

func NewIncomingServiceRegistry(
	config *IncomingServiceRegistryConfig,
	matchingClient matchingservice.MatchingServiceClient,
	persistence p.NexusIncomingServiceManager,
	logger log.Logger,
) *IncomingServiceRegistry

func (*IncomingServiceRegistry) Get

func (r *IncomingServiceRegistry) Get(ctx context.Context, id string) (*nexus.IncomingService, error)

func (*IncomingServiceRegistry) StartLifecycle

func (r *IncomingServiceRegistry) StartLifecycle()

StartLifecycle starts this component. It should only be invoked by an fx lifecycle hook. Should not be called multiple times or concurrently with StopLifecycle()

func (*IncomingServiceRegistry) StopLifecycle

func (r *IncomingServiceRegistry) StopLifecycle()

StopLifecycle stops this component. It should only be invoked by an fx lifecycle hook. Should not be called multiple times or concurrently with StartLifecycle()

type IncomingServiceRegistryConfig

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

type NamespaceAndTaskQueue

type NamespaceAndTaskQueue struct {
	Namespace string
	TaskQueue string
}

type NamespaceService

type NamespaceService interface {
	GetNamespace(ctx context.Context, request *persistence.GetNamespaceRequest) (*persistence.GetNamespaceResponse, error)
	UpdateNamespace(ctx context.Context, request *persistence.UpdateNamespaceRequest) error
}

NamespaceService is an interface which contains only the methods we need from go.temporal.io/server/common/persistence.MetadataManager.

type OutgoingServiceRegistry

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

OutgoingServiceRegistry manages the registration and retrieval of "outgoing" services from the namespace metadata in the persistence layer. An outgoing service is a Nexus service to which we send traffic. For example, we might call one of these services to start an operation using this API: https://github.com/nexus-rpc/api/blob/main/SPEC.md#start-operation. We need a registry for these services, so that we can look up the URL for a service by name. Later, we may add more service-specific information to the registry.

func NewOutgoingServiceRegistry

func NewOutgoingServiceRegistry(
	namespaceService NamespaceService,
	namespaceReplicator namespace.Replicator,
	config *OutgoingServiceRegistryConfig,
) *OutgoingServiceRegistry

NewOutgoingServiceRegistry creates a new OutgoingServiceRegistry with the given namespace service and configuration.

func (*OutgoingServiceRegistry) Create

func (h *OutgoingServiceRegistry) Create(
	ctx context.Context,
	req *operatorservice.CreateNexusOutgoingServiceRequest,
) (*operatorservice.CreateNexusOutgoingServiceResponse, error)

Create implements operatorservice.OperatorServiceServer.CreateNexusOutgoingService.

func (*OutgoingServiceRegistry) Delete

func (h *OutgoingServiceRegistry) Delete(
	ctx context.Context,
	req *operatorservice.DeleteNexusOutgoingServiceRequest,
) (*operatorservice.DeleteNexusOutgoingServiceResponse, error)

Delete implements operatorservice.OperatorServiceServer.DeleteNexusOutgoingService.

func (*OutgoingServiceRegistry) Get

func (h *OutgoingServiceRegistry) Get(
	ctx context.Context,
	req *operatorservice.GetNexusOutgoingServiceRequest,
) (*operatorservice.GetNexusOutgoingServiceResponse, error)

Get implements operatorservice.OperatorServiceServer.GetNexusOutgoingService.

func (*OutgoingServiceRegistry) List

func (h *OutgoingServiceRegistry) List(
	ctx context.Context,
	req *operatorservice.ListNexusOutgoingServicesRequest,
) (*operatorservice.ListNexusOutgoingServicesResponse, error)

List implements operatorservice.OperatorServiceServer.ListNexusOutgoingServices.

func (*OutgoingServiceRegistry) Update

func (h *OutgoingServiceRegistry) Update(
	ctx context.Context,
	req *operatorservice.UpdateNexusOutgoingServiceRequest,
) (*operatorservice.UpdateNexusOutgoingServiceResponse, error)

Update implements operatorservice.OperatorServiceServer.UpdateNexusOutgoingService.

type OutgoingServiceRegistryConfig

type OutgoingServiceRegistryConfig struct {
	MaxURLLength    dynamicconfig.IntPropertyFn
	MaxNameLength   dynamicconfig.IntPropertyFn
	DefaultPageSize dynamicconfig.IntPropertyFn
	MaxPageSize     dynamicconfig.IntPropertyFn
}

OutgoingServiceRegistryConfig contains the dynamic configuration values for the OutgoingServiceRegistry.

func NewOutgoingServiceRegistryConfig

func NewOutgoingServiceRegistryConfig(dc *dynamicconfig.Collection) *OutgoingServiceRegistryConfig

NewOutgoingServiceRegistryConfig creates a new OutgoingServiceRegistryConfig with the given dynamic configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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