You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/11/18 07:26:54 UTC

[GitHub] [cassandra] bereng commented on a change in pull request #1321: CASSANDRA-17147 trunk: Guardrails prototype

bereng commented on a change in pull request #1321:
URL: https://github.com/apache/cassandra/pull/1321#discussion_r751966283



##########
File path: src/java/org/apache/cassandra/db/guardrails/Guardrails.java
##########
@@ -0,0 +1,183 @@
+/*
+ * 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.cassandra.db.guardrails;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+
+import static java.lang.String.format;
+
+/**
+ * Entry point for Guardrails, storing the defined guardrails and provided a few global methods over them.
+ */
+public abstract class Guardrails
+{
+    public static final String CUSTOM_GUARDRAILS_FACTORY_PROPERTY = "cassandra.custom_guardrails_factory_class";
+
+    private static final GuardrailsConfig config = GuardrailsConfig.instance;
+
+    public static final GuardrailsFactory factory = System.getProperty(CUSTOM_GUARDRAILS_FACTORY_PROPERTY) == null
+                                                    ? new DefaultGuardrailsFactory()
+                                                    : CustomGuardrailsFactory.make(System.getProperty(CUSTOM_GUARDRAILS_FACTORY_PROPERTY));
+

Review comment:
       Aren't we just discussing whether:
   - That factory is exposing a public API intended for 3rd party implementations + all the costs involved in that that David mentions, like if it were a product that needs to be maintained.
   vs
   - That factory is just an internal implementation detail to support a handful of different implementations but there are no guarantees on compatibility, versioning, etc It's just like any other random interface in the code that can change at any time.
   
   If it's so let's just add a disclaimer being clear on the purpose/intentions? The day we have a gazillion companies wanting to implement their guardrails version and we need to 'productize' it then we can discuss that point.
   
   Hope it makes sense. My 2cts.




-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org