Skip to content

Commit

Permalink
Merge pull request #150 from disneystreaming/change-protobuf-timestam…
Browse files Browse the repository at this point in the history
…p-format-specification

Change specification of `@protoTimestampFormat`
  • Loading branch information
Baccata authored Mar 14, 2024
2 parents 67d2816 + 88e46a1 commit ddf361b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/serialisation/protobuf.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Protobuf supports a number of [scalar types](https://developers.google.com/proto
| long | SIGNED | N/A | sint64 |
| long | UNSIGNED | N/A | uint64 |
| timestamp | N/A | none or PROTOBUF | message { long seconds = 1; long nanos = 2; } |
| timestamp | N/A | EPOCH_MILLIS | int64 |
| timestamp | N/A | EPOCH_MILLIS | message { long milliseconds = 1; |

#### alloy.proto#protoWrapped

Expand Down Expand Up @@ -103,7 +103,7 @@ See [here](https://protobuf.dev/programming-guides/proto3/#scalar) for documenta

Timestamp shapes can be annotated with the `@alloy.proto#protoTimestampFormat` trait in order to signal what type of encoding should be used for timestamps in proto serialisation/deserialisation.

Possible values are `PROTOBUF` and `EPOCH_MILLIS`. `PROTOBUF` is the default that is used in the absence of this trait. When `EPOCH_MILLIS` is specified then the timestamp will be represented as an `int64` in the corresponding proto definition.
Possible values are `PROTOBUF` and `EPOCH_MILLIS`. `PROTOBUF` is the default that is used in the absence of this trait. When `EPOCH_MILLIS` is specified then the timestamp will be represented as a wrapped `int64` in the corresponding proto definition.

#### UUIDs

Expand Down
4 changes: 4 additions & 0 deletions modules/protobuf/resources/alloy/protobuf/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ message CompactUUID {
int64 upper_bits = 1;
int64 lower_bits = 2;
}

message EpochMillisTimestamp {
int64 milliseconds = 1;
}
5 changes: 5 additions & 0 deletions modules/protobuf/resources/alloy/protobuf/wrappers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ message TimestampValue {
google.protobuf.Timestamp value = 1;
}

message EpochMillisTimestampValue {
alloy.protobuf.EpochMillisTimestamp value = 1;
}


message DocumentValue {
google.protobuf.Value value = 1;
}
Expand Down

0 comments on commit ddf361b

Please sign in to comment.