Перейти к содержимому

Protobuf: Stop Inventing Timestamp Formats

Learning Podcasts

0:00 / 0:00

Protobuf: Stop Inventing Timestamp Formats

143 просмотра · 2 месяца назад
Learning Podcasts
5,59 тыс. подписчиков
143 просмотра · 2 месяца назад
Every backend has a time story. One team stores epoch seconds, another stores ISO strings, and a third splits seconds and nanos. Those choices can all make sense locally, but they become a compatibility problem once services exchange data. This chapter walks through protobuf's well-known types as a standard library for common data shapes: Timestamp for concrete instants, Duration for spans of time, Any for runtime-discovered message types, Struct and Value for JSON-shaped data, and wrapper messages for older nullable scalar patterns. We also cover why proto3 optional changed the wrapper recommendation, how Proto JSON gives these types special external shapes, and why a custom timestamp field plus a comment usually ages into policy drift. Built from public docs, papers, talks, and code, then vetted by senior software engineers for correctness, tradeoffs, and production risks. 0:00 Three clocks, one contract 0:49 Protobuf's standard library 1:23 Timestamp is a point in time 2:10 Time zones are a display concern 2:53 Duration is a span, not a moment 3:42 Import the type, then use the full name 4:31 Any carries a message whose type is discovered later 5:15 Any versus oneof 6:07 Struct is the JSON escape hatch 7:14 Wrappers are nullable scalar messages 8:00 Optional changed the default recommendation 8:40 Proto JSON makes these types look natural 9:35 The custom timestamp trap 10:25 The rule of thumb 11:06 Closing and next topic Full series playlist (12 chapters):    • Protobuf for Any Software Engineer   1. Protobuf Ch.1: Schema and Serialization:    • Protobuf Ch.1: Schema and Serialization   2. Protobuf Ch.2: Writing Proto Files:    • Protobuf Ch.2: Writing Proto Files   3. Protobuf Ch.3: Code Generation:    • Protobuf Ch.3: Code Generation   4. Protobuf Ch.4: 87% Smaller Than JSON:    • Protobuf is 87% Smaller Than JSON!   5. Protobuf Maps Are Just Repeated Messages:    • Protobuf Maps Are Just Repeated Messages   6. Protobuf Ch.6: Optional Is Just a Synthetic Oneof:    • Protobuf Optional Is Just a Synthetic Oneof   7. Protobuf: Zero, False, Empty, or Missing?:    • Protobuf: Zero, False, Empty, or Missing?   8. Protobuf: Stop Inventing Timestamp Formats (this video):    • Protobuf: Stop Inventing Timestamp Formats   9. Change Protobuf Schemas Without Breaking Production:    • Change Protobuf Schemas Without Breaking P...   10. Protobuf vs JSON: When Is a Schema Worth It?:    • Protobuf vs JSON: When Is a Schema Worth It?   11. Protobuf Services: API Contracts Beyond Messages 12. Common Protobuf Mistakes That Break Compatibility Subscribe to catch every chapter. 🌍 Subtitles: 🇺🇸🇬🇧 English, 🇪🇸 Spanish, 🇫🇷 French, 🇩🇪 German, 🇧🇷🇵🇹 Portuguese, 🇯🇵 Japanese, 🇰🇷 Korean, 🇮🇹 Italian, 🇷🇺 Russian, 🇵🇱 Polish, 🇮🇳 Hindi