history

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 26 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 added in v1.2.0

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

func EncodeClusterShardMD added in v1.2.0

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 added in v1.2.0

func NewConnectionPool[C any](
	historyServiceResolver membership.ServiceResolver,
	rpcFactory RPCFactory,
	clientCtor func(grpc.ClientConnInterface) C,
) *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 added in v0.3.14

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

Types

type BasicRedirector added in v1.2.0

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

func NewBasicRedirector added in v1.2.0

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

func (*BasicRedirector[C]) Execute added in v1.2.0

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

type CachingRedirector added in v1.2.0

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 added in v1.2.0

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

func (*CachingRedirector[C]) Execute added in v1.2.0

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

type ClientOperation added in v1.2.0

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

type ClusterShardID added in v1.2.0

type ClusterShardID struct {
	ClusterID int32
	ShardID   int32
}

type RPCFactory added in v1.2.0

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

RPCFactory is a subset of the common.RPCFactory interface for testing.

type Redirector added in v1.2.0

type Redirector[C any] interface {
	Execute(ctx context.Context, shardID int32, op ClientOperation[C]) error
	// 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