|
31 | 31 | Schema,
|
32 | 32 | SchemaRegistryClient,
|
33 | 33 | SchemaRegistryError,
|
| 34 | + AsyncSchemaRegistryClient, |
34 | 35 | SchemaReference,
|
35 | 36 | ServerConfig
|
36 | 37 | )
|
37 | 38 |
|
38 |
| -_MAGIC_BYTE = 0 |
| 39 | +from .common import ( |
| 40 | + _MAGIC_BYTE, |
| 41 | + topic_subject_name_strategy, |
| 42 | + topic_record_subject_name_strategy, |
| 43 | + record_subject_name_strategy, |
| 44 | + reference_subject_name_strategy |
| 45 | +) |
39 | 46 |
|
40 | 47 | __all__ = [
|
41 | 48 | "ConfigCompatibilityLevel",
|
|
50 | 57 | "RuleSet",
|
51 | 58 | "Schema",
|
52 | 59 | "SchemaRegistryClient",
|
| 60 | + "AsyncSchemaRegistryClient" |
53 | 61 | "SchemaRegistryError",
|
54 | 62 | "SchemaReference",
|
55 | 63 | "ServerConfig",
|
56 | 64 | "topic_subject_name_strategy",
|
57 | 65 | "topic_record_subject_name_strategy",
|
58 | 66 | "record_subject_name_strategy"
|
59 | 67 | ]
|
60 |
| - |
61 |
| - |
62 |
| -def topic_subject_name_strategy(ctx, record_name: Optional[str]) -> Optional[str]: |
63 |
| - """ |
64 |
| - Constructs a subject name in the form of {topic}-key|value. |
65 |
| -
|
66 |
| - Args: |
67 |
| - ctx (SerializationContext): Metadata pertaining to the serialization |
68 |
| - operation. |
69 |
| -
|
70 |
| - record_name (Optional[str]): Record name. |
71 |
| -
|
72 |
| - """ |
73 |
| - return ctx.topic + "-" + ctx.field |
74 |
| - |
75 |
| - |
76 |
| -def topic_record_subject_name_strategy(ctx, record_name: Optional[str]) -> Optional[str]: |
77 |
| - """ |
78 |
| - Constructs a subject name in the form of {topic}-{record_name}. |
79 |
| -
|
80 |
| - Args: |
81 |
| - ctx (SerializationContext): Metadata pertaining to the serialization |
82 |
| - operation. |
83 |
| -
|
84 |
| - record_name (Optional[str]): Record name. |
85 |
| -
|
86 |
| - """ |
87 |
| - return ctx.topic + "-" + record_name if record_name is not None else None |
88 |
| - |
89 |
| - |
90 |
| -def record_subject_name_strategy(ctx, record_name: Optional[str]) -> Optional[str]: |
91 |
| - """ |
92 |
| - Constructs a subject name in the form of {record_name}. |
93 |
| -
|
94 |
| - Args: |
95 |
| - ctx (SerializationContext): Metadata pertaining to the serialization |
96 |
| - operation. |
97 |
| -
|
98 |
| - record_name (Optional[str]): Record name. |
99 |
| -
|
100 |
| - """ |
101 |
| - return record_name if record_name is not None else None |
102 |
| - |
103 |
| - |
104 |
| -def reference_subject_name_strategy(ctx, schema_ref: SchemaReference) -> Optional[str]: |
105 |
| - """ |
106 |
| - Constructs a subject reference name in the form of {reference name}. |
107 |
| -
|
108 |
| - Args: |
109 |
| - ctx (SerializationContext): Metadata pertaining to the serialization |
110 |
| - operation. |
111 |
| -
|
112 |
| - schema_ref (SchemaReference): SchemaReference instance. |
113 |
| -
|
114 |
| - """ |
115 |
| - return schema_ref.name if schema_ref is not None else None |
0 commit comments