jpountz commented on code in PR #14482: URL: https://github.com/apache/lucene/pull/14482#discussion_r2066497910
########## lucene/test-framework/src/java/module-info.java: ########## @@ -22,6 +22,7 @@ requires org.apache.lucene.codecs; requires transitive junit; requires transitive randomizedtesting.runner; + requires org.hamcrest; Review Comment: It doesn't seem to be used in this PR? ########## lucene/core/src/java/org/apache/lucene/store/DefaultIOContext.java: ########## @@ -0,0 +1,88 @@ +/* + * 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.lucene.store; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +record DefaultIOContext(Optional<ReadAdvice> readAdvice, Set<FileOpenHint> hints) + implements IOContext { + + public DefaultIOContext { + Objects.requireNonNull(readAdvice); + Objects.requireNonNull(hints); + if (readAdvice.isPresent() && !hints.isEmpty()) + throw new IllegalArgumentException("Either ReadAdvice or hints can be specified, not both"); + + assert assertHintTypes(hints); Review Comment: Let's make this validated all the time (and throw an IAE instead of an AssertionError), not only when assertions are enabled? I don't expect IOContext construction to ever be a bottleneck. ########## lucene/core/src/java/org/apache/lucene/store/FileDataHint.java: ########## @@ -0,0 +1,27 @@ +/* + * 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.lucene.store; + +/** Hints on the type of data stored in the file */ +public enum FileDataHint implements IOContext.FileOpenHint { + /** The file contains postings data */ + POSTINGS, + /** The file contains stored fields */ + STORED_FIELDS, + /** The file contains vector data */ + VECTORS Review Comment: I wonder if we should rename to `KNN_VECTORS` to avoid confusion with term vectors, and for consistency with `KnnVectorsFormat` and other classes. Should we add `TERM_VECTORS` and `POINTS` too in this PR? I also wonder what we should do with terms dictionaries. From the codecs perspective, they are part of a `PostingsFormat`, but I could see users want to have different rules for terms vs. postings, so I'd be keen to have a constant for `TERMS` (no strong opinion, we could also add it later when we feel a need for it). -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org