Files
tasks/common/persistence/sql/sqlplugin/nexus_endpoints.go
Roey BermanandGitHub f6a0b43a8c Nexus Endpoints (#5855)
## What changed?

- Refactored Nexus Registry code to merge incoming and outgoing into one
registry
- Added separate concept of "endpoints" - which is roughly analogous to
what was previously called "services"
- Upgraded the Nexus Go SDK and API dependencies accordingly
- Command handler interface was modified to accept a context given new
requirements
- Note that invoking a worker endpoint is not yet supported, there will
be some minor restructuring required to enable that
- Requires this unmerged API PR
https://github.com/temporalio/api/pull/403. The two PRs should be merged
together.
## Why?

Part of late redesign. See also https://github.com/nexus-rpc/api/pull/5

## How did you test it?

Modified existing and added new tests.
2024-05-09 12:17:52 -07:00

56 lines
2.2 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 sqlplugin
import (
"context"
"database/sql"
)
type (
NexusEndpointsRow struct {
ID []byte
Version int64
Data []byte
DataEncoding string
}
ListNexusEndpointsRequest struct {
LastID []byte
Limit int
}
// NexusEndpoints is the SQL persistence interface for Nexus endpoints
NexusEndpoints interface {
InitializeNexusEndpointsTableVersion(ctx context.Context) (sql.Result, error)
IncrementNexusEndpointsTableVersion(ctx context.Context, lastKnownTableVersion int64) (sql.Result, error)
GetNexusEndpointsTableVersion(ctx context.Context) (int64, error)
InsertIntoNexusEndpoints(ctx context.Context, row *NexusEndpointsRow) (sql.Result, error)
UpdateNexusEndpoint(ctx context.Context, row *NexusEndpointsRow) (sql.Result, error)
GetNexusEndpointByID(ctx context.Context, serviceID []byte) (*NexusEndpointsRow, error)
ListNexusEndpoints(ctx context.Context, request *ListNexusEndpointsRequest) ([]NexusEndpointsRow, error)
DeleteFromNexusEndpoints(ctx context.Context, id []byte) (sql.Result, error)
}
)