diff --git a/.github/workflows/go-test-darwin.yaml b/.github/workflows/go-test-darwin.yaml.disabled similarity index 81% rename from .github/workflows/go-test-darwin.yaml rename to .github/workflows/go-test-darwin.yaml.disabled index cec741e..7b225db 100644 --- a/.github/workflows/go-test-darwin.yaml +++ b/.github/workflows/go-test-darwin.yaml.disabled @@ -5,20 +5,20 @@ on: [push] env: DYLD_LIBRARY_PATH: /opt/senzing/g2/lib:/opt/senzing/g2/lib/macos LD_LIBRARY_PATH: /opt/senzing/g2/lib:/opt/senzing/g2/lib/macos - SENZING_TOOLS_DATABASE_URL: 'sqlite3://na:na@/tmp/sqlite/G2C.db' + SENZING_TOOLS_DATABASE_URL: "sqlite3://na:na@/tmp/sqlite/G2C.db" permissions: contents: read jobs: go-test-darwin: - name: 'go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}' + name: "go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" runs-on: ${{ matrix.os }} strategy: matrix: - go: ['1.21'] + go: ["1.21"] os: [macos-latest] - senzingapi-version: [production-v3] + senzingapi-version: [staging-v4] steps: - name: checkout repository @@ -32,7 +32,7 @@ jobs: go-version: ${{ matrix.go }} - name: install Senzing API - uses: senzing-factory/github-action-install-senzing-api@v2 + uses: senzing-factory/github-action-install-senzing-api@v3 with: senzingapi-version: ${{ matrix.senzingapi-version }} diff --git a/.github/workflows/go-test-linux.yaml b/.github/workflows/go-test-linux.yaml index eb1a7a6..eb92fff 100644 --- a/.github/workflows/go-test-linux.yaml +++ b/.github/workflows/go-test-linux.yaml @@ -4,20 +4,20 @@ on: [push] env: LD_LIBRARY_PATH: /opt/senzing/g2/lib - SENZING_TOOLS_DATABASE_URL: 'sqlite3://na:na@/tmp/sqlite/G2C.db' + SENZING_TOOLS_DATABASE_URL: "sqlite3://na:na@/tmp/sqlite/G2C.db" permissions: contents: read jobs: go-test-linux: - name: 'go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}' + name: "go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" runs-on: ${{ matrix.os }} strategy: matrix: - go: ['1.21'] + go: ["1.21"] os: [ubuntu-latest] - senzingapi-version: [production-v3] + senzingapi-version: [staging-v4] steps: - name: checkout repository @@ -31,9 +31,9 @@ jobs: go-version: ${{ matrix.go }} - name: install Senzing API - uses: senzing-factory/github-action-install-senzing-api@v2 + uses: senzing-factory/github-action-install-senzing-api@v3 with: - senzingapi-version: ${{ matrix.senzingapi-version }} + senzingapi-runtime-version: ${{ matrix.senzingapi-version }} - name: copy /etc files run: sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic diff --git a/.github/workflows/go-test-windows.yaml b/.github/workflows/go-test-windows.yaml index 1e01d17..082a9d3 100644 --- a/.github/workflows/go-test-windows.yaml +++ b/.github/workflows/go-test-windows.yaml @@ -10,13 +10,13 @@ permissions: jobs: go-test-windows: - name: 'go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}' + name: "go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" runs-on: ${{ matrix.os }} strategy: matrix: - go: ['1.21'] + go: ["1.21"] os: [windows-latest] - senzingapi-version: [production-v3] + senzingapi-version: [staging-v4] steps: - name: checkout repository @@ -30,7 +30,7 @@ jobs: go-version: ${{ matrix.go }} - name: install Senzing API - uses: senzing-factory/github-action-install-senzing-api@v2 + uses: senzing-factory/github-action-install-senzing-api@v3 with: senzingapi-version: ${{ matrix.senzingapi-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8595786..f12573b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.9.3] - 2024-05-09 + +### Changed in 0.9.3 + +- Migrate from `g2` to `sz` +- Update dependencies + ## [0.9.2] - 2024-03-15 ### Changed in 0.9.2 diff --git a/go.mod b/go.mod index 0b98e36..5d98f8b 100644 --- a/go.mod +++ b/go.mod @@ -8,22 +8,22 @@ require ( github.com/go-faster/errors v0.7.1 github.com/go-faster/jx v1.1.0 github.com/ogen-go/ogen v1.1.0 - github.com/senzing-garage/g2-sdk-go v0.10.1 - github.com/senzing-garage/g2-sdk-json-type-definition v0.2.1 - github.com/senzing-garage/go-common v0.4.0 + github.com/senzing-garage/go-helpers v0.5.1 github.com/senzing-garage/go-logging v1.4.1 github.com/senzing-garage/go-observing v0.3.1 - github.com/senzing-garage/go-sdk-abstract-factory v0.7.0 + github.com/senzing-garage/go-sdk-abstract-factory v0.8.0 + github.com/senzing-garage/sz-sdk-go v0.12.3 + github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/otel v1.25.0 - go.opentelemetry.io/otel/metric v1.25.0 - go.opentelemetry.io/otel/trace v1.25.0 + go.opentelemetry.io/otel v1.26.0 + go.opentelemetry.io/otel/metric v1.26.0 + go.opentelemetry.io/otel/trace v1.26.0 go.uber.org/multierr v1.11.0 google.golang.org/grpc v1.63.2 ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dlclark/regexp2 v1.11.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect @@ -33,20 +33,20 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/segmentio/asm v1.2.0 // indirect - github.com/senzing-garage/g2-sdk-go-base v0.6.1 // indirect - github.com/senzing-garage/g2-sdk-go-grpc v0.7.0 // indirect - github.com/senzing-garage/g2-sdk-proto/go v0.0.0-20240229231149-cd5a92459976 // indirect github.com/senzing-garage/go-messaging v1.4.1 // indirect + github.com/senzing-garage/sz-sdk-go-core v0.7.1 // indirect + github.com/senzing-garage/sz-sdk-go-grpc v0.7.1 // indirect + github.com/senzing-garage/sz-sdk-proto v0.7.5 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect - google.golang.org/protobuf v1.33.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 7b9069c..f4e681d 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/aquilax/truncate v1.0.0 h1:UgIGS8U/aZ4JyOJ2h3xcF5cSQ06+gGBnjxH2RUHJe0U= github.com/aquilax/truncate v1.0.0/go.mod h1:BeMESIDMlvlS3bmg4BVvBbbZUNwWtS8uzYPAKXwwhLw= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= @@ -34,64 +34,64 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/ogen-go/ogen v1.1.0 h1:hM4osoOPGWvx8pcdqE8jb5VvzHA+wi3u+DwCvZoW4dg= github.com/ogen-go/ogen v1.1.0/go.mod h1:d5Ph7PWpJz453ZdGbVe+DBVPS150idePr5dZ+S0JG00= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/senzing-garage/g2-sdk-go v0.10.1 h1:A5pD8wtULp9VF5opZ4NQvklrcIwFu2HeXzTiyCqNRCU= -github.com/senzing-garage/g2-sdk-go v0.10.1/go.mod h1:Hd2r1UHpizQCMukOqOL8oCUYtU6Foi8M5WVQ5aLNx+Q= -github.com/senzing-garage/g2-sdk-go-base v0.6.1 h1:xomMDYm9ZMI4UitSoh4qg8MzFdw0cQ/CLLdII9/9RF8= -github.com/senzing-garage/g2-sdk-go-base v0.6.1/go.mod h1:XoFyKuLyt6VJt/R2+bxEnvmJe9TqKLoCWKNvrG3bAo8= -github.com/senzing-garage/g2-sdk-go-grpc v0.7.0 h1:XfVtqTQHp6U0sxhsekU2n0ClfdckkglKfc13wk3jYe4= -github.com/senzing-garage/g2-sdk-go-grpc v0.7.0/go.mod h1:etC3ZJQgsZsJbSyGZU8hBXCokuwTwalmg48qHoWDDKs= -github.com/senzing-garage/g2-sdk-json-type-definition v0.2.1 h1:K+q65qpUEU1Pmq57husgt4u3Hp/aX5QuX1kNeqcpjvM= -github.com/senzing-garage/g2-sdk-json-type-definition v0.2.1/go.mod h1:tL1JoqR3GiwiPUrSm1is/sPBwHmYlxz9Jsv/3yHINqM= -github.com/senzing-garage/g2-sdk-proto/go v0.0.0-20240229231149-cd5a92459976 h1:TjxkyM2JeViHP336v19G+lwiDt/3B23JCQmC7v9g/8Q= -github.com/senzing-garage/g2-sdk-proto/go v0.0.0-20240229231149-cd5a92459976/go.mod h1:0+C/1C265Bl6xw+4Ts1GyiAGyJ1ZsVA5ay0tMr9BSyc= -github.com/senzing-garage/go-common v0.4.0 h1:/6/5yNY80udkbOzSAX0Vvx2+0kD9JF7fhqNUlRj2Vho= -github.com/senzing-garage/go-common v0.4.0/go.mod h1:f2EIjPzAcULG8eKUVebIUNS2qgMVcJRgmQY9fpBDF9E= +github.com/senzing-garage/go-helpers v0.5.1 h1:ezVW5oAHihfG2QVpe/Ooyz8q9UPrCuDdg+W43wk9phY= +github.com/senzing-garage/go-helpers v0.5.1/go.mod h1:Gx66fvdAqt4YVf1KVCjzK2Rmr/C7qe5zaZW4VQ3goyM= github.com/senzing-garage/go-logging v1.4.1 h1:ubNspaf0r4Q29XeNW58q0oPGLq4c1pdf9FciQLw6hpc= github.com/senzing-garage/go-logging v1.4.1/go.mod h1:TW1w0UE9fQpy9odkx1jJQeffW+OTdrqEyxhtWKGW1n4= github.com/senzing-garage/go-messaging v1.4.1 h1:ZdFcemh1iACP+HJWGS5/QLaUSD7PUYVXhzW7Zbju9f0= github.com/senzing-garage/go-messaging v1.4.1/go.mod h1:7tEicOa0baYz0lh0w1BJEiQ6ry1FIQl/67JAWwFpcRY= github.com/senzing-garage/go-observing v0.3.1 h1:EGqe+Uix8VNQ9HCwm5xZkAF0hGoHaC1URAaT/5FW37A= github.com/senzing-garage/go-observing v0.3.1/go.mod h1:x60vlRIR0ZdJrHDuK82nzmQG4sN0G6oqdLE9vQl9pVc= -github.com/senzing-garage/go-sdk-abstract-factory v0.7.0 h1:0Y3EX8gyRa4cDOE76js6moAjB/Dwq6IYh0XoKPvp7+I= -github.com/senzing-garage/go-sdk-abstract-factory v0.7.0/go.mod h1:OoGzlpZCq88kib3GqJGKA3WUCTOl9NSPLX8/xBSEmvA= +github.com/senzing-garage/go-sdk-abstract-factory v0.8.0 h1:RvlYWPws6r7v3vqJQz1+JAOlzrDjqS9gFGktLUGizXE= +github.com/senzing-garage/go-sdk-abstract-factory v0.8.0/go.mod h1:LVggzWmDY3Booa4nphl1WUWMus76yEGW6szad1Aoyvc= +github.com/senzing-garage/sz-sdk-go v0.12.3 h1:KDOByEcJ5oTMogR9BKx7UWfEiy2/lswSQqykRmdyJt8= +github.com/senzing-garage/sz-sdk-go v0.12.3/go.mod h1:K+tiyY6W5FnUrzBZXIg5x7cWbZKpO/6rzpkCoKhcK6o= +github.com/senzing-garage/sz-sdk-go-core v0.7.1 h1:J1qAXrMxhYIStEdc7r4+RnPR9W13x/9h5HRYn7OwQO4= +github.com/senzing-garage/sz-sdk-go-core v0.7.1/go.mod h1:+WbyXc3vgmGaYO5tbHSFAxfTfiart5g/ljR+I0g8b7s= +github.com/senzing-garage/sz-sdk-go-grpc v0.7.1 h1:MzxEUojOBboNvWFUE6wo8cs6g8FpnHDGGLuA44CiSLA= +github.com/senzing-garage/sz-sdk-go-grpc v0.7.1/go.mod h1:nD9wzF3CpUGQAnbGiR1UDVM0t8KQHBG9cd75NArJBtI= +github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4 h1:mM3yu8Ntbupl92I78Z1VzOMguL7/4oI/0LmfB8pLifM= +github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4/go.mod h1:UlKL1vflvcE8rNOpbptlNiw57SixFAUWk5ftu5gHL9Y= +github.com/senzing-garage/sz-sdk-proto v0.7.5 h1:XDEVh9gsB1DRSE/O/bb9fYIoror3K8NNNbTzDHaFvPo= +github.com/senzing-garage/sz-sdk-proto v0.7.5/go.mod h1:Volu1U+jmQZKA3XkcyRgj9VpKVLmsdjhVBGSwWS+bvs= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= -go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= -go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= -go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= -go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= -go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= +go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 h1:umK/Ey0QEzurTNlsV3R+MfxHAb78HCEX/IkuR+zH4WQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/senzingrestservice/senzingrestservice.go b/senzingrestservice/senzingrestservice.go index f1a8218..a7db72a 100644 --- a/senzingrestservice/senzingrestservice.go +++ b/senzingrestservice/senzingrestservice.go @@ -9,13 +9,13 @@ import ( "sync" "time" - "github.com/senzing-garage/g2-sdk-go/g2api" - "github.com/senzing-garage/g2-sdk-go/senzing" - "github.com/senzing-garage/g2-sdk-json-type-definition/go/typedef" "github.com/senzing-garage/go-logging/logging" "github.com/senzing-garage/go-observing/observer" api "github.com/senzing-garage/go-rest-api-service/senzingrestapi" - "github.com/senzing-garage/go-sdk-abstract-factory/factory" + "github.com/senzing-garage/go-sdk-abstract-factory/szfactorycreator" + "github.com/senzing-garage/sz-sdk-go/senzing" + "github.com/senzing-garage/sz-sdk-go/sz" + "github.com/senzing-garage/sz-sdk-json-type-definition/go/typedef" "google.golang.org/grpc" ) @@ -25,15 +25,9 @@ import ( // SenzingRestServiceImpl is... type SenzingRestServiceImpl struct { + abstractFactory sz.SzAbstractFactory + abstractFactorySyncOnce sync.Once api.UnimplementedHandler - abstractFactory factory.SdkAbstractFactory - abstractFactorySyncOnce sync.Once - g2configmgrSingleton g2api.G2configmgr - g2configmgrSyncOnce sync.Once - g2configSingleton g2api.G2config - g2configSyncOnce sync.Once - g2productSingleton g2api.G2product - g2productSyncOnce sync.Once GrpcDialOptions []grpc.DialOption GrpcTarget string isTrace bool @@ -46,6 +40,12 @@ type SenzingRestServiceImpl struct { SenzingEngineConfigurationJson string SenzingModuleName string SenzingVerboseLogging int64 + szConfigManagerSingleton sz.SzConfigManager + szConfigManagerSyncOnce sync.Once + szConfigSingleton sz.SzConfig + szConfigSyncOnce sync.Once + szProductSingleton sz.SzProduct + szProductSyncOnce sync.Once UrlRoutePrefix string } @@ -112,16 +112,22 @@ func (restApiService *SenzingRestServiceImpl) error(messageNumber int, details . // --- Services --------------------------------------------------------------- -func (restApiService *SenzingRestServiceImpl) getAbstractFactory() factory.SdkAbstractFactory { +func (restApiService *SenzingRestServiceImpl) getAbstractFactory(ctx context.Context) sz.SzAbstractFactory { + var err error = nil restApiService.abstractFactorySyncOnce.Do(func() { if len(restApiService.GrpcTarget) == 0 { - restApiService.abstractFactory = &factory.SdkAbstractFactoryImpl{} + restApiService.abstractFactory, err = szfactorycreator.CreateCoreAbstractFactory(restApiService.SenzingModuleName, restApiService.SenzingEngineConfigurationJson, restApiService.SenzingVerboseLogging, sz.SZ_INITIALIZE_WITH_DEFAULT_CONFIGURATION) + if err != nil { + panic(err) + } } else { - restApiService.abstractFactory = &factory.SdkAbstractFactoryImpl{ - GrpcDialOptions: restApiService.GrpcDialOptions, - GrpcTarget: restApiService.GrpcTarget, - ObserverOrigin: restApiService.ObserverOrigin, - Observers: restApiService.Observers, + grpcConnection, err := grpc.DialContext(ctx, restApiService.GrpcTarget, restApiService.GrpcDialOptions...) + if err != nil { + panic(err) + } + restApiService.abstractFactory, err = szfactorycreator.CreateGrpcAbstractFactory(grpcConnection) + if err != nil { + panic(err) } } }) @@ -130,59 +136,43 @@ func (restApiService *SenzingRestServiceImpl) getAbstractFactory() factory.SdkAb // Singleton pattern for g2config. // See https://medium.com/golang-issue/how-singleton-pattern-works-with-golang-2fdd61cd5a7f -func (restApiService *SenzingRestServiceImpl) getG2config(ctx context.Context) g2api.G2config { +func (restApiService *SenzingRestServiceImpl) getG2config(ctx context.Context) sz.SzConfig { var err error = nil - restApiService.g2configSyncOnce.Do(func() { - restApiService.g2configSingleton, err = restApiService.getAbstractFactory().GetG2config(ctx) + restApiService.szConfigSyncOnce.Do(func() { + restApiService.szConfigSingleton, err = restApiService.getAbstractFactory(ctx).CreateSzConfig(ctx) if err != nil { panic(err) } - if restApiService.g2configSingleton.GetSdkId(ctx) == factory.ImplementedByBase { - err = restApiService.g2configSingleton.Init(ctx, restApiService.SenzingModuleName, restApiService.SenzingEngineConfigurationJson, restApiService.SenzingVerboseLogging) - if err != nil { - panic(err) - } - } }) - return restApiService.g2configSingleton + return restApiService.szConfigSingleton } // Singleton pattern for g2config. // See https://medium.com/golang-issue/how-singleton-pattern-works-with-golang-2fdd61cd5a7f -func (restApiService *SenzingRestServiceImpl) getG2configmgr(ctx context.Context) g2api.G2configmgr { +func (restApiService *SenzingRestServiceImpl) getG2configmgr(ctx context.Context) sz.SzConfigManager { var err error = nil - restApiService.g2configmgrSyncOnce.Do(func() { - restApiService.g2configmgrSingleton, err = restApiService.getAbstractFactory().GetG2configmgr(ctx) + restApiService.szConfigManagerSyncOnce.Do(func() { + restApiService.szConfigManagerSingleton, err = restApiService.getAbstractFactory(ctx).CreateSzConfigManager(ctx) if err != nil { panic(err) } - if restApiService.g2configmgrSingleton.GetSdkId(ctx) == factory.ImplementedByBase { - err = restApiService.g2configmgrSingleton.Init(ctx, restApiService.SenzingModuleName, restApiService.SenzingEngineConfigurationJson, restApiService.SenzingVerboseLogging) - if err != nil { - panic(err) - } - } + }) - return restApiService.g2configmgrSingleton + return restApiService.szConfigManagerSingleton } // Singleton pattern for g2product. // See https://medium.com/golang-issue/how-singleton-pattern-works-with-golang-2fdd61cd5a7f -func (restApiService *SenzingRestServiceImpl) getG2product(ctx context.Context) g2api.G2product { +func (restApiService *SenzingRestServiceImpl) getG2product(ctx context.Context) sz.SzProduct { var err error = nil - restApiService.g2productSyncOnce.Do(func() { - restApiService.g2productSingleton, err = restApiService.getAbstractFactory().GetG2product(ctx) + restApiService.szProductSyncOnce.Do(func() { + restApiService.szProductSingleton, err = restApiService.getAbstractFactory(ctx).CreateSzProduct(ctx) if err != nil { panic(err) } - if restApiService.g2productSingleton.GetSdkId(ctx) == factory.ImplementedByBase { - err = restApiService.g2productSingleton.Init(ctx, restApiService.SenzingModuleName, restApiService.SenzingEngineConfigurationJson, restApiService.SenzingVerboseLogging) - if err != nil { - panic(err) - } - } + }) - return restApiService.g2productSingleton + return restApiService.szProductSingleton } // --- Misc ------------------------------------------------------------------- @@ -235,20 +225,20 @@ func (restApiService *SenzingRestServiceImpl) getConfigurationHandle(ctx context var err error = nil var result uintptr var configurationString string - g2Config := restApiService.getG2config(ctx) - g2Configmgr := restApiService.getG2configmgr(ctx) - configID, err := g2Configmgr.GetDefaultConfigID(ctx) + szConfig := restApiService.getG2config(ctx) + szConfigManager := restApiService.getG2configmgr(ctx) + configId, err := szConfigManager.GetDefaultConfigId(ctx) if err != nil { return result, err } - if configID == 0 { - return g2Config.Create(ctx) + if configId == 0 { + return szConfig.CreateConfig(ctx) } - configurationString, err = g2Configmgr.GetConfig(ctx, configID) + configurationString, err = szConfigManager.GetConfig(ctx, configId) if err != nil { return result, err } - result, err = g2Config.Load(ctx, configurationString) + result, err = szConfig.ImportConfig(ctx, configurationString) if err != nil { return result, err } @@ -258,29 +248,29 @@ func (restApiService *SenzingRestServiceImpl) getConfigurationHandle(ctx context // Persist in-memory Senzing Configuration to Senzing database SYS_CFG table. func (restApiService *SenzingRestServiceImpl) persistConfiguration(ctx context.Context, configurationHandle uintptr) error { var err error = nil - g2Config := restApiService.getG2config(ctx) - g2Configmgr := restApiService.getG2configmgr(ctx) - newConfigurationString, err := g2Config.Save(ctx, configurationHandle) + szConfig := restApiService.getG2config(ctx) + szConfigManager := restApiService.getG2configmgr(ctx) + newConfigurationString, err := szConfig.ExportConfig(ctx, configurationHandle) if err != nil { return err } - newConfigId, err := g2Configmgr.AddConfig(ctx, newConfigurationString, "FIXME: description") + newConfigId, err := szConfigManager.AddConfig(ctx, newConfigurationString, "FIXME: description") if err != nil { return err } - err = g2Configmgr.SetDefaultConfigID(ctx, newConfigId) + err = szConfigManager.SetDefaultConfigId(ctx, newConfigId) if err != nil { return err } return err } -func (restApiService *SenzingRestServiceImpl) getSenzingVersion(ctx context.Context) (*typedef.G2productVersionResponse, error) { - response, err := restApiService.getG2product(ctx).Version(ctx) +func (restApiService *SenzingRestServiceImpl) getSenzingVersion(ctx context.Context) (*typedef.SzProductGetVersionResponse, error) { + response, err := restApiService.getG2product(ctx).GetVersion(ctx) if err != nil { return nil, err } - return senzing.UnmarshalG2productVersionResponse(ctx, response) + return senzing.UnmarshalSzProductGetVersionResponse(ctx, response) } // --- Debug ------------------------------------------------------------------ @@ -356,7 +346,7 @@ func (restApiService *SenzingRestServiceImpl) AddDataSources(ctx context.Context // Get Senzing resources. - g2Config := restApiService.getG2config(ctx) + szConfig := restApiService.getG2config(ctx) // Get current configuration from database into memory. @@ -369,8 +359,7 @@ func (restApiService *SenzingRestServiceImpl) AddDataSources(ctx context.Context sdkResponses := []string{} for _, dataSource := range params.DataSource { - sdkRequest := fmt.Sprintf(`{"DSRC_CODE": "%s"}`, dataSource) - sdkResponse, err := g2Config.AddDataSource(ctx, configurationHandle, sdkRequest) + sdkResponse, err := szConfig.AddDataSource(ctx, configurationHandle, dataSource) if err != nil { return r, err } @@ -395,7 +384,7 @@ func (restApiService *SenzingRestServiceImpl) AddDataSources(ctx context.Context // fmt.Printf(">>>>>> ListDataSources: %s\n", rawData) - err = g2Config.Close(ctx, configurationHandle) + err = szConfig.CloseConfig(ctx, configurationHandle) fmt.Println(sdkResponses) @@ -493,11 +482,11 @@ func (restApiService *SenzingRestServiceImpl) Heartbeat(ctx context.Context) (r } func (restApiService *SenzingRestServiceImpl) License(ctx context.Context, params api.LicenseParams) (r api.LicenseRes, _ error) { - response, err := restApiService.getG2product(ctx).License(ctx) + response, err := restApiService.getG2product(ctx).GetLicense(ctx) if err != nil { return nil, err } - parsedResponse, err := senzing.UnmarshalG2productLicenseResponse(ctx, response) + parsedResponse, err := senzing.UnmarshalSzProductGetLicenseResponse(ctx, response) if err != nil { return nil, err } diff --git a/senzingrestservice/senzingrestservice_test.go b/senzingrestservice/senzingrestservice_test.go index fb3a60d..00de778 100644 --- a/senzingrestservice/senzingrestservice_test.go +++ b/senzingrestservice/senzingrestservice_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/senzing-garage/go-common/g2engineconfigurationjson" + "github.com/senzing-garage/go-helpers/engineconfigurationjson" api "github.com/senzing-garage/go-rest-api-service/senzingrestapi" "github.com/stretchr/testify/assert" ) @@ -22,8 +22,9 @@ var ( // ---------------------------------------------------------------------------- func getTestObject(ctx context.Context, test *testing.T) SenzingRestService { + _ = ctx if senzingRestServiceSingleton == nil { - senzingEngineConfigurationJson, err := g2engineconfigurationjson.BuildSimpleSystemConfigurationJsonUsingEnvVars() + senzingEngineConfigurationJson, err := engineconfigurationjson.BuildSimpleSystemConfigurationJsonUsingEnvVars() if err != nil { test.Errorf("Error: %s", err) } @@ -37,6 +38,7 @@ func getTestObject(ctx context.Context, test *testing.T) SenzingRestService { } func testError(test *testing.T, ctx context.Context, err error) { + _ = ctx if err != nil { test.Log("Error:", err.Error()) assert.FailNow(test, err.Error())