lowka commented on code in PR #2494:
URL: https://github.com/apache/ignite-3/pull/2494#discussion_r1307466708


##########
modules/system-view/src/main/java/org/apache/ignite/internal/systemview/ClusterSystemView.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.ignite.internal.systemview;
+
+import java.util.List;
+import java.util.function.Supplier;
+import org.apache.ignite.internal.util.AsyncCursor;
+
+/**
+ * Cluster wide view definition.
+ *
+ * <pre>
+ *   // Creates definition of a cluster-wide system view.
+ *   var tablesView = Cluster.&lt;Table&gt;clusterViewBuilder()
+ *     .name("TABLES")
+ *     .addColumn("ID", Integer.class, Table::id)
+ *     .addColumn("SCHEMA_ID", Integer.class, Table::schemaId)
+ *     .addColumn("NAME", String.class, Table::name)
+ *     .dataProvider(() -> toAsyncCursor(tableManager.tables()))
+ *     .build();
+ * </pre>
+ *
+ * @param <T> System view data type.
+ * @see SystemView
+ */
+public class ClusterSystemView<T> extends SystemView<T> {
+
+    /**
+     * Constructor.
+     *
+     * @param name View name.
+     * @param columns List of columns.
+     * @param dataProvider Data provider.
+     */
+    ClusterSystemView(String name,
+            List<SystemViewColumn<T, ?>> columns,
+            Supplier<AsyncCursor<T>> dataProvider) {
+
+        super(name, columns, dataProvider);
+    }
+
+    /**
+     * Creates an instance of a builder to construct cluster-wide system views.
+     *
+     * @param <T> Type of elements returned by a system view.
+     * @return Returns a builder to construct cluster-wide system views.
+     */
+    public static <T> Builder<T> builder() {

Review Comment:
   > var builder = SystemView.clusterViewBuilder();
   > var builder = SystemView.nodeViewBuilder();
   
   That was the original design as well :) But it creates circular dependencies 
between classes, though in this case it causes no issues. I think it better to 
keep builders for subclasses outside of `SystemView` but for user convenience 
we can create a class `SystemViews.<builder method>` that provides all builder 
methods. 
   



-- 
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]

Reply via email to