Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1096

Support aliasing for sessions in Gremlin Server

    Details

      Description

      Gremlin Server allows for aliasing for sessionless requests. Have it be supported in both the driver and server for in-session requests. This should not represent any sort of breaking change for third-party drivers as the protocol does not need to change.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user spmallette opened a pull request:

          https://github.com/apache/incubator-tinkerpop/pull/256

          TINKERPOP-1096 TINKERPOP-1097 Session Aliases, Console Sessions and Remote Console

          https://issues.apache.org/jira/browse/TINKERPOP-1096
          https://issues.apache.org/jira/browse/TINKERPOP-1097

          This PR introduces several things:

          1. `SessionedClient.alias()` is now implemented so that you can do aliases on a session-based connection
          1. The console's `:remote connect` now allows you to append "session" to the end of it so that it starts that remote with a session
          1. The console now has `:remote console` which allows the console to be put into a mode where all scripts are sent to remote and the `:>` is no longer required

          Tested the console manually in an abundance of ways but here's an example:

          ```text
          gremlin> :remote connect tinkerpop.server conf/remote.yaml session
          ==>Connected - localhost/127.0.0.1:8182-[98bc7cf9-1c7b-451a-acbd-124a53a811d3]
          gremlin> :remote config alias a g
          ==>a=g
          gremlin> :remote console
          ==>All commands will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[98bc7cf9-1c7b-451a-acbd-124a53a811d3] - type ':remote console' to exit
          gremlin> x = 1
          ==>1
          gremlin> y = 2
          ==>2
          gremlin> x + y
          ==>3
          gremlin> a.V()
          ==>v[0]
          ==>v[1]
          ==>v[3]
          gremlin> :remote config alias b g
          ==>b=g
          gremlin> b.V()
          ==>v[0]
          ==>v[1]
          ==>v[3]
          ```

          Note that this is a non-breaking change. It is completely compatible with what we had before and the `:>` still works as it did before. This might yet be useful for some users as they might want to work with remote data in a local way and mix local/remote evaluations. Also, some plugins won't work well without it - like the gephi plugin.

          Builds/tests nicely with: `mvn clean install && mvn verify -pl gremlin-server,gremlin-console -DskipIntegrationTests=false -DincludeNeo4j`

          VOTE +1

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1096

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/incubator-tinkerpop/pull/256.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #256


          commit c3ed023fc41403f1994ee5cbf3a4f1fe8a0d1680
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-01-22T19:17:01Z

          Added alias support for sessions in Gremlin Server/Driver.

          Also added support for sessions in the console - TINKERPOP-1097

          commit 6f855af6196083dcd8bab9cac65539b3870edf73
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-08T19:33:38Z

          Modified how the RequestMessage is constructed for aliasing.

          The RequestMessage.Builder needs to be passed around in the chain of Client instances so that each can have its effect on the RequestMessage. This change allows the SessionClient to add the session information before the message is sent.

          commit f25dfb7c325b71a67a1ea64c6a20e87b8575199d
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-08T20:40:51Z

          Update changelog.

          commit 15e737e83069b3ba62bd1173321b50b495ce10bc
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-08T20:48:00Z

          Add upgrade docs for console sessions and session aliasing.

          commit b8a9800491cfe678ae1996c2d16ec57b73f7f130
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-08T21:33:06Z

          Added a section for Console Sessions.

          commit 0b0838af10577f0537d6e3803b4896f7ec6df55e
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T18:39:30Z

          Added a "console" option to the :remote command in the console.

          This will be convenient to those using the new console session feature as it basically will "window" Gremlin Server script execution and save the user from having to do :>. All commands essentially get sent to the server when flipped into this mode.

          commit afeffc4b79313ec50a866e5563a1413fe53ef2a1
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T19:17:46Z

          Added allowRemoteConsole to RemoteAcceptor interface.

          This allows a RemnoteAcceptor implementation to opt-out of being used with :remote console. That's important because sometimes a plugin expects that the user will work with both local and remote resources and :remote console would mess that up. Gephi is a good example of this.

          commit 1c757a7d8dfc73a2030af02c1bffbdd21812c00d
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T19:44:19Z

          Allow :remote close to close even when in remote eval mode.

          It first exits remote eval and then executes the close operation on the remote.

          commit c76711fb9c8a8662ab999b276cf285fe46ec82a8
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T19:51:04Z

          Update changelog

          commit e314f40983d24efd50727bd9ba47a107fc2ca455
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T20:39:47Z

          Minor alteration to :remote console messaging.

          commit e73b3d0fecbc7c3e86840f518d0f9f33f072c56c
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T20:40:08Z

          Update reference docs for usage of :remote console.

          commit 70b8725cc27173a20537f1d1a38e1d2402f25319
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T20:41:17Z

          Fixed minor spelling mistake.

          commit 1cc1ba96f853f50b6192c4b6cbfb7448c691d389
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T20:46:31Z

          Update the upgrade docs around :remote console.

          commit cff7b4ff262ecffb68fb99420c76d55ae421b24c
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T20:51:17Z

          Swithed all CAUTION: to WARNING: to be consistent.

          commit f11fad8b6a38500dc3b64a2173e4e8f2536b622a
          Author: Stephen Mallette <spmva@genoprime.com>
          Date: 2016-03-09T21:24:44Z

          Add test for :remote with a session.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user spmallette opened a pull request: https://github.com/apache/incubator-tinkerpop/pull/256 TINKERPOP-1096 TINKERPOP-1097 Session Aliases, Console Sessions and Remote Console https://issues.apache.org/jira/browse/TINKERPOP-1096 https://issues.apache.org/jira/browse/TINKERPOP-1097 This PR introduces several things: 1. `SessionedClient.alias()` is now implemented so that you can do aliases on a session-based connection 1. The console's `:remote connect` now allows you to append "session" to the end of it so that it starts that remote with a session 1. The console now has `:remote console` which allows the console to be put into a mode where all scripts are sent to remote and the `:>` is no longer required Tested the console manually in an abundance of ways but here's an example: ```text gremlin> :remote connect tinkerpop.server conf/remote.yaml session ==>Connected - localhost/127.0.0.1:8182- [98bc7cf9-1c7b-451a-acbd-124a53a811d3] gremlin> :remote config alias a g ==>a=g gremlin> :remote console ==>All commands will now be sent to Gremlin Server - [localhost/127.0.0.1:8182] - [98bc7cf9-1c7b-451a-acbd-124a53a811d3] - type ':remote console' to exit gremlin> x = 1 ==>1 gremlin> y = 2 ==>2 gremlin> x + y ==>3 gremlin> a.V() ==>v [0] ==>v [1] ==>v [3] gremlin> :remote config alias b g ==>b=g gremlin> b.V() ==>v [0] ==>v [1] ==>v [3] ``` Note that this is a non-breaking change. It is completely compatible with what we had before and the `:>` still works as it did before. This might yet be useful for some users as they might want to work with remote data in a local way and mix local/remote evaluations. Also, some plugins won't work well without it - like the gephi plugin. Builds/tests nicely with: `mvn clean install && mvn verify -pl gremlin-server,gremlin-console -DskipIntegrationTests=false -DincludeNeo4j` VOTE +1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1096 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-tinkerpop/pull/256.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #256 commit c3ed023fc41403f1994ee5cbf3a4f1fe8a0d1680 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-01-22T19:17:01Z Added alias support for sessions in Gremlin Server/Driver. Also added support for sessions in the console - TINKERPOP-1097 commit 6f855af6196083dcd8bab9cac65539b3870edf73 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-08T19:33:38Z Modified how the RequestMessage is constructed for aliasing. The RequestMessage.Builder needs to be passed around in the chain of Client instances so that each can have its effect on the RequestMessage. This change allows the SessionClient to add the session information before the message is sent. commit f25dfb7c325b71a67a1ea64c6a20e87b8575199d Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-08T20:40:51Z Update changelog. commit 15e737e83069b3ba62bd1173321b50b495ce10bc Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-08T20:48:00Z Add upgrade docs for console sessions and session aliasing. commit b8a9800491cfe678ae1996c2d16ec57b73f7f130 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-08T21:33:06Z Added a section for Console Sessions. commit 0b0838af10577f0537d6e3803b4896f7ec6df55e Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T18:39:30Z Added a "console" option to the :remote command in the console. This will be convenient to those using the new console session feature as it basically will "window" Gremlin Server script execution and save the user from having to do :>. All commands essentially get sent to the server when flipped into this mode. commit afeffc4b79313ec50a866e5563a1413fe53ef2a1 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T19:17:46Z Added allowRemoteConsole to RemoteAcceptor interface. This allows a RemnoteAcceptor implementation to opt-out of being used with :remote console. That's important because sometimes a plugin expects that the user will work with both local and remote resources and :remote console would mess that up. Gephi is a good example of this. commit 1c757a7d8dfc73a2030af02c1bffbdd21812c00d Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T19:44:19Z Allow :remote close to close even when in remote eval mode. It first exits remote eval and then executes the close operation on the remote. commit c76711fb9c8a8662ab999b276cf285fe46ec82a8 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T19:51:04Z Update changelog commit e314f40983d24efd50727bd9ba47a107fc2ca455 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T20:39:47Z Minor alteration to :remote console messaging. commit e73b3d0fecbc7c3e86840f518d0f9f33f072c56c Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T20:40:08Z Update reference docs for usage of :remote console. commit 70b8725cc27173a20537f1d1a38e1d2402f25319 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T20:41:17Z Fixed minor spelling mistake. commit 1cc1ba96f853f50b6192c4b6cbfb7448c691d389 Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T20:46:31Z Update the upgrade docs around :remote console. commit cff7b4ff262ecffb68fb99420c76d55ae421b24c Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T20:51:17Z Swithed all CAUTION: to WARNING: to be consistent. commit f11fad8b6a38500dc3b64a2173e4e8f2536b622a Author: Stephen Mallette <spmva@genoprime.com> Date: 2016-03-09T21:24:44Z Add test for :remote with a session.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the pull request:

          https://github.com/apache/incubator-tinkerpop/pull/256#issuecomment-194561611

          VOTE +1. This is baller.

          Show
          githubbot ASF GitHub Bot added a comment - Github user okram commented on the pull request: https://github.com/apache/incubator-tinkerpop/pull/256#issuecomment-194561611 VOTE +1. This is baller.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user dkuppitz commented on the pull request:

          https://github.com/apache/incubator-tinkerpop/pull/256#issuecomment-194579031

          It even supports multi-line scripts! Epic.

          VOTE: +1

          Show
          githubbot ASF GitHub Bot added a comment - Github user dkuppitz commented on the pull request: https://github.com/apache/incubator-tinkerpop/pull/256#issuecomment-194579031 It even supports multi-line scripts! Epic. VOTE: +1
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/incubator-tinkerpop/pull/256

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/incubator-tinkerpop/pull/256

            People

            • Assignee:
              spmallette stephen mallette
              Reporter:
              spmallette stephen mallette
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development