history

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataKeyClientClusterID = "temporal-client-cluster-id"
	MetadataKeyClientShardID   = "temporal-client-shard-id"
	MetadataKeyServerClusterID = "temporal-server-cluster-id"
	MetadataKeyServerShardID   = "temporal-server-shard-id"
)
View Source
const (
	// DefaultTimeout is the default timeout used to make calls
	DefaultTimeout = time.Second * 30 * debug.TimeoutMultiplier
)

Variables

This section is empty.

Functions

func DecodeClusterShardMD

func DecodeClusterShardMD(
	getter headers.HeaderGetter,
) (client ClusterShardID, server ClusterShardID, err error)

func EncodeClusterShardMD

func EncodeClusterShardMD(
	sourceClusterShardID ClusterShardID,
	targetClusterShardID ClusterShardID,
) metadata.MD

func NewClient

func NewClient(
	dc *dynamicconfig.Collection,
	historyServiceResolver membership.ServiceResolver,
	logger log.Logger,
	numberOfShards int32,
	rpcFactory RPCFactory,
	timeout time.Duration,
) historyservice.HistoryServiceClient

NewClient creates a new history service gRPC client

func NewConnectionPool

func NewConnectionPool[C any](
	historyServiceResolver membership.ServiceResolver,
	rpcFactory RPCFactory,
	clientCtor func(grpc.ClientConnInterface) C,
	logger log.Logger,
	connectionCloseDelay dynamicconfig.DurationPropertyFn,
) *connectionPoolImpl[C]

func NewMetricClient

func NewMetricClient(
	client historyservice.HistoryServiceClient,
	metricsHandler metrics.Handler,
	logger log.Logger,
	throttledLogger log.Logger,
) historyservice.HistoryServiceClient

NewMetricClient creates a new instance of historyservice.HistoryServiceClient that emits metrics

func NewRetryableClient

NewRetryableClient creates a new instance of historyservice.HistoryServiceClient with retry policy

Types

type BasicRedirector

type BasicRedirector[C any] struct {
	// contains filtered or unexported fields
}

func NewBasicRedirector

func NewBasicRedirector[C any](
	connections connectionPool[C],
	historyServiceResolver membership.ServiceResolver,
) *BasicRedirector[C]

func (*BasicRedirector[C]) Close

func (r *BasicRedirector[C]) Close()

func (*BasicRedirector[C]) Execute

func (r *BasicRedirector[C]) Execute(ctx context.Context, shardID int32, op ClientOperation[C]) error

type CachingRedirector

type CachingRedirector[C any] struct {
	// contains filtered or unexported fields
}

A CachingRedirector is a redirector that maintains a cache of shard owners, and uses that cache instead of querying membership for each operation. Cache entries are evicted either for shard ownership lost errors, or for any error that might indicate the history instance is no longer available, including timeouts.

func NewCachingRedirector

func NewCachingRedirector[C any](
	connections connectionPool[C],
	historyServiceResolver membership.ServiceResolver,
	logger log.Logger,
	staleTTL dynamicconfig.DurationPropertyFn,
) *CachingRedirector[C]

func (*CachingRedirector[C]) Close

func (r *CachingRedirector[C]) Close()

func (*CachingRedirector[C]) Execute

func (r *CachingRedirector[C]) Execute(ctx context.Context, shardID int32, op ClientOperation[C]) error

type ClientOperation

type ClientOperation[C any] func(ctx context.Context, client C) error

type ClusterShardID

type ClusterShardID struct {
	ClusterID int32
	ShardID   int32
}

type RPCFactory

type RPCFactory interface {
	CreateHistoryGRPCConnection(rpcAddress string) *grpc.ClientConn
}

RPCFactory is a subset of the github.com/superdurable/xtemporal/common/rpc.RPCFactory interface to make testing easier.

type Redirector

type Redirector[C any] interface {
	Execute(ctx context.Context, shardID int32, op ClientOperation[C]) error

	// Close releases the underlying connection pool.
	Close()
	// contains filtered or unexported methods
}

A Redirector executes a client operation against a history instance. If the operation is intended for the owner of a shard, and the request returns a shard ownership lost error with a hint for a new shard owner, the redirector will retry the request to the new owner.

Directories

Path Synopsis
Package historytest contains library test functions for history.NewClient that use ahistory task queue manager.
Package historytest contains library test functions for history.NewClient that use ahistory task queue manager.

Jump to

Keyboard shortcuts

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