HolyLow commented on code in PR #3156: URL: https://github.com/apache/celeborn/pull/3156#discussion_r2003100103
########## cpp/celeborn/client/ShuffleClient.h: ########## @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#pragma once + +#include "celeborn/client/reader/CelebornInputStream.h" +#include "celeborn/network/NettyRpcEndpointRef.h" + +namespace celeborn { +namespace client { +class ShuffleClient { + public: + virtual void setupLifecycleManagerRef(std::string& host, int port) = 0; + + virtual void setupLifecycleManagerRef( + std::shared_ptr<network::NettyRpcEndpointRef>& lifecycleManagerRef) = 0; + + virtual void updateReducerFileGroup(int shuffleId) = 0; + + virtual std::unique_ptr<CelebornInputStream> readPartition( + int shuffleId, + int partitionId, + int attemptNumber, + int startMapIndex, + int endMapIndex) = 0; + + virtual bool cleanupShuffle(int shuffleId) = 0; + + virtual void shutdown() = 0; +}; + +class ShuffleClientImpl : public ShuffleClient { Review Comment: Actually, singleton design pattern is almost never a good pattern in cpp, as cpp has no gc mechanism, and the singleton pattern would easily cause problems including memory leaking, etc. Besides, the non-singleton design would provide more fine-grained control for the native engine. The resources required by ShuffleClientImpl including memory pool (if any), thread pool, clientFactory, etc would be customized by the application. Therefore, in CppClient we choose to not use the singleton design. -- 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]
