clintropolis commented on a change in pull request #9459: Ability to Delete task logs and segments from S3 URL: https://github.com/apache/druid/pull/9459#discussion_r388686189
########## File path: core/src/main/java/org/apache/druid/common/utils/TimeSupplier.java ########## @@ -0,0 +1,32 @@ +/* + * 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.druid.common.utils; + +import java.util.function.Supplier; + +public class TimeSupplier implements Supplier<Long> Review comment: I have mixed feelings about this class. It seems to exist in service of testing `S3TaskLogs.killAll`, but isn't that kind of leaking what is basically a test fixture, into the production code? Since the `killAll` method does nothing but delegate to the other call that takes an explicit timestamp, is this abstraction really worth having? On the other hand, I can see an argument for using something like this to control system time, and I guess we already have similar situations sometimes when `@VisibleForTesting` are _only_ used by tests, so I'm not strictly against using this, just thinking out loud to have the discussion. In the very least I think it should be renamed `CurrentTimeMillisSupplier` to indicate what time it is supplying, and add javadocs to describe its intended usage to ease testing. Does this need to be setup in the module so that it gets injected into `S3TaskLogs`? (or did I miss that somewhere?) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
