Skip to content

add reverse converter #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/src/main/scala/flatgraph/storage/Deserialization.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Deserialization {
val fileChannel = new java.io.RandomAccessFile(storagePath.toAbsolutePath.toFile, "r").getChannel
try {
// fixme: Use convenience methods from schema to translate string->id. Fix after we get strict schema checking.
val manifest = readManifest(fileChannel)
val manifest = GraphItem.read(readManifest(fileChannel))
val pool = readPool(manifest, fileChannel)
val schema = schemaMaybe.getOrElse(freeSchemaFromManifest(manifest))
val storagePathMaybe =
Expand Down Expand Up @@ -140,7 +140,7 @@ object Deserialization {
}
}

private def readManifest(channel: FileChannel): GraphItem = {
def readManifest(channel: FileChannel): ujson.Value = {
if (channel.size() < HeaderSize)
throw new DeserializationException(s"corrupt file, expected at least $HeaderSize bytes, but only found ${channel.size()}")

Expand All @@ -162,8 +162,8 @@ object Deserialization {
readBytes += channel.read(manifestBytes, readBytes + manifestOffset)
}
manifestBytes.flip()
val jsonObj = ujson.read(manifestBytes)
GraphItem.read(jsonObj)
ujson.read(manifestBytes)

}

private def readPool(manifest: GraphItem, fileChannel: FileChannel): Array[String] = {
Expand Down
Loading
Loading