Documentation
¶
Overview ¶
Package namespace is a generated GoMock package.
Index ¶
- Constants
- type ArchivalConfigEvent
- type ArchivalConfigState
- type BadBinaryError
- type CustomSearchAttributesMapper
- type GetNamespaceOptions
- type ID
- type MockRegistry
- func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
- func (m *MockRegistry) GetCustomSearchAttributesMapper(name Name) (CustomSearchAttributesMapper, error)
- func (m *MockRegistry) GetNamespace(name Name) (*Namespace, error)
- func (m *MockRegistry) GetNamespaceByID(id ID) (*Namespace, error)
- func (m *MockRegistry) GetNamespaceByIDWithOptions(id ID, opts GetNamespaceOptions) (*Namespace, error)
- func (m *MockRegistry) GetNamespaceID(name Name) (ID, error)
- func (m *MockRegistry) GetNamespaceName(id ID) (Name, error)
- func (m *MockRegistry) GetNamespaceWithOptions(name Name, opts GetNamespaceOptions) (*Namespace, error)
- func (m *MockRegistry) GetPingChecks() []pingable.Check
- func (m *MockRegistry) GetRegistrySize() (int64, int64)
- func (m *MockRegistry) RefreshNamespaceById(namespaceId ID) (*Namespace, error)
- func (m *MockRegistry) RegisterStateChangeCallback(key any, cb StateChangeCallbackFn)
- func (m *MockRegistry) Start()
- func (m *MockRegistry) Stop()
- func (m *MockRegistry) UnregisterStateChangeCallback(key any)
- type MockRegistryMockRecorder
- func (mr *MockRegistryMockRecorder) GetCustomSearchAttributesMapper(name any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespace(name any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespaceByID(id any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespaceByIDWithOptions(id, opts any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespaceID(name any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespaceName(id any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetNamespaceWithOptions(name, opts any) *gomock.Call
- func (mr *MockRegistryMockRecorder) GetPingChecks() *gomock.Call
- func (mr *MockRegistryMockRecorder) GetRegistrySize() *gomock.Call
- func (mr *MockRegistryMockRecorder) RefreshNamespaceById(namespaceId any) *gomock.Call
- func (mr *MockRegistryMockRecorder) RegisterStateChangeCallback(key, cb any) *gomock.Call
- func (mr *MockRegistryMockRecorder) Start() *gomock.Call
- func (mr *MockRegistryMockRecorder) Stop() *gomock.Call
- func (mr *MockRegistryMockRecorder) UnregisterStateChangeCallback(key any) *gomock.Call
- type Mutation
- func WithActiveCluster(name string) Mutation
- func WithBadBinary(chksum string) Mutation
- func WithData(key, value string) Mutation
- func WithGlobalFlag(b bool) Mutation
- func WithID(id string) Mutation
- func WithNotificationVersion(v int64) Mutation
- func WithPretendLocalNamespace(localClusterName string) Mutation
- func WithRetention(dur *durationpb.Duration) Mutation
- type Name
- type Namespace
- func FromPersistentState(detail *persistencespb.NamespaceDetail, resolver ReplicationResolver, ...) (*Namespace, error)
- func NewGlobalNamespaceForTest(info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, ...) *Namespace
- func NewLocalNamespaceForTest(info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, ...) *Namespace
- func NewNamespaceForTest(info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, ...) *Namespace
- func (ns *Namespace) ActiveClusterName(businessID string) string
- func (ns *Namespace) ActiveInCluster(clusterName string) bool
- func (ns *Namespace) Clone(mutations ...Mutation) *Namespace
- func (ns *Namespace) ClusterNames(businessID string) []string
- func (ns *Namespace) ConfigVersion() int64
- func (ns *Namespace) CustomSearchAttributesMapper() CustomSearchAttributesMapper
- func (ns *Namespace) FailoverNotificationVersion() int64
- func (ns *Namespace) FailoverVersion(businessID string) int64
- func (ns *Namespace) GetCustomData(key string) string
- func (ns *Namespace) GetReplicationResolver() ReplicationResolver
- func (ns *Namespace) GetWorkflowRule(ruleID string) (*rulespb.WorkflowRule, bool)
- func (ns *Namespace) GetWorkflowRules() []*rulespb.WorkflowRule
- func (ns *Namespace) HistoryArchivalState() ArchivalConfigState
- func (ns *Namespace) ID() ID
- func (ns *Namespace) IsGlobalNamespace() bool
- func (ns *Namespace) IsOnCluster(clusterName string) bool
- func (ns *Namespace) Name() Name
- func (ns *Namespace) NotificationVersion() int64
- func (ns *Namespace) ReplicationPolicy() ReplicationPolicy
- func (ns *Namespace) ReplicationState() enumspb.ReplicationState
- func (ns *Namespace) Retention() time.Duration
- func (ns *Namespace) State() enumspb.NamespaceState
- func (ns *Namespace) VerifyBinaryChecksum(cksum string) error
- func (ns *Namespace) VisibilityArchivalState() ArchivalConfigState
- type Namespaces
- type Registry
- type ReplicationPolicy
- type ReplicationResolver
- type ReplicationResolverFactory
- type StateChangeCallbackFn
Constants ¶
const ( // MinRetentionGlobal is a hard limit for the minimun retention duration for global // namespaces (to allow time for replication). MinRetentionGlobal = 1 * 24 * time.Hour // MinRetentionLocal is a hard limit for the minimun retention duration for local // namespaces. Allow short values but disallow zero to avoid confusion with // interpreting zero as infinite. MinRetentionLocal = 1 * time.Hour )
const ( EmptyName Name = "" EmptyID ID = "" EmptyBusinessID = "" // ReplicationPolicyOneCluster indicate that workflows does not need to be replicated // applicable to local namespace & global namespace with one cluster ReplicationPolicyOneCluster ReplicationPolicy = 0 // ReplicationPolicyMultiCluster indicate that workflows need to be replicated ReplicationPolicyMultiCluster ReplicationPolicy = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchivalConfigEvent ¶
type ArchivalConfigEvent struct {
DefaultURI string
URI string
State enumspb.ArchivalState
}
ArchivalConfigEvent represents a change request to archival config state the only restriction placed on events is that defaultURI is not empty state can be nil, enabled, or disabled (nil indicates no update by user is being attempted)
func (*ArchivalConfigEvent) Validate ¶
func (e *ArchivalConfigEvent) Validate() error
type ArchivalConfigState ¶
type ArchivalConfigState struct {
State enumspb.ArchivalState
URI string
}
ArchivalConfigState represents the state of archival config the only invalid state is {URI="", state=enabled} once URI is set it is immutable
func NeverEnabledState ¶
func NeverEnabledState() *ArchivalConfigState
func (*ArchivalConfigState) GetNextState ¶
func (s *ArchivalConfigState) GetNextState( e *ArchivalConfigEvent, URIValidationFunc func(URI string) error, ) (nextState *ArchivalConfigState, changed bool, err error)
type BadBinaryError ¶
type BadBinaryError struct {
// contains filtered or unexported fields
}
BadBinaryError is an error type carrying additional information about when/why/who configured a given checksum as being bad.
func (BadBinaryError) Checksum ¶
func (e BadBinaryError) Checksum() string
Checksum observes the binary checksum that caused this error.
func (BadBinaryError) Created ¶
func (e BadBinaryError) Created() time.Time
Created returns the time at which this bad binary was declared to be bad.
func (BadBinaryError) Error ¶
func (e BadBinaryError) Error() string
Error returns the reason associated with this bad binary.
func (BadBinaryError) Operator ¶
func (e BadBinaryError) Operator() string
Operator returns the operator associated with this bad binary.
func (BadBinaryError) Reason ¶
func (e BadBinaryError) Reason() string
Reason returns the reason associated with this bad binary.
type CustomSearchAttributesMapper ¶
type CustomSearchAttributesMapper struct {
// contains filtered or unexported fields
}
func (*CustomSearchAttributesMapper) FieldToAliasMap ¶
func (m *CustomSearchAttributesMapper) FieldToAliasMap() map[string]string
func (*CustomSearchAttributesMapper) GetAlias ¶
func (m *CustomSearchAttributesMapper) GetAlias(fieldName string, namespace string) (string, error)
func (*CustomSearchAttributesMapper) GetFieldName ¶
func (m *CustomSearchAttributesMapper) GetFieldName(alias string, namespace string) (string, error)
type GetNamespaceOptions ¶
type GetNamespaceOptions struct {
// Setting this disables the readthrough logic, i.e. only looks at the current in-memory
// registry. This is useful if you want to avoid latency or avoid polluting the negative
// lookup cache. Note that you may get false negatives (namespace not found) if the
// namespace was created very recently.
DisableReadthrough bool
}
type MockRegistry ¶
type MockRegistry struct {
// contains filtered or unexported fields
}
MockRegistry is a mock of Registry interface.
func NewMockRegistry ¶
func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry
NewMockRegistry creates a new mock instance.
func (*MockRegistry) EXPECT ¶
func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRegistry) GetCustomSearchAttributesMapper ¶
func (m *MockRegistry) GetCustomSearchAttributesMapper(name Name) (CustomSearchAttributesMapper, error)
GetCustomSearchAttributesMapper mocks base method.
func (*MockRegistry) GetNamespace ¶
func (m *MockRegistry) GetNamespace(name Name) (*Namespace, error)
GetNamespace mocks base method.
func (*MockRegistry) GetNamespaceByID ¶
func (m *MockRegistry) GetNamespaceByID(id ID) (*Namespace, error)
GetNamespaceByID mocks base method.
func (*MockRegistry) GetNamespaceByIDWithOptions ¶
func (m *MockRegistry) GetNamespaceByIDWithOptions(id ID, opts GetNamespaceOptions) (*Namespace, error)
GetNamespaceByIDWithOptions mocks base method.
func (*MockRegistry) GetNamespaceID ¶
func (m *MockRegistry) GetNamespaceID(name Name) (ID, error)
GetNamespaceID mocks base method.
func (*MockRegistry) GetNamespaceName ¶
func (m *MockRegistry) GetNamespaceName(id ID) (Name, error)
GetNamespaceName mocks base method.
func (*MockRegistry) GetNamespaceWithOptions ¶
func (m *MockRegistry) GetNamespaceWithOptions(name Name, opts GetNamespaceOptions) (*Namespace, error)
GetNamespaceWithOptions mocks base method.
func (*MockRegistry) GetPingChecks ¶
func (m *MockRegistry) GetPingChecks() []pingable.Check
GetPingChecks mocks base method.
func (*MockRegistry) GetRegistrySize ¶
func (m *MockRegistry) GetRegistrySize() (int64, int64)
GetRegistrySize mocks base method.
func (*MockRegistry) RefreshNamespaceById ¶
func (m *MockRegistry) RefreshNamespaceById(namespaceId ID) (*Namespace, error)
RefreshNamespaceById mocks base method.
func (*MockRegistry) RegisterStateChangeCallback ¶
func (m *MockRegistry) RegisterStateChangeCallback(key any, cb StateChangeCallbackFn)
RegisterStateChangeCallback mocks base method.
func (*MockRegistry) UnregisterStateChangeCallback ¶
func (m *MockRegistry) UnregisterStateChangeCallback(key any)
UnregisterStateChangeCallback mocks base method.
type MockRegistryMockRecorder ¶
type MockRegistryMockRecorder struct {
// contains filtered or unexported fields
}
MockRegistryMockRecorder is the mock recorder for MockRegistry.
func (*MockRegistryMockRecorder) GetCustomSearchAttributesMapper ¶
func (mr *MockRegistryMockRecorder) GetCustomSearchAttributesMapper(name any) *gomock.Call
GetCustomSearchAttributesMapper indicates an expected call of GetCustomSearchAttributesMapper.
func (*MockRegistryMockRecorder) GetNamespace ¶
func (mr *MockRegistryMockRecorder) GetNamespace(name any) *gomock.Call
GetNamespace indicates an expected call of GetNamespace.
func (*MockRegistryMockRecorder) GetNamespaceByID ¶
func (mr *MockRegistryMockRecorder) GetNamespaceByID(id any) *gomock.Call
GetNamespaceByID indicates an expected call of GetNamespaceByID.
func (*MockRegistryMockRecorder) GetNamespaceByIDWithOptions ¶
func (mr *MockRegistryMockRecorder) GetNamespaceByIDWithOptions(id, opts any) *gomock.Call
GetNamespaceByIDWithOptions indicates an expected call of GetNamespaceByIDWithOptions.
func (*MockRegistryMockRecorder) GetNamespaceID ¶
func (mr *MockRegistryMockRecorder) GetNamespaceID(name any) *gomock.Call
GetNamespaceID indicates an expected call of GetNamespaceID.
func (*MockRegistryMockRecorder) GetNamespaceName ¶
func (mr *MockRegistryMockRecorder) GetNamespaceName(id any) *gomock.Call
GetNamespaceName indicates an expected call of GetNamespaceName.
func (*MockRegistryMockRecorder) GetNamespaceWithOptions ¶
func (mr *MockRegistryMockRecorder) GetNamespaceWithOptions(name, opts any) *gomock.Call
GetNamespaceWithOptions indicates an expected call of GetNamespaceWithOptions.
func (*MockRegistryMockRecorder) GetPingChecks ¶
func (mr *MockRegistryMockRecorder) GetPingChecks() *gomock.Call
GetPingChecks indicates an expected call of GetPingChecks.
func (*MockRegistryMockRecorder) GetRegistrySize ¶
func (mr *MockRegistryMockRecorder) GetRegistrySize() *gomock.Call
GetRegistrySize indicates an expected call of GetRegistrySize.
func (*MockRegistryMockRecorder) RefreshNamespaceById ¶
func (mr *MockRegistryMockRecorder) RefreshNamespaceById(namespaceId any) *gomock.Call
RefreshNamespaceById indicates an expected call of RefreshNamespaceById.
func (*MockRegistryMockRecorder) RegisterStateChangeCallback ¶
func (mr *MockRegistryMockRecorder) RegisterStateChangeCallback(key, cb any) *gomock.Call
RegisterStateChangeCallback indicates an expected call of RegisterStateChangeCallback.
func (*MockRegistryMockRecorder) Start ¶
func (mr *MockRegistryMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockRegistryMockRecorder) Stop ¶
func (mr *MockRegistryMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockRegistryMockRecorder) UnregisterStateChangeCallback ¶
func (mr *MockRegistryMockRecorder) UnregisterStateChangeCallback(key any) *gomock.Call
UnregisterStateChangeCallback indicates an expected call of UnregisterStateChangeCallback.
type Mutation ¶
type Mutation interface {
// contains filtered or unexported methods
}
Mutation changes a Namespace "in-flight" during a Clone operation.
func WithActiveCluster ¶
WithActiveCluster assigns the active cluster to a Namespace during a Clone operation.
func WithBadBinary ¶
WithBadBinary adds a bad binary checksum to a Namespace during a Clone operation.
func WithGlobalFlag ¶
WithGlobalFlag sets whether or not this Namespace is global.
func WithNotificationVersion ¶
WithNotificationVersion assigns a notification version to the Namespace.
func WithRetention ¶
func WithRetention(dur *durationpb.Duration) Mutation
WithRetention assigns the retention duration to a Namespace during a Clone operation.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace contains the info and config for a namespace
func FromPersistentState ¶
func FromPersistentState( detail *persistencespb.NamespaceDetail, resolver ReplicationResolver, mutations ...Mutation, ) (*Namespace, error)
func NewGlobalNamespaceForTest ¶
func NewGlobalNamespaceForTest( info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, repConfig *persistencespb.NamespaceReplicationConfig, failoverVersion int64, ) *Namespace
newGlobalNamespaceForTest returns an entry with test data
func NewLocalNamespaceForTest ¶
func NewLocalNamespaceForTest( info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, targetCluster string, ) *Namespace
NewLocalNamespaceForTest returns an entry with test data
func NewNamespaceForTest ¶
func NewNamespaceForTest( info *persistencespb.NamespaceInfo, config *persistencespb.NamespaceConfig, isGlobalNamespace bool, repConfig *persistencespb.NamespaceReplicationConfig, failoverVersion int64, ) *Namespace
NewNamespaceForTest returns an entry with test data
func (*Namespace) ActiveClusterName ¶
ActiveClusterName observes the name of the cluster that is currently active for this namspace.
func (*Namespace) ActiveInCluster ¶
ActiveInCluster returns whether the namespace is active in the given cluster. A namespace is considered active if it is either a local namespace or a global namespace whose active cluster matches the provided cluster. Note: Do not use this to determine if a workflow is active in the cluster. Use ActiveClusterName(businessID) instead.
func (*Namespace) ClusterNames ¶
ClusterNames observes the names of the clusters to which this namespace is replicated.
func (*Namespace) ConfigVersion ¶
ConfigVersion return the namespace config version
func (*Namespace) CustomSearchAttributesMapper ¶
func (ns *Namespace) CustomSearchAttributesMapper() CustomSearchAttributesMapper
CustomSearchAttributesMapper is a part of temporary solution. Do not use this method.
func (*Namespace) FailoverNotificationVersion ¶
FailoverNotificationVersion return the global notification version of when failover happened
func (*Namespace) FailoverVersion ¶
FailoverVersion return the namespace failover version
func (*Namespace) GetCustomData ¶
func (*Namespace) GetReplicationResolver ¶
func (ns *Namespace) GetReplicationResolver() ReplicationResolver
GetReplicationResolver return the replication resolover
func (*Namespace) GetWorkflowRule ¶
func (ns *Namespace) GetWorkflowRule(ruleID string) (*rulespb.WorkflowRule, bool)
func (*Namespace) GetWorkflowRules ¶
func (ns *Namespace) GetWorkflowRules() []*rulespb.WorkflowRule
func (*Namespace) HistoryArchivalState ¶
func (ns *Namespace) HistoryArchivalState() ArchivalConfigState
HistoryArchivalState observes the history archive configuration (state and URI) for this namespace.
func (*Namespace) IsGlobalNamespace ¶
IsGlobalNamespace returns whether the namespace is a global namespace. Being a global namespace doesn't necessarily mean that there are multiple registered clusters for it, only that it has a failover version. To determine whether operations should be replicated for a namespace, see ReplicationPolicy.
func (*Namespace) IsOnCluster ¶
IsOnCluster returns true is namespace is registered on cluster otherwise false.
func (*Namespace) NotificationVersion ¶
NotificationVersion return the global notification version of when namespace changed
func (*Namespace) ReplicationPolicy ¶
func (ns *Namespace) ReplicationPolicy() ReplicationPolicy
ReplicationPolicy return the derived workflow replication policy
func (*Namespace) ReplicationState ¶
func (ns *Namespace) ReplicationState() enumspb.ReplicationState
func (*Namespace) State ¶
func (ns *Namespace) State() enumspb.NamespaceState
func (*Namespace) VerifyBinaryChecksum ¶
VerifyBinaryChecksum returns an error if the provided checksum is one of this namespace's configured bad binary checksums. The returned error (if any) will be unwrappable as BadBinaryError.
func (*Namespace) VisibilityArchivalState ¶
func (ns *Namespace) VisibilityArchivalState() ArchivalConfigState
VisibilityArchivalState observes the visibility archive configuration (state and URI) for this namespace.
type Registry ¶
type Registry interface {
pingable.Pingable
GetNamespace(name Name) (*Namespace, error)
GetNamespaceWithOptions(name Name, opts GetNamespaceOptions) (*Namespace, error)
GetNamespaceByID(id ID) (*Namespace, error)
RefreshNamespaceById(namespaceId ID) (*Namespace, error)
GetNamespaceByIDWithOptions(id ID, opts GetNamespaceOptions) (*Namespace, error)
GetNamespaceID(name Name) (ID, error)
GetNamespaceName(id ID) (Name, error)
GetRegistrySize() (sizeOfCacheByName int64, sizeOfCacheByID int64)
// Registers callback for namespace state changes.
// StateChangeCallbackFn will be invoked for a new/deleted namespace or namespace that has
// State, ReplicationState, ActiveCluster, or isGlobalNamespace config changed.
RegisterStateChangeCallback(key any, cb StateChangeCallbackFn)
UnregisterStateChangeCallback(key any)
// GetCustomSearchAttributesMapper is a temporary solution to be able to get search attributes
// with from persistence if forceSearchAttributesCacheRefreshOnRead is true.
GetCustomSearchAttributesMapper(name Name) (CustomSearchAttributesMapper, error)
Start()
Stop()
}
Registry provides access to Namespace objects by name or by ID.
type ReplicationPolicy ¶
type ReplicationPolicy int
ReplicationPolicy is the namespace's replication policy, derived from namespace's replication config
type ReplicationResolver ¶
type ReplicationResolver interface {
ActiveClusterName(businessID string) string
ActiveInCluster(clusterName string) bool
ClusterNames(businessID string) []string
ReplicationState() enumspb.ReplicationState
IsGlobalNamespace() bool
FailoverVersion(businessID string) int64
FailoverNotificationVersion() int64
// Mutation methods for modifying resolver state
SetGlobalFlag(isGlobal bool)
SetActiveCluster(clusterName string)
PretendLocalNamespace(localClusterName string)
// Clone returns a deep copy of the resolver
Clone() ReplicationResolver
}
type ReplicationResolverFactory ¶
type ReplicationResolverFactory func(*persistencespb.NamespaceDetail) ReplicationResolver
func NewDefaultReplicationResolverFactory ¶
func NewDefaultReplicationResolverFactory() ReplicationResolverFactory
type StateChangeCallbackFn ¶
StateChangeCallbackFn can be registered to be called on any namespace state change or addition/removal from database, plus once for all namespaces after registration. There is no guarantee about when these are called.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package nsregistry provides a cached namespace registry that reduces load on persistence by maintaining an in-memory cache of namespace information.
|
Package nsregistry provides a cached namespace registry that reduces load on persistence by maintaining an in-memory cache of namespace information. |
|
Package nsreplication is a generated GoMock package.
|
Package nsreplication is a generated GoMock package. |