Skip to content

Commit 579b2e6

Browse files
committed
grooming schema registry
1 parent 3cb8023 commit 579b2e6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

java/arcs/core/data/SchemaRegistry.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
*/
1111
package arcs.core.data
1212

13+
14+
typealias SchemaHash = String
15+
1316
/**
1417
* A registry for generated [Schema]s.
1518
*/
1619
object SchemaRegistry {
17-
private val schemas: MutableMap<String, Schema> = mutableMapOf()
20+
private val schemas = mutableMapOf<SchemaHash, Schema>()
1821

1922
/** Store a [Schema] in the registry. */
2023
fun register(schema: Schema) {
2124
schemas[schema.hash] = schema
2225
}
2326

24-
/** Given a schema hash as a [String], return the [Schema] for that hash, if it exists. */
25-
fun fromHash(hash: String) = schemas[hash]
27+
/** Given a [SchemaHash], return the [Schema] for that hash, if it exists. */
28+
fun fromHash(hash: SchemaHash) = schemas[hash]
2629
}

0 commit comments

Comments
 (0)