mansehajsingh commented on code in PR #1037: URL: https://github.com/apache/polaris/pull/1037#discussion_r1975894346
########## service/common/src/main/java/org/apache/polaris/service/http/IfNoneMatch.java: ########## @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.polaris.service.http; + +import com.google.common.collect.ImmutableList; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.stream.Collectors; + +/** + * Logical representation of an HTTP compliant If-None-Match header. + */ +public class IfNoneMatch { Review Comment: There are certain semantics surrounding the If-None-Match header that I feel would not be as clear with a record. The `If-None-Match` header can either take the value of the wildcard `*` or a (possibly empty) list of etags, _not both_. The canonical constructor for a class like this would be defined like `IfNoneMatch(boolean isWildcard, List<ETag> etags)`. However, an If-None-Match header is one or the other, not both. I shouldn't be able to construct a header that's both a wildcard and contains etags. It's easier to capture this when we don't expose the canonical constructor. I've improved the semantics a bit. Now, I can either construct the header as a wildcard by calling `IfNoneMatch.wildcard()` to construct a wildcard header, or I can init the header by calling `new IfNoneMatch(List.of(etag1, etag2, etag3))`, but I can't give it both. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
