[
https://issues.apache.org/jira/browse/TINKERPOP-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18044341#comment-18044341
]
ASF GitHub Bot commented on TINKERPOP-3219:
-------------------------------------------
DR1N0 commented on PR #3285:
URL: https://github.com/apache/tinkerpop/pull/3285#issuecomment-3640003368
Hi @spmallette !
While still keeping a websocket port for interactive console usage, our
server side provides a gRPC port for production traffic, which has such
constraints:
- Does not support session (conflicts with connection pooling and load
balancing)
- Bytecode only (server requires `"processor": "traversal"`, rejecting
string queries likely for performance, security and stateless design)
`gremlingo.DriverRemoteConnection` is tightly coupled to websocket transport
so we created a custom GrpcRemoteConnection. They look basically similar, take
the `SubmitByteCode` function as an example:
1. We extract the bytecode from gremlin traversals (standard API)
2. Serialize with `gremlingo.MakeBytecodeRequest` and
`GraphBinarySerializer.SerializeMessage` **exposed in this PR**
3. Send it over gRPC instead of websocket
4. Deserialize with the `GraphBinarySerializer.DeserializeMessage`
**exposed in this PR**
5. Return standard `ResultSet`
> Add public serialization API in gremlin-go for alternative transport protocols
> ------------------------------------------------------------------------------
>
> Key: TINKERPOP-3219
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3219
> Project: TinkerPop
> Issue Type: Improvement
> Components: go
> Affects Versions: 4.0.0, 3.8.1
> Reporter: Haiyu Wang
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0, 3.8.1
>
>
> According to maintainers' comments, the title is changed to `Expose
> serialization functions for alternative transport protocols in gremlin-go`
> /*
> Currently, gremlin-go only supports WebSocket transport. The serialization
> logic (GraphBinary) is internal/private, preventing developers from building
> custom transport implementations (gRPC, HTTP/2, etc.) while maintaining
> Gremlin API compatibility.
> This improvement adds a new file gremlin-go/driver/serializer_export.go with
> 5 exported wrapper functions around existing internal serialization logic:
> - SerializeRequest() - Serialize bytecode with traversal source
> - SerializeBytecode() - Convenience wrapper using default source
> - SerializeStringQuery() - Serialize string queries
> - DeserializeResult() - Deserialize response bytes
> - NewResultSet() - Create ResultSet from collected results
> These are thin wrappers with zero modifications to existing code, fully
> backward compatible, and enable the ecosystem to build alternative transports.
> */
> Use case: Building gRPC-based Gremlin clients for production deployments.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)