Este contenido no está disponible en el idioma seleccionado.
6.2. Protobuf Encoding
The Infinispan Query DSL can be used remotely via the Hot Rod client. In order to do this, protocol buffers are used to adopt a common format for storing cache entries and marshalling them.
For more information, see https://developers.google.com/protocol-buffers/docs/overview
6.2.1. Storing Protobuf Encoded Entities Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
Protobuf requires data to be structured. This is achieved by declaring Protocol Buffer message types in
.proto files
For example:
Example 6.1. .library.proto
package book_sample;
message Book {
required string title = 1;
required string description = 2;
required int32 publicationYear = 3; // no native Date type available in Protobuf
repeated Author authors = 4;
}
message Author {
required string name = 1;
required string surname = 2;
}
The provided example:
- An entity named
Bookis placed in a package namedbook_sample.package book_sample; message Book { - The entity declares several fields of primitive types and a repeatable field named
authors.required string title = 1; required string description = 2; required int32 publicationYear = 3; // no native Date type available in Protobuf repeated Author authors = 4; } - The
Authormessage instances are embedded in theBookmessage instance.message Author { required string name = 1; required string surname = 2; }