misc.python.materialize.zippy.replica_capabilities
1# Copyright Materialize, Inc. and contributors. All rights reserved. 2# 3# Use of this software is governed by the Business Source License 4# included in the LICENSE file at the root of this repository. 5# 6# As of the Change Date specified in that file, in accordance with 7# the Business Source License, use of this software will be governed 8# by the Apache License, Version 2.0. 9 10from enum import Enum 11 12from materialize.zippy.framework import Capabilities, Capability 13 14 15class ReplicaSizeType(Enum): 16 Nodes = 1 17 Workers = 2 18 Both = 3 19 20 21class ReplicaExists(Capability): 22 """A replica exists in the Mz instance.""" 23 24 name: str 25 size_type: ReplicaSizeType 26 size: str 27 28 def __init__(self, name: str) -> None: 29 self.name = name 30 31 32def source_capable_clusters(capabilities: Capabilities) -> list[str]: 33 if len(capabilities.get(ReplicaExists)) > 0: 34 # Default cluster may have multiple replicas, can not be used for sources 35 return ["storage"] 36 else: 37 return ["storage", "quickstart"]
class
ReplicaSizeType(enum.Enum):
Nodes =
<ReplicaSizeType.Nodes: 1>
Workers =
<ReplicaSizeType.Workers: 2>
Both =
<ReplicaSizeType.Both: 3>
class
ReplicaExists(materialize.zippy.framework.Capability):
22class ReplicaExists(Capability): 23 """A replica exists in the Mz instance.""" 24 25 name: str 26 size_type: ReplicaSizeType 27 size: str 28 29 def __init__(self, name: str) -> None: 30 self.name = name
A replica exists in the Mz instance.
size_type: ReplicaSizeType
def
source_capable_clusters(capabilities: materialize.zippy.framework.Capabilities) -> list[str]: