Skip to content

Commit

Permalink
feat: add migration metadata to common schema
Browse files Browse the repository at this point in the history
This adds a new field, `migrationMetadata`, which has two sub-fields:

- `originalDocument`: the original document, in case we ever need it
- `hypercore`: metadata about the document in the old Hypercore
  • Loading branch information
EvanHahn committed Dec 17, 2024
1 parent e5632e4 commit aab0319
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions proto/common/v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ message Common_1 {
google.protobuf.Timestamp updatedAt = 4 [(required) = true];
VersionId_1 originalVersionId = 5;
bool deleted = 6 [(required) = true];

message MigrationMetadata {
bytes originalDocument = 1;
message HypercoreMetadata {
optional string rootHashChecksum = 1;
optional string signature = 2;
optional string coreKey = 3;
optional uint32 blockIndex = 4;
}
optional HypercoreMetadata hypercore = 2;
}
optional MigrationMetadata migrationMetadata = 7;
}
/* ignored fields and differences from common.json jsonSchema
* id is a byte buffer here and a string in jsonSchema
Expand Down
34 changes: 34 additions & 0 deletions schema/common/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,40 @@
"deleted": {
"description": "Indicates whether the document has been deleted",
"type": "boolean"
},
"migrationMetadata": {
"description": "Metadata about the migration of this document from Mapeo Legacy",
"type": "object",
"properties": {
"originalDocument": {
"description": "Hex-encoded raw document from Mapeo Legacy",
"type": "string"
},
"hypercore": {
"type": "object",
"properties": {
"rootHashChecksum": {
"description": "Checksum of the root hash of the document",
"type": "string",
"minLength": 1
},
"signature": {
"description": "Signature of the document",
"type": "string",
"minLength": 1
},
"coreKey": {
"description": "Core key of the document",
"type": "string",
"minLength": 1
},
"blockIndex": {
"description": "Block index of the document",
"type": "number"
}
}
}
}
}
},
"required": [
Expand Down

0 comments on commit aab0319

Please sign in to comment.