All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.protostream.message-wrapping.proto Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
syntax = "proto3";

package org.infinispan.protostream;

/**
 * Protobuf messages do not indicate their message type or structure. Readers of protobuf data streams are expected to
 * know what message type to expect next in the stream.
 * WrappedMessage is intended to solve this problem of self-describing messages by allowing the stream reader to detect
 * the type of the message. Still, message structure is not provided as it would not be efficient. The user is expected
 * to have knowledge of the structure once it knows the type.
 *
 * @TypeId(1000000)
 */
message WrappedMessage {

   oneof ScalarOrMessage {
      // Exactly one of the following fields is used if the wrapped value is a primitive (scalar) type.
      double wrappedDouble = 1;
      float wrappedFloat = 2;
      int64 wrappedInt64 = 3;
      uint64 wrappedUInt64 = 4;
      int32 wrappedInt32 = 5;
      fixed64 wrappedFixed64 = 6;
      fixed32 wrappedFixed32 = 7;
      bool wrappedBool = 8;
      string wrappedString = 9;
      bytes wrappedBytes = 10;
      uint32 wrappedUInt32 = 11;
      sfixed32 wrappedSFixed32 = 12;
      sfixed64 wrappedSFixed64 = 13;
      sint32 wrappedSInt32 = 14;
      sint64 wrappedSInt64 = 15;

      /**
       * Stores the message bytes if the wrapped value is a message type.
       */
      bytes wrappedMessage = 17;

      /**
       * This is used if the wrapped value is an enum.
       */
      int32 wrappedEnum = 18;
   }

   /**
    * Store the type name or type id. This is not used for primitive types.
    */
   oneof TypeNameOrId {

      /**
       * Stores the fully qualified type name if the wrapped value is a message or an enum type.
       */
      string wrappedDescriptorFullName = 16;

      /**
       * This is used as an alternative to wrappedDescriptorFullName if a unique id was assigned to the type with the
       * TypeId annotation.
       */
      int32 wrappedDescriptorId = 19;
   }
}


//todo [anistor] how do we handle arrays and collections?




© 2015 - 2025 Weber Informatics LLC | Privacy Policy