You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/10/19 07:10:59 UTC

[GitHub] [apisix] tzssangglass opened a new pull request, #8120: refactor: adjusting the position of ai module

tzssangglass opened a new pull request, #8120:
URL: https://github.com/apache/apisix/pull/8120

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999031743


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   or `BUILD_ROUTER`?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r1000062179


##########
apisix/init.lua:
##########
@@ -152,6 +152,8 @@ function _M.http_init_worker()
 
     apisix_upstream.init_worker()
     require("apisix.plugins.ext-plugin.init").init_worker()
+    -- TODO: need to revisit code layering and avoid similar hacking

Review Comment:
   not in next PR, in feature.



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] membphis commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999030105


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--

Review Comment:
   And I think we can move `event` to `apisix.core`



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander merged pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #8120:
URL: https://github.com/apache/apisix/pull/8120


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] soulbird commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999033101


##########
apisix/plugins/ai.lua:
##########
@@ -43,10 +45,23 @@ local route_lrucache = core.lrucache.new({
     count = 512
 })
 
-local _M = {}
+local schema = {

Review Comment:
   `local schema = {}` ?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999038769


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   you mean change `constants` to `CONST`?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999059183


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   done



##########
apisix/plugins/ai.lua:
##########
@@ -43,10 +45,23 @@ local route_lrucache = core.lrucache.new({
     count = 512
 })
 
-local _M = {}
+local schema = {

Review Comment:
   done



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r1000054208


##########
apisix/init.lua:
##########
@@ -152,6 +152,8 @@ function _M.http_init_worker()
 
     apisix_upstream.init_worker()
     require("apisix.plugins.ext-plugin.init").init_worker()
+    -- TODO: need to revisit code layering and avoid similar hacking

Review Comment:
   Will this be handled in the next PR?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] membphis commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999030325


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--

Review Comment:
   @spacewander what do you think?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] membphis commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999028630


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   and can we change to a shorter name?



##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   Change the name to uppercase?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] membphis commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999148926


##########
apisix/core/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local CONST = {
+    BUILD_ROUTER = 1,
+}
+
+local _M = {
+    CONST = CONST,
+}
+
+local events = {}
+

Review Comment:
   style: pls use two blank lines between different functions



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999030904


##########
apisix/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local constants = {
+    CREATE_NEW_HTTP_ROUTER = 1,
+}
+
+local _M = {
+    constants = constants,

Review Comment:
   how about `REBUILD_ROUTER`?



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999340743


##########
apisix/core/event.lua:
##########
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+
+local CONST = {
+    BUILD_ROUTER = 1,
+}
+
+local _M = {
+    CONST = CONST,
+}
+
+local events = {}
+

Review Comment:
   done



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tzssangglass commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999583414


##########
t/core/config.t:
##########
@@ -38,7 +38,7 @@ __DATA__
 GET /t
 --- response_body
 etcd host: http://127.0.0.1:2379
-first plugin: "real-ip"
+first plugin: "ai"

Review Comment:
   If it is not necessary, I am going to change it in the next PR



-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] membphis commented on a diff in pull request #8120: refactor: adjusting the position of ai module

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8120:
URL: https://github.com/apache/apisix/pull/8120#discussion_r999479459


##########
t/core/config.t:
##########
@@ -38,7 +38,7 @@ __DATA__
 GET /t
 --- response_body
 etcd host: http://127.0.0.1:2379
-first plugin: "real-ip"
+first plugin: "ai"

Review Comment:
   we can change the priority of ai plugin
   we should avoid to change this test case



-- 
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: notifications-unsubscribe@apisix.apache.org

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