From e767ef09c4ef125f0dc77dc13dfcca6d534a25d3 Mon Sep 17 00:00:00 2001 From: Hou Zhizhen Date: Fri, 19 Mar 2021 14:38:51 +0800 Subject: [PATCH 1/2] add ComputerOutput interface --- .../computer/core/output/ComputerOutput.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java new file mode 100644 index 000000000..934133e72 --- /dev/null +++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * 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 com.baidu.hugegraph.computer.core.output; + +import com.baidu.hugegraph.computer.core.config.Config; +import com.baidu.hugegraph.computer.core.graph.vertex.Vertex; + +/** + * Computer output is used to output computer results. There is a output object + * for every partition. + */ +public interface ComputerOutput { + + /** + * Initialize the output. Create connection to target output system. + */ + void init(Config config, int partition); + + /** + * For each vertex in partition, this method is called regardless + * vertex's status. + */ + void write(Vertex vertex); + + /** + * Close the connection to target output system. Commit if target output + * required. + */ + void close(); +} From 49d1b97fd0b7179b2d6dd8e9077b1ea7dcc1dd1a Mon Sep 17 00:00:00 2001 From: Hou Zhizhen Date: Mon, 22 Mar 2021 12:06:03 +0800 Subject: [PATCH 2/2] tiny improve --- .../baidu/hugegraph/computer/core/output/ComputerOutput.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java b/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java index 934133e72..514d93c42 100644 --- a/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java +++ b/computer-core/src/main/java/com/baidu/hugegraph/computer/core/output/ComputerOutput.java @@ -23,7 +23,7 @@ import com.baidu.hugegraph.computer.core.graph.vertex.Vertex; /** - * Computer output is used to output computer results. There is a output object + * Computer output is used to output computer results. There is an output object * for every partition. */ public interface ComputerOutput {