You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ly...@apache.org on 2022/05/11 20:36:05 UTC
[tinkerpop] 01/01: Merge branch '3.5-dev' into 3.6-dev
This is an automated email from the ASF dual-hosted git repository.
lyndonb pushed a commit to branch 3.6-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit ffab0f434c515f4f427872a1bfac2f279a000e78
Merge: 0d3211514d 2eee3f4398
Author: Lyndon Bauto <ly...@bitquilltech.com>
AuthorDate: Wed May 11 13:34:22 2022 -0700
Merge branch '3.5-dev' into 3.6-dev
.github/codecov.yml | 19 +
.github/workflows/build-test.yml | 5 +
.../dev/developer/development-environment.asciidoc | 17 +
docs/src/dev/developer/release.asciidoc | 3 +
docs/src/reference/gremlin-applications.asciidoc | 16 +-
docs/src/reference/gremlin-variants.asciidoc | 299 ++++++++++++-
docs/src/reference/intro.asciidoc | 22 +-
docs/static/images/gremlin-go.png | Bin 0 -> 35389 bytes
.../tinkerpop/gremlin/util/PerformanceTest.java | 252 +++++++++++
gremlin-go/Dockerfile | 21 +-
gremlin-go/README.md | 309 ++++++--------
gremlin-go/docker-compose.yml | 4 +-
gremlin-go/docker/generate-all.groovy | 79 ++++
.../docker/gremlin-server-integration-secure.yaml | 1 +
gremlin-go/docker/gremlin-server-integration.yaml | 1 +
gremlin-go/driver/client.go | 62 ++-
gremlin-go/driver/client_test.go | 2 +-
gremlin-go/driver/connection.go | 5 +-
gremlin-go/driver/connectionPool.go | 164 ++++---
gremlin-go/driver/connectionPool_test.go | 28 --
gremlin-go/driver/connection_test.go | 153 ++++---
gremlin-go/driver/driverRemoteConnection.go | 128 +++---
gremlin-go/driver/error_codes.go | 5 +
gremlin-go/driver/gorillaTransporter.go | 14 +-
gremlin-go/driver/graphBinary.go | 292 ++++++-------
gremlin-go/driver/graphBinary_test.go | 8 +-
gremlin-go/driver/graphTraversalSource.go | 2 +-
gremlin-go/driver/logger.go | 7 +-
gremlin-go/driver/performance/performanceSuite.go | 470 +++++++++++++++++++++
gremlin-go/driver/protocol.go | 24 +-
gremlin-go/driver/resources/error-messages/en.json | 5 +-
.../driver/resources/logger-messages/en.json | 11 +-
gremlin-go/driver/resultSet.go | 7 +-
gremlin-go/driver/resultSet_test.go | 10 +-
gremlin-go/driver/serializer.go | 7 +-
gremlin-go/driver/strategies.go | 8 +-
gremlin-go/driver/traversal.go | 37 +-
gremlin-go/driver/traversal_test.go | 152 +++++++
gremlin-go/example/example.go | 52 +++
gremlin-go/example/go.mod | 29 ++
gremlin-go/{ => example}/go.sum | 20 +-
gremlin-go/go.mod | 4 +-
gremlin-go/go.sum | 13 +-
43 files changed, 2107 insertions(+), 660 deletions(-)
diff --cc .github/workflows/build-test.yml
index 5d85cec234,5befe4519f..78abde8340
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@@ -202,31 -202,36 +202,36 @@@ jobs
run: |
mvn clean install -pl -:gremlin-javascript,-:gremlin-python,-gremlin-dotnet,-:gremlin-dotnet-source,-:gremlin-dotnet-tests -q -DskipTests -Dci
mvn verify -pl :neo4j-gremlin -DincludeNeo4j
- go:
- name: go
- timeout-minutes: 20
- needs: smoke
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
-
- - name: Setup Go
- uses: actions/setup-go@v3
- with:
- go-version: '1.17'
-
- - name: Generate Gremlin Server Base Image
- working-directory: .
- run: |
- mvn clean install -pl :gremlin-server -DskipTests -DskipIntegrationTests=true -am && mvn install -Pdocker-images -pl :gremlin-server
-
- - name: Execute Go tests
- working-directory: ./gremlin-go
- run: |
- docker-compose up --exit-code-from gremlin-go-integration-tests
- docker-compose down
-
- - name: Upload to Codecov
- uses: codecov/codecov-action@v2
- with:
- working-directory: ./gremlin-go
-
- - name: Go-Vet
- working-directory: ./gremlin-go
- run: go vet ./...
+ #go:
+ # name: go
+ # timeout-minutes: 20
+ # needs: smoke
+ # runs-on: ubuntu-latest
+ # steps:
+ # - name: Checkout
+ # uses: actions/checkout@v3
+ #
+ # - name: Setup Go
+ # uses: actions/setup-go@v3
+ # with:
+ # go-version: '1.17'
+ #
+ # - name: Generate Gremlin Server Base Image
+ # working-directory: .
+ # run: |
+ # mvn clean install -pl :gremlin-server -DskipTests -DskipIntegrationTests=true -am && mvn install -Pdocker-images -pl :gremlin-server
+ #
+ # - name: Execute Go tests
+ # working-directory: ./gremlin-go
+ # run: |
+ # docker-compose up --exit-code-from gremlin-go-integration-tests
+ # docker-compose down
+ #
++ # - name: Upload to Codecov
++ # uses: codecov/codecov-action@v2
++ # with:
++ # working-directory: ./gremlin-go
++ #
+ # - name: Go-Vet
+ # working-directory: ./gremlin-go
+ # run: go vet ./...
diff --cc docs/src/dev/developer/development-environment.asciidoc
index 5eabaf2286,b2312b43ba..b18dbec756
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@@ -293,10 -246,25 +293,27 @@@ easily serve the generated website loca
TIP: For those who do not have a full Maven environment, please see <<docker-integration,this section>> for how Docker
can be used to help run tests.
+TIP: Consider installing link:https://github.com/nvm-sh/nvm[nvm-sh] as a convenient way to manage node versions.
+
See the <<release-environment,Release Environment>> section for more information on release manager configurations.
+ [[go-environment]]
+ === Go Environment
+
+ The build optionally requires link:https://go.dev/dl/[Go] (>=1.17) to work with the `gremlin-go` module. If Go is not installed, TinkerPop will still build with Maven, but Go projects will be skipped.
+
+ `gremlin-go` can be built the command line with:
+
+ [source,text]
+ go build
+
+ Docker allows you to test the driver without installing any dependencies. The following command can be used to run docker:
+
+ [source,text]
+ docker-compose up --exit-code-from gremlin-go-integration-tests
+
+ See the <<release-environment,Release Environment>> section for more information on release manager configurations.
+
[[docker-environment]]
=== Docker Environment
diff --cc docs/src/dev/developer/release.asciidoc
index b01643350e,7c46c33093..9d49a6d9a7
--- a/docs/src/dev/developer/release.asciidoc
+++ b/docs/src/dev/developer/release.asciidoc
@@@ -241,8 -240,10 +241,10 @@@ for generating javadoc
.. `mvn clean install -DskipTests -Dnuget`
.. `mvn deploy -pl gremlin-python -DskipTests -Dpypi`
.. `mvn deploy -pl :gremlin-dotnet-source -DskipTests -Dnuget`
-.. `mvn deploy -pl gremlin-javascript -DskipTests -Dnpm`
-.. `mvn deploy -pl gremlint -DskipTests -Dnpm`
-.. `git tag gremlin-go/v3.5.4`
+.. `mvn deploy -pl gremlin-javascript -DskipTests -Dnpm` - prefer direct deploy with `npm publish --otp <otp>` from `gremlin-javscript/src/main/javascript/gremlin-javascript/`
+.. `mvn deploy -pl gremlint -DskipTests -Dnpm` - prefer direct deploy with `npm publish --otp <otp>` from `gremlint/`
++.. `git tag gremlin-go/v3.6.1`
+ .. `git push --tags`
. Review the GLV releases
.. link:https://pypi.org/project/gremlinpython/[gremlin-python - PyPi]
.. link:https://www.nuget.org/packages/Gremlin.Net/[Gremlin.Net - nuget]
diff --cc gremlin-go/README.md
index 427c8f0f11,5694cd09fd..9c5be34d0c
--- a/gremlin-go/README.md
+++ b/gremlin-go/README.md
@@@ -117,8 -70,11 +70,11 @@@ require
```
As well as a populated `go.sum` file.
- This following example should run, provided that it is configured to point to a compatible `gremlin-server`. In this example, a simple local server is running on port 8182, and this will print`[2]` as an output. If no server is available, this code can still be executed to print an error as output.
+ *if there are no usages for gremlingo found, it will remove the require from go.mod and not import dependencies.*
+
+ ## Simple usage
-Here is a simple example of using Gremlin-Go as an import in a sample project's `main.go` file.
++Here is a simple example of using Gremlin-Go as an import in a sample project's `main.go` file.
```go
package main
@@@ -158,6 -154,42 +154,42 @@@ Note: The exact import name as well as
See [Gremlin-Go Design Overview](design.MD)
+ ## Building Directly
+
+ To build the driver you must install `go`. The following command can be used to build the driver:
+ `go build <path to source code>`
+
+ ## Code Styling and Linting
+ Before generating a pull request, you should manually run the following to ensure correct code styling and fix any issues indicated by the linters.
+
+ ## Formatting files with Gofmt
-To ensure clean and readable code [Gofmt][gofmt] is used.
++To ensure clean and readable code [Gofmt][gofmt] is used.
+
+ Navigate to file path in a terminal window and run:
+
-`go fmt`
++`go fmt`
+
+ Gofmt will recursively check for and format `.go` files.
+
+ Note: If your IDE of choice is [GoLand][goland], code can be automatically formatted with Gofmt on file save. Instructions on how to enable this feature can be found [here][fmtsave].
+
+ ## Using the Linter and staticcheck
+ Run [go vet][gvet] and [staticcheck][scheck] and correct any errors.
+
+ [go vet][gvet] is installed when you install go, and can be run with:
+
- `go vet <path to source code>`
++`go vet <path to source code>`
+
+ Please review the [staticcheck documentation][scheck docs] for more details on installing [staticcheck][scheck]. It can be run with:
+
+ `staticcheck <path to source code>`
+
+ ## Testing with Docker
+
+ Docker allows you to test the driver without installing any dependencies. The following command can be used to run docker:
+
+ `docker-compose up --exit-code-from integration-tests`
+
# Go Gremlin Language Variant
[Apache TinkerPop™][tk] is a graph computing framework for both graph databases (OLTP) and graph analytic systems
@@@ -166,7 -198,7 +198,7 @@@ data-flow language that enables users t
property graph.
Gremlin-Go implements Gremlin within the Go language and can be used on any Go runtime greater than v1.17. One
--important difference between Go and Java is that the functions are capitalized, as is required to export functions is Go.
++important difference between Go and Java is that the functions are capitalized, as is required to export functions is Go.
Gremlin-Go is designed to connect to a "server" that is hosting a TinkerPop-enabled graph system. That "server"
could be [Gremlin Server][gs] or a [remote Gremlin provider][rgp] that exposes protocols by which Gremlin-Go
@@@ -299,7 -282,7 +282,7 @@@ if err != nil
}
```
### Find Vertices
--Getting the property value associated with the added vertex. We currently only support `ToList()` for submitting the remote traversal. Support for `Next()` will be implemented in the subsequent milestones.
++Getting the property value associated with the added vertex. We currently only support `ToList()` for submitting the remote traversal. Support for `Next()` will be implemented in the subsequent milestones.
```go
result, err := g.V().HasLabel("gremlin").Values("language").ToList()
// Handle error
@@@ -314,16 -297,12 +297,12 @@@ for _, r := range result
```
### Update Vertex
--Updating vertex by adding another property to it.
++Updating vertex by adding another property to it.
```go
- _, promise, err :=g.AddV("gremlin").Property("language", "go").Iterate()
- // Handle error
- if err != nil {
- fmt.Println(err)
- return
- }
+ promise := g.AddV("gremlin").Property("language", "go").Iterate()
// Wait for all steps to finish execution and check for error.
- if <-promise != nil {
+ err := <-promise
+ if err != nil {
fmt.Println(err)
return
}
diff --cc gremlin-go/driver/graphBinary.go
index d801e9ced9,f70630b7a3..a43b8c0557
--- a/gremlin-go/driver/graphBinary.go
+++ b/gremlin-go/driver/graphBinary.go
@@@ -32,57 -32,56 +32,57 @@@ import
// Version 1.0
- // DataType graphBinary types.
- type DataType uint8
+ // dataType graphBinary types.
+ type dataType uint8
- // DataType defined as constants.
+ // dataType defined as constants.
const (
- IntType DataType = 0x01
- LongType DataType = 0x02
- StringType DataType = 0x03
- DateType DataType = 0x04
- TimestampType DataType = 0x05
- DoubleType DataType = 0x07
- FloatType DataType = 0x08
- ListType DataType = 0x09
- MapType DataType = 0x0a
- SetType DataType = 0x0b
- UUIDType DataType = 0x0c
- EdgeType DataType = 0x0d
- PathType DataType = 0x0e
- PropertyType DataType = 0x0f
- VertexType DataType = 0x11
- VertexPropertyType DataType = 0x12
- BarrierType DataType = 0x13
- BindingType DataType = 0x14
- CardinalityType DataType = 0x16
- BytecodeType DataType = 0x15
- ColumnType DataType = 0x17
- DirectionType DataType = 0x18
- OperatorType DataType = 0x19
- OrderType DataType = 0x1a
- PickType DataType = 0x1b
- PopType DataType = 0x1c
- LambdaType DataType = 0x1d
- PType DataType = 0x1e
- ScopeType DataType = 0x1f
- TType DataType = 0x20
- TraverserType DataType = 0x21
- BigIntegerType DataType = 0x23
- ByteType DataType = 0x24
- ShortType DataType = 0x26
- BooleanType DataType = 0x27
- TextPType DataType = 0x28
- TraversalStrategyType DataType = 0x29
- BulkSetType DataType = 0x2a
- MergeType DataType = 0x2e
- DurationType DataType = 0x81
- NullType DataType = 0xFE
+ intType dataType = 0x01
+ longType dataType = 0x02
+ stringType dataType = 0x03
+ dateType dataType = 0x04
+ timestampType dataType = 0x05
+ doubleType dataType = 0x07
+ floatType dataType = 0x08
+ listType dataType = 0x09
+ mapType dataType = 0x0a
+ setType dataType = 0x0b
+ uuidType dataType = 0x0c
+ edgeType dataType = 0x0d
+ pathType dataType = 0x0e
+ propertyType dataType = 0x0f
+ vertexType dataType = 0x11
+ vertexPropertyType dataType = 0x12
+ barrierType dataType = 0x13
+ bindingType dataType = 0x14
+ cardinalityType dataType = 0x16
+ bytecodeType dataType = 0x15
+ columnType dataType = 0x17
+ directionType dataType = 0x18
+ operatorType dataType = 0x19
+ orderType dataType = 0x1a
+ pickType dataType = 0x1b
+ popType dataType = 0x1c
+ lambdaType dataType = 0x1d
+ pType dataType = 0x1e
+ scopeType dataType = 0x1f
+ tType dataType = 0x20
+ traverserType dataType = 0x21
+ bigIntegerType dataType = 0x23
+ byteType dataType = 0x24
+ shortType dataType = 0x26
+ booleanType dataType = 0x27
+ textPType dataType = 0x28
+ traversalStrategyType dataType = 0x29
+ bulkSetType dataType = 0x2a
++ mergeType dataType = 0x2e
+ durationType dataType = 0x81
+ nullType dataType = 0xFE
)
- var nullBytes = []byte{NullType.getCodeByte(), 0x01}
+ var nullBytes = []byte{nullType.getCodeByte(), 0x01}
- func (dataType DataType) getCodeByte() byte {
+ func (dataType dataType) getCodeByte() byte {
return byte(dataType)
}
@@@ -984,53 -983,51 +984,53 @@@ func (serializer *graphBinaryTypeSerial
return buffer.Bytes(), err
}, logHandler: serializer.logHandler}, nil
case *Vertex:
- return &graphBinaryTypeSerializer{dataType: VertexType, writer: vertexWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: vertexType, writer: vertexWriter, logHandler: serializer.logHandler}, nil
case *Edge:
- return &graphBinaryTypeSerializer{dataType: EdgeType, writer: edgeWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: edgeType, writer: edgeWriter, logHandler: serializer.logHandler}, nil
case *Property:
- return &graphBinaryTypeSerializer{dataType: PropertyType, writer: propertyWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: propertyType, writer: propertyWriter, logHandler: serializer.logHandler}, nil
case *VertexProperty:
- return &graphBinaryTypeSerializer{dataType: VertexPropertyType, writer: vertexPropertyWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: vertexPropertyType, writer: vertexPropertyWriter, logHandler: serializer.logHandler}, nil
case *Lambda:
- return &graphBinaryTypeSerializer{dataType: LambdaType, writer: lambdaWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: lambdaType, writer: lambdaWriter, logHandler: serializer.logHandler}, nil
case *traversalStrategy:
- return &graphBinaryTypeSerializer{dataType: TraversalStrategyType, writer: traversalStrategyWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: traversalStrategyType, writer: traversalStrategyWriter, logHandler: serializer.logHandler}, nil
case *Path:
- return &graphBinaryTypeSerializer{dataType: PathType, writer: pathWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: pathType, writer: pathWriter, logHandler: serializer.logHandler}, nil
case Set:
- return &graphBinaryTypeSerializer{dataType: SetType, writer: setWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: setType, writer: setWriter, logHandler: serializer.logHandler}, nil
case time.Time:
- return &graphBinaryTypeSerializer{dataType: DateType, writer: timeWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: dateType, writer: timeWriter, logHandler: serializer.logHandler}, nil
case time.Duration:
- return &graphBinaryTypeSerializer{dataType: DurationType, writer: durationWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: durationType, writer: durationWriter, logHandler: serializer.logHandler}, nil
case Cardinality:
- return &graphBinaryTypeSerializer{dataType: CardinalityType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: cardinalityType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Column:
- return &graphBinaryTypeSerializer{dataType: ColumnType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: columnType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Direction:
- return &graphBinaryTypeSerializer{dataType: DirectionType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: directionType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Operator:
- return &graphBinaryTypeSerializer{dataType: OperatorType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: operatorType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Order:
- return &graphBinaryTypeSerializer{dataType: OrderType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: orderType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Pick:
- return &graphBinaryTypeSerializer{dataType: PickType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: pickType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Pop:
- return &graphBinaryTypeSerializer{dataType: PopType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: popType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case T:
- return &graphBinaryTypeSerializer{dataType: TType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: tType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Barrier:
- return &graphBinaryTypeSerializer{dataType: BarrierType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: barrierType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case Scope:
- return &graphBinaryTypeSerializer{dataType: ScopeType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: scopeType, writer: enumWriter, logHandler: serializer.logHandler}, nil
+ case Merge:
- return &graphBinaryTypeSerializer{dataType: MergeType, writer: enumWriter, logHandler: serializer.logHandler}, nil
++ return &graphBinaryTypeSerializer{dataType: mergeType, writer: enumWriter, logHandler: serializer.logHandler}, nil
case p, Predicate:
- return &graphBinaryTypeSerializer{dataType: PType, writer: pWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: pType, writer: pWriter, logHandler: serializer.logHandler}, nil
case textP, TextPredicate:
- return &graphBinaryTypeSerializer{dataType: TextPType, writer: textPWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: textPType, writer: textPWriter, logHandler: serializer.logHandler}, nil
case *Binding, Binding:
- return &graphBinaryTypeSerializer{dataType: BindingType, writer: bindingWriter, logHandler: serializer.logHandler}, nil
+ return &graphBinaryTypeSerializer{dataType: bindingType, writer: bindingWriter, logHandler: serializer.logHandler}, nil
default:
switch reflect.TypeOf(val).Kind() {
case reflect.Map:
diff --cc gremlin-go/driver/serializer.go
index c51fc7f6e5,4bdebe2604..8b40a355e3
--- a/gremlin-go/driver/serializer.go
+++ b/gremlin-go/driver/serializer.go
@@@ -192,8 -191,8 +191,8 @@@ func readMap(buffer *bytes.Buffer, gs *
err = binary.Read(buffer, binary.BigEndian, &keyType)
if err != nil {
return nil, err
- } else if keyType != StringType {
+ } else if keyType != stringType {
- return nil, newError(err0703ReadMapNonStringKeyError)
+ return nil, newError(err0703ReadMapNonStringKeyError, keyType)
}
var nullable byte
err = binary.Read(buffer, binary.BigEndian, &nullable)