code: void preProcessOperation(Operation operation) throws ContainerException, StreamSegmentException {
          checkNotSealed();
          if (operation instanceof SegmentOperation) {
              val segmentMetadata = getSegmentUpdateTransaction(((SegmentOperation) operation).getStreamSegmentId());
              if (segmentMetadata.isDeleted()) {
                  throw new StreamSegmentNotExistsException(segmentMetadata.getName());
              }
              if (operation instanceof StreamSegmentAppendOperation) {
                  segmentMetadata.preProcessOperation((StreamSegmentAppendOperation) operation);
              } else if (operation instanceof StreamSegmentSealOperation) {
                  segmentMetadata.preProcessOperation((StreamSegmentSealOperation) operation);
              } else if (operation instanceof MergeSegmentOperation) {
                  MergeSegmentOperation mbe = (MergeSegmentOperation) operation;
                  SegmentMetadataUpdateTransaction sourceMetadata = getSegmentUpdateTransaction(mbe.getSourceSegmentId());
                  sourceMetadata.preProcessAsSourceSegment(mbe);
                  segmentMetadata.preProcessAsTargetSegment(mbe, sourceMetadata);
              } else if (operation instanceof UpdateAttributesOperation) {
                  segmentMetadata.preProcessOperation((UpdateAttributesOperation) operation);
              } else if (operation instanceof StreamSegmentTruncateOperation) {
                  segmentMetadata.preProcessOperation((StreamSegmentTruncateOperation) operation);
              } else if (operation instanceof DeleteSegmentOperation) {
                  segmentMetadata.preProcessOperation((DeleteSegmentOperation) operation);
              }
          }
  
          if (operation instanceof MetadataCheckpointOperation) {
              // MetadataCheckpointOperations do not require preProcess and accept; they can be handled in a single stage.
              processMetadataOperation((MetadataCheckpointOperation) operation);
          } else if (operation instanceof StorageMetadataCheckpointOperation) {
              // StorageMetadataCheckpointOperation do not require preProcess and accept; they can be handled in a single stage.
              processMetadataOperation((StorageMetadataCheckpointOperation) operation);
          } else if (operation instanceof StreamSegmentMapOperation) {
              preProcessMetadataOperation((StreamSegmentMapOperation) operation);
          }
      }
docs: Pre-processes the given Operation. See OperationMetadataUpdater.preProcessOperation for more details on behavior.
  
  @param operation The operation to pre-process.
  @throws ContainerException     If the given operation was rejected given the current state of the container metadata.
  @throws StreamSegmentException If the given operation was incompatible with the current state of the Segment.
  For example: StreamSegmentNotExistsException, StreamSegmentSealedException or
  StreamSegmentMergedException.