private static ByteBuffer internal2Buffer(ICachedMNode node) {
    byte nodeType = INTERNAL_TYPE;
    Boolean isAligned = null;
    int schemaTemplateIdWithState = SchemaConstant.NON_TEMPLATE;
    boolean isUseTemplate = false;

    if (node.isDevice()) {
      nodeType = ENTITY_TYPE;
      isAligned = node.getAsDeviceMNode().isAlignedNullable();
      schemaTemplateIdWithState = node.getAsDeviceMNode().getSchemaTemplateIdWithState();
      isUseTemplate = node.getAsDeviceMNode().isUseTemplate();
    }

    ByteBuffer buffer = ByteBuffer.allocate(INTERNAL_NODE_LENGTH);
    ReadWriteIOUtils.write(nodeType, buffer);
    ReadWriteIOUtils.write(INTERNAL_NODE_LENGTH, buffer);
    ReadWriteIOUtils.write(
        ICachedMNodeContainer.getCachedMNodeContainer(node).getSegmentAddress(), buffer);
    ReadWriteIOUtils.write(schemaTemplateIdWithState, buffer);

    // encode bitwise flag
    byte useAndAligned = encodeInternalStatus(isUseTemplate, isAligned);

    ReadWriteIOUtils.write(useAndAligned, buffer);
    return buffer;
  }
Internal/Entity MNode Record Structure (in bytes): <br>
(fixed length record)

<ul>
  <li>1 byte: nodeType, 0 for internal, 1 for entity, 4 for measurement
  <li>1 short (2 bytes): recLen, length of record (remove it may reduce space overhead while a
      bit slower)
  <li>1 long (8 bytes): glbIndex, combined index to its children records
  <li>1 int (4 byte): templateId, id of template, occupies only 1 byte before
</ul>

-- bitwise flags (1 byte) --

<ul>
  <li>1 bit : usingTemplate, whether using template
  <li>2 bit : isAligned (00 for not aligned, 01 for aligned, 10 for null)
</ul>

@param node
@return
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/RecordUtils.java