Suche senden
Hochladen
CiklumCPPSat24032012:SergeyBratus-GoogleProtocolBuffers
•
Als PPTX, PDF herunterladen
•
0 gefällt mir
•
291 views
Ciklum Ukraine
Folgen
Technologie
Unterhaltung & Humor
Melden
Teilen
Melden
Teilen
1 von 27
Jetzt herunterladen
Empfohlen
Lec 5
Lec 5
Alexander Rusin
Python. Обработка ошибок
Python. Обработка ошибок
Theoretical mechanics department
"Зачем учить F# и как начать: парсим интернет страницу и складываем в базу" А...
"Зачем учить F# и как начать: парсим интернет страницу и складываем в базу" А...
Fwdays
Protobuf
Protobuf
libfetion
Protocol buffers
Protocol buffers
Fabricio Epaminondas
Data Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol Buffers
William Kibira
Mini-Training: Redis
Mini-Training: Redis
Betclic Everest Group Tech Team
Che cosa sono i microservizi?
Che cosa sono i microservizi?
Salvatore Cordiano
Empfohlen
Lec 5
Lec 5
Alexander Rusin
Python. Обработка ошибок
Python. Обработка ошибок
Theoretical mechanics department
"Зачем учить F# и как начать: парсим интернет страницу и складываем в базу" А...
"Зачем учить F# и как начать: парсим интернет страницу и складываем в базу" А...
Fwdays
Protobuf
Protobuf
libfetion
Protocol buffers
Protocol buffers
Fabricio Epaminondas
Data Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol Buffers
William Kibira
Mini-Training: Redis
Mini-Training: Redis
Betclic Everest Group Tech Team
Che cosa sono i microservizi?
Che cosa sono i microservizi?
Salvatore Cordiano
RProtoBuf: protocol buffers for R
RProtoBuf: protocol buffers for R
Romain Francois
Melbourne Microservices Meetup: Agenda for a new Architecture
Melbourne Microservices Meetup: Agenda for a new Architecture
Saul Caganoff
Introduction to Redis
Introduction to Redis
Saeid Zebardast
Redis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
Mongodb, our Swiss Army Knife Database
Mongodb, our Swiss Army Knife Database
Mathieu Poumeyrol
Microservices At Gilt - NYC Microservices Meetup
Microservices At Gilt - NYC Microservices Meetup
Michael Bryzek
About Microservices
About Microservices
Salvatore Cordiano
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Chris Richardson
Google Protocol buffer
Google Protocol buffer
knight1128
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
Matt O'Keefe
Getting Started with Redis
Getting Started with Redis
Faisal Akber
Redis SoCraTes 2014
Redis SoCraTes 2014
steffenbauer
Introduction to Microservices
Introduction to Microservices
André Faria Gomes
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
Redis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs Talks
Redis Labs
Introduction to MicroServices (Oakjug)
Introduction to MicroServices (Oakjug)
Chris Richardson
REDIS intro and how to use redis
REDIS intro and how to use redis
Kris Jeong
Think Small To Go Big - Introduction To Microservices
Think Small To Go Big - Introduction To Microservices
Ryan Baxter
The 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web Frameworks
Kunal Ashar
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
Carlos Abalde
"How keep normal blood pressure using TDD" By Roman Loparev
"How keep normal blood pressure using TDD" By Roman Loparev
Ciklum Ukraine
"Through the three circles of the it hell" by Roman Liashenko
"Through the three circles of the it hell" by Roman Liashenko
Ciklum Ukraine
Weitere ähnliche Inhalte
Andere mochten auch
RProtoBuf: protocol buffers for R
RProtoBuf: protocol buffers for R
Romain Francois
Melbourne Microservices Meetup: Agenda for a new Architecture
Melbourne Microservices Meetup: Agenda for a new Architecture
Saul Caganoff
Introduction to Redis
Introduction to Redis
Saeid Zebardast
Redis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
Mongodb, our Swiss Army Knife Database
Mongodb, our Swiss Army Knife Database
Mathieu Poumeyrol
Microservices At Gilt - NYC Microservices Meetup
Microservices At Gilt - NYC Microservices Meetup
Michael Bryzek
About Microservices
About Microservices
Salvatore Cordiano
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Chris Richardson
Google Protocol buffer
Google Protocol buffer
knight1128
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
Matt O'Keefe
Getting Started with Redis
Getting Started with Redis
Faisal Akber
Redis SoCraTes 2014
Redis SoCraTes 2014
steffenbauer
Introduction to Microservices
Introduction to Microservices
André Faria Gomes
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
Redis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs Talks
Redis Labs
Introduction to MicroServices (Oakjug)
Introduction to MicroServices (Oakjug)
Chris Richardson
REDIS intro and how to use redis
REDIS intro and how to use redis
Kris Jeong
Think Small To Go Big - Introduction To Microservices
Think Small To Go Big - Introduction To Microservices
Ryan Baxter
The 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web Frameworks
Kunal Ashar
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
Carlos Abalde
Andere mochten auch
(20)
RProtoBuf: protocol buffers for R
RProtoBuf: protocol buffers for R
Melbourne Microservices Meetup: Agenda for a new Architecture
Melbourne Microservices Meetup: Agenda for a new Architecture
Introduction to Redis
Introduction to Redis
Redis for the Everyday Developer
Redis for the Everyday Developer
Mongodb, our Swiss Army Knife Database
Mongodb, our Swiss Army Knife Database
Microservices At Gilt - NYC Microservices Meetup
Microservices At Gilt - NYC Microservices Meetup
About Microservices
About Microservices
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Building and deploying microservices with event sourcing, CQRS and Docker (Me...
Google Protocol buffer
Google Protocol buffer
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
Getting Started with Redis
Getting Started with Redis
Redis SoCraTes 2014
Redis SoCraTes 2014
Introduction to Microservices
Introduction to Microservices
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Redis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs Talks
Introduction to MicroServices (Oakjug)
Introduction to MicroServices (Oakjug)
REDIS intro and how to use redis
REDIS intro and how to use redis
Think Small To Go Big - Introduction To Microservices
Think Small To Go Big - Introduction To Microservices
The 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web Frameworks
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
Mehr von Ciklum Ukraine
"How keep normal blood pressure using TDD" By Roman Loparev
"How keep normal blood pressure using TDD" By Roman Loparev
Ciklum Ukraine
"Through the three circles of the it hell" by Roman Liashenko
"Through the three circles of the it hell" by Roman Liashenko
Ciklum Ukraine
Alex Pazhyn: Google_Material_Design
Alex Pazhyn: Google_Material_Design
Ciklum Ukraine
Introduction to amazon web services for developers
Introduction to amazon web services for developers
Ciklum Ukraine
Your 1st Apple watch Application
Your 1st Apple watch Application
Ciklum Ukraine
Test Driven Development
Test Driven Development
Ciklum Ukraine
Back to the future: ux trends 2015
Back to the future: ux trends 2015
Ciklum Ukraine
Developing high load systems using C++
Developing high load systems using C++
Ciklum Ukraine
Collection view layout
Collection view layout
Ciklum Ukraine
Introduction to auto layout
Introduction to auto layout
Ciklum Ukraine
Groovy on Android
Groovy on Android
Ciklum Ukraine
Unit Testing: Special Cases
Unit Testing: Special Cases
Ciklum Ukraine
Material design
Material design
Ciklum Ukraine
Kanban development
Kanban development
Ciklum Ukraine
Mobile sketching
Mobile sketching
Ciklum Ukraine
More UX in our life
More UX in our life
Ciklum Ukraine
Model-View-Controller: Tips&Tricks
Model-View-Controller: Tips&Tricks
Ciklum Ukraine
Unit Tesing in iOS
Unit Tesing in iOS
Ciklum Ukraine
Future of Outsourcing report published in The Times featuring Ciklum's CEO To...
Future of Outsourcing report published in The Times featuring Ciklum's CEO To...
Ciklum Ukraine
Михаил Попчук "Cкрытые резервы команд или 1+1=3"
Михаил Попчук "Cкрытые резервы команд или 1+1=3"
Ciklum Ukraine
Mehr von Ciklum Ukraine
(20)
"How keep normal blood pressure using TDD" By Roman Loparev
"How keep normal blood pressure using TDD" By Roman Loparev
"Through the three circles of the it hell" by Roman Liashenko
"Through the three circles of the it hell" by Roman Liashenko
Alex Pazhyn: Google_Material_Design
Alex Pazhyn: Google_Material_Design
Introduction to amazon web services for developers
Introduction to amazon web services for developers
Your 1st Apple watch Application
Your 1st Apple watch Application
Test Driven Development
Test Driven Development
Back to the future: ux trends 2015
Back to the future: ux trends 2015
Developing high load systems using C++
Developing high load systems using C++
Collection view layout
Collection view layout
Introduction to auto layout
Introduction to auto layout
Groovy on Android
Groovy on Android
Unit Testing: Special Cases
Unit Testing: Special Cases
Material design
Material design
Kanban development
Kanban development
Mobile sketching
Mobile sketching
More UX in our life
More UX in our life
Model-View-Controller: Tips&Tricks
Model-View-Controller: Tips&Tricks
Unit Tesing in iOS
Unit Tesing in iOS
Future of Outsourcing report published in The Times featuring Ciklum's CEO To...
Future of Outsourcing report published in The Times featuring Ciklum's CEO To...
Михаил Попчук "Cкрытые резервы команд или 1+1=3"
Михаил Попчук "Cкрытые резервы команд или 1+1=3"
CiklumCPPSat24032012:SergeyBratus-GoogleProtocolBuffers
1.
GOOGLE PROTOCOL BUFFERS Плюсы и
минусы использования в реальных проектах
2.
Как все это
работает • Создайте .proto файл в котором будет информация о том что вы будете сериализовать • Сгенерируйте файлы с учетом нужного языка программирования используя утилиту protoc.exe • Добавьте код для вызова функций сериализации
3.
Поддерживаемые языки • С++ •
Java • Python
4.
Other Languages • Action
Script •C • C# • Haskell • Javascript • Objective C • Perl • PHP • Ruby • Scala • Visual Basic
5.
Proto файл message Person
{ required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string number = 1; optional PhoneType type = 2 [default = HOME]; } repeated PhoneNumber phone = 4; }
6.
С чего начинается
.proto Message message SearchRequest { optional int32 page_number = 1; }
7.
Message Field Types •
double, float, int32, int64, uint32, uint64, sint32, sint64, fixed32, fixed64, sfixed32, sfixed64, bool, string, bytes • enum Smth { UNIVERSAL = 0; WEB = 1; IMAGES = 2; } • Other Messages
8.
Field Rules В сообщении
могут быть поля следующих типов • required: 1 • optional: 0 или 1 • repeated: > 0
9.
Required Field required int32
foo = 1; • bool has_foo() const • int32 foo() const • void set_foo(int32 value) • void clear_foo()
10.
Optional Field optional Int32
foo = 1; • bool has_foo() const • int32 foo() const • void set_foo(int32 value) • void clear_foo() IsInitialized = true; foo вернет дефолтное значение
11.
String Field optional string
foo = 1; required string foo = 1; • bool has_foo() const • const string& foo() const • void set_foo(const string& value) • void set_foo(const char* value) • void set_foo(const char* value, int size) • string* mutable_foo() • void clear_foo() • string* release_foo()
12.
Enum Fields enum Bar
{ BAR_VALUE = 1; } optional Bar foo = 1; required Bar foo = 1; • bool has_foo() const • Bar foo() const • void set_foo(Bar value) • void clear_foo()
13.
Message Fields message Bar
{} optional Bar foo = 1; required Bar foo = 1; • bool has_foo() const • const Bar& foo() const • Bar* mutable_foo() • void clear_foo() • Bar* release_foo()
14.
Repeated Numeric Fields repeated
int32 foo = 1; • int foo_size() const • int32 foo(int index) const • void set_foo(int index, int32 value) • void add_foo(int32 value) • void clear_foo() • const RepeatedField<int32>& foo() const • RepeatedField<int32>* mutable_foo()
15.
Repeated String Fields repeated
string foo = 1; repeated bytes foo = 1; • int foo_size() const • const string& foo(int index) const • void set_foo(int index, const string& value) • void set_foo(int index, const char* value) • void set_foo(int index, const char* value, int size) • string* mutable_foo(int index) • void add_foo(const string& value) • void add_foo(const char* value) • void add_foo(const char* value, int size) • string* add_foo() • void clear_foo() • const RepeatedPtrField<string>& foo() const • RepeatedPtrField<string>* mutable_foo()
16.
Repeated Enum Fields enum
Bar { BAR_VALUE = 1; } repeated Bar foo = 1; • int foo_size() const • Bar foo(int index) const • void set_foo(int index, Bar value) • void add_foo(Bar value) • void clear_foo() • const RepeatedField<int>& foo() const • RepeatedField<int>* mutable_foo()
17.
Repeated Embedded Message
Fields message Bar {} repeated Bar foo = 1; • int int foo_size() const • const Bar& foo(int index) const • Bar* mutable_foo(int index) • Bar* add_foo() • void clear_foo() • const RepeatedPtrField<Bar>& foo() const • RepeatedPtrField<Bar>* mutable_foo()
18.
Enumerations enum Foo {
VALUE_A = 1; VALUE_B = 5; } • const const EnumDescriptor* Foo_descriptor() • bool Foo_IsValid(int value)
19.
Arrays • String • Bytes
20.
String
String => std::string Bytes => std::string
21.
Convert std::wstring ConvertToWstring(const std::string&
source) { if (source.empty()) return std::wstring(); return std::wstring((const wchar_t *)source.c_str(), source.size() / sizeof(wchar_t)); }
22.
Generate File
protoc --cpp_out=. test.proto
23.
Serializing SearchRequest pack; pack.set_opt("test"); pack.set_req("test"); std::vector<char> vec(pack.ByteSize()); pack.SerializeToArray(&vec.at(0),
vec.size());
24.
Deserializing SearchRequest unpack; unpack.ParseFromArray(&vec.at(0), vec.size());
25.
Pack Functions Bool SerializeToCodedStream(io::CodedOutputStream
* output) const Bool SerializeToZeroCopyStream(io::ZeroCopyOutputStream * output) const Bool SerializeToString(string * output) const Bool SerializeToArray(void * data, int size) const String SerializeAsString() const Bool AppendToString(string * output) const
26.
Cookies • Поддержка extensions
message Foo { // ... extensions 100 to 199; } extend Foo { optional int32 bar = 126; } • Packages package foo.bar; message Open { ... } • Options option optimize_for = CODE_SIZE; option optimize_for = SPEED;
27.
Questions?
Jetzt herunterladen