mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
In addition I've: - Extended the DC to disable Nexus APIs entirely (`frontend.enableNexusAPIs`) - Fixed a path where outgoing service registry could be lost - Incremented namespace config version that was missed in the original PR - Changed uses of `docker-compose` to `docker compose` to work around CI failures
67 lines
2.8 KiB
Go
67 lines
2.8 KiB
Go
// The MIT License
|
|
//
|
|
// Copyright (c) 2024 Temporal Technologies Inc. All rights reserved.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
// in the Software without restriction, including without limitation the rights
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
// THE SOFTWARE.
|
|
|
|
package nexustest
|
|
|
|
import (
|
|
"context"
|
|
|
|
enumsspb "go.temporal.io/server/api/enums/v1"
|
|
persistencespb "go.temporal.io/server/api/persistence/v1"
|
|
"go.temporal.io/server/common/nexus"
|
|
"go.temporal.io/server/common/persistence"
|
|
)
|
|
|
|
// 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.
|
|
type NamespaceService struct {
|
|
OnGetNamespace func(ctx context.Context, request *persistence.GetNamespaceRequest) (*persistence.GetNamespaceResponse, error)
|
|
OnUpdateNamespace func(ctx context.Context, request *persistence.UpdateNamespaceRequest) error
|
|
}
|
|
|
|
var _ nexus.NamespaceService = (*NamespaceService)(nil)
|
|
|
|
func (n *NamespaceService) GetNamespace(ctx context.Context, request *persistence.GetNamespaceRequest) (*persistence.GetNamespaceResponse, error) {
|
|
return n.OnGetNamespace(ctx, request)
|
|
}
|
|
|
|
func (n *NamespaceService) UpdateNamespace(ctx context.Context, request *persistence.UpdateNamespaceRequest) error {
|
|
return n.OnUpdateNamespace(ctx, request)
|
|
}
|
|
|
|
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 {
|
|
return nil
|
|
}
|