Language Guide Protocol Buffers (gRPC Tutorial) (Golang/Ruby Examples)

Опубликовано: 04 Ноябрь 2024
на канале: Mario Carrion
3,022
89

Welcome to this System Design video in Golang about learning gRPC. This guides you to defining and implementing Protocol Buffers, the contents supported and the different keywords used to implement those. I use three categories to define those sections:

■ Configuration,
■ Data, and
■ Behavior

== Configuration

Consists of "syntax", "package" and file "options"

== Data

Consists of "messages" and "enumerations"

=== Messages

Messages have up to 4 parts and in some cases define some extra keywords to define more things, the typical four parts are:

■ Field Type, like
■■ Floating numbers: double/float
■■ Integers: int32/int64/uint32/uint64/sint32/sint64
■■ Bytes: fixed32/fixed34/fixed64/sfixed/sfixed64/bytes
■■ Boolean: bool
■■ Important note: a parsed message uses default values for encoded messages not including a particular single element
■■■ Numeric types: default to zero
■■■ Bytes types: default to empty
■■■ Booleans: default to false
■■■ Enums: default to the first enum value, which should be 0
■■■ Message fields: field is not set, it's language specific, like null
■ Field Name: Literally the field name
■ Field Number: This is a unique value used to identify the fields in the message binary format
■ Field Rule, like "repeated", Indicates whether the field supports more than one or not, typically represented as arrays or the equivalent in the generated programming language, some programming languages had a "has_FIELD" method
■ Lastly "optional" to indicate a "nullable" type
■ "Special cases"
■■ Maps: it's a shortcut to create an associate map as part of our data definition, supports any scalar type (except floating point types) and bytes as keys.
■■ Any: The Any message type lets you use messages as embedded types without having their .proto definition, this means literally any protocol buffer type can be assigned to this field
■■ oneof: Used to define a field where at most one field will be set at the same time

=== Options

Options do not change the meaning of a declaration but may affect the way it's handled in a particular context, the could be: Top level, Message level or Field level.

=== Enumerations

Represent a predefined-list of values,

== Relevant links

■ gPRC Series: Introduction to Protocol Buffers (Golang/Ruby Examples):    • Introduction to Protocol Buffers (gRP...  
■ Software Architecture and System Design in Go/Golang:    • Software Architecture and System Desi...  
■ Example code: https://github.com/MarioCarrion/video...
■ Protocol Buffers - Google's data interchange format: https://github.com/protocolbuffers/pr...
■ A new way of working with Protocol Buffers. https://github.com/bufbuild/buf

== All Go/Golang Playlists

■ Building Microservices in Go/Golang:    • Building Microservices in Golang/Go  
■ Go/Golang Tools and Packages:    • Golang/Go Tools and Packages  
■ Learning Concurrency Patterns in Go/Golang:    • Learning Go/Golang Concurrency Patterns  
■ Learning Go/Golang :    • Learning Go/Golang  
■ Learning Relational Databases in Go/Golang:    • Learning Go/Golang: Relational Databases  
■ Testing in Go/Golang:    • Testing in Golang/Go  

== Socials

■   / mariocarrion  
■   / mario.carrion  
■   / mariocarrion  

00:00 Start
00:23 Sections in Protocol Buffers
00:56 Messages in Protocol Buffers
06:00 Options in Protocol Buffers
08:40 Enumerations in Protocol Buffers
10:27 Conclusions about Protocol Buffers

=== Who am I?

Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and System Design!

Keep it up. Don't give up!

#golang #grpc #systemdesign

=== Our Vlog Channel

   / rubycarrion  

=== Affiliate links

■ Amazon Shop 🛒 https://www.amazon.com/shop/rubycarrion
■ Technical/Non-technical Books - Recommended by Mario Carrion 📚 https://www.amazon.com/shop/rubycarri...

DISCLAIMER: Some of the links shared above are affiliate links. As a member of these affiliate programs, I earn a small commission from your purchases at no additional cost to you. Thank you in advance for your support!