You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All information based on CYFS can choose one of the following three encoding methods. Both Protobuf and JSON have their standard encoding specifications. I won’t go into details here. We only introduce the binary encoding format.
Binary
Binary format encoding, usually used for standardized fixed encoding, the most space-saving, but not easy to expand.
When binary encoding is selected, the type designer needs to fill all fields into a Buffer one by one in a certain order.
Protobuf
Using Protobuf encoding, while taking into account certain space efficiency and scalability, this is the encoding method selected by most complex types.
When using Protobuf encoding, the type designer only needs to assign each field of the object to the corresponding Protobuf type, and then use the Protobuf method to encode and decode. Compatibility processing needs to refer to the Protobuf specification.
** Note: The Protobuf specification we chose is Proto3, considering backward compatibility, the Protobuf version is unlikely to be upgraded. Of course, other versions can be selected for the type of new design, but different versions need to be carefully introduced. **
JSON
Encoded in JSON, which is less space efficient but more readable.
Because of its low space efficiency, the JSON method is usually not selected to encode and decode information. JSON encoding usually appears in the scene of human-computer interaction.
** No matter which encoding method you choose, you must pay attention to the stability of the encoding when you use it for object encoding (for example: Set and Map should pay attention to the order of each element), otherwise the ObjectId obtained by calculating the same content multiple times may be different. **
The text was updated successfully, but these errors were encountered:
Multiple encoding methods
All information based on
CYFS
can choose one of the following three encoding methods. BothProtobuf
andJSON
have their standard encoding specifications. I won’t go into details here. We only introduce the binary encoding format.Binary
Binary format encoding, usually used for standardized fixed encoding, the most space-saving, but not easy to expand.
When binary encoding is selected, the type designer needs to fill all fields into a
Buffer
one by one in a certain order.Protobuf
Using
Protobuf
encoding, while taking into account certain space efficiency and scalability, this is the encoding method selected by most complex types.When using
Protobuf
encoding, the type designer only needs to assign each field of the object to the correspondingProtobuf
type, and then use theProtobuf
method to encode and decode. Compatibility processing needs to refer to theProtobuf
specification.** Note: The
Protobuf
specification we chose isProto3
, considering backward compatibility, theProtobuf
version is unlikely to be upgraded. Of course, other versions can be selected for the type of new design, but different versions need to be carefully introduced. **JSON
Encoded in
JSON
, which is less space efficient but more readable.Because of its low space efficiency, the
JSON
method is usually not selected to encode and decode information.JSON
encoding usually appears in the scene of human-computer interaction.** No matter which encoding method you choose, you must pay attention to the stability of the encoding when you use it for object encoding (for example:
Set
andMap
should pay attention to the order of each element), otherwise theObjectId
obtained by calculating the same content multiple times may be different. **The text was updated successfully, but these errors were encountered: