Exemple #1
0
def create_protobuf_id(id) -> IdPB:
    protobuf_id = IdPB()
    if type(id) == type("str"):
        protobuf_id.id_str = id
    else:
        protobuf_id.id_int = id
    return protobuf_id
Exemple #2
0
    def bufferize(worker, msg):
        """
            This method serializes a SearchMessage using SearchMessagePB.

            Args:
                msg (SearchMessage): input SearchMessage to be serialized.

            Returns:
                proto_msg (SearchMessagePB): serialized SearchMessage.
        """
        proto_msg = SearchMessagePB()
        for elem in msg.query:
            id = IdPB()
            if isinstance(elem, str):
                id.id_str = elem
            else:
                id.id_int = elem
            proto_msg.query.append(id)
        return proto_msg
Exemple #3
0
    def bufferize(worker, msg):
        """
            This method serializes a ForceObjectDeleteMessage using ForceObjectDeleteMessagePB.

            Args:
                msg (ForceObjectDeleteMessage): input ForceObjectDeleteMessage to be serialized.

            Returns:
                proto_msg (ForceObjectDeleteMessagePB): serialized ForceObjectDeleteMessage.
        """
        proto_msg = ForceObjectDeleteMessagePB()
        for elem in msg.object_ids:
            id = IdPB()
            if isinstance(elem, str):
                id.id_str = elem
            else:
                id.id_int = elem
            proto_msg.object_ids.append(id)
        return proto_msg