nexustest

package
v1.24.0-m112.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocListenAddress

func AllocListenAddress(t *testing.T) string

func NewNexusServer

func NewNexusServer(t *testing.T, listenAddr string, handler nexus.Handler)

Types

type Handler

type Handler struct {
	nexus.UnimplementedHandler
	OnStartOperation  func(ctx context.Context, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error)
	OnCancelOperation func(ctx context.Context, operation, operationID string, options nexus.CancelOperationOptions) error
}

func (Handler) CancelOperation

func (h Handler) CancelOperation(ctx context.Context, operation, operationID string, options nexus.CancelOperationOptions) error

func (Handler) StartOperation

func (h Handler) StartOperation(ctx context.Context, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error)

type NamespaceService

type NamespaceService struct {
	OnGetNamespace    func(ctx context.Context, request *persistence.GetNamespaceRequest) (*persistence.GetNamespaceResponse, error)
	OnUpdateNamespace func(ctx context.Context, request *persistence.UpdateNamespaceRequest) error
}

NamespaceService is a test implementation of [nexus.NamespaceService] and [namespace.Replicator] that allows you to easily override its methods. It will panic if any of its methods are called without their respective On* fields being set.

func (*NamespaceService) GetNamespace

func (*NamespaceService) HandleTransmissionTask

func (n *NamespaceService) HandleTransmissionTask(
	ctx context.Context,
	namespaceOperation enumsspb.NamespaceOperation,
	info *persistencespb.NamespaceInfo,
	config *persistencespb.NamespaceConfig,
	replicationConfig *persistencespb.NamespaceReplicationConfig,
	nexusOutgoingServices []*persistencespb.NexusOutgoingService,
	replicationClusterListUpdated bool,
	configVersion int64,
	failoverVersion int64,
	isGlobalNamespace bool,
	failoverHistory []*persistencespb.FailoverStatus,
) error

func (*NamespaceService) UpdateNamespace

func (n *NamespaceService) UpdateNamespace(ctx context.Context, request *persistence.UpdateNamespaceRequest) error

Jump to

Keyboard shortcuts

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