From d52ef6e342113b989ce40350411f245c5e0fe745 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Mon, 1 Nov 2021 15:47:10 -0400 Subject: [PATCH 1/6] Move definitions of datatypes and tokens to their proper namespace Signed-off-by: Nicko Guyer --- go.mod | 9 -- go.sum | 123 ++-------------------- internal/broadcast/datatype.go | 2 +- internal/broadcast/definition.go | 18 ++-- internal/broadcast/definition_test.go | 27 ++++- internal/broadcast/manager.go | 4 +- internal/broadcast/namespace.go | 2 +- internal/broadcast/tokenpool.go | 2 +- internal/events/aggregator.go | 2 +- internal/networkmap/register_node.go | 2 +- internal/networkmap/register_node_test.go | 2 +- internal/syshandlers/syshandler.go | 2 +- mocks/broadcastmocks/manager.go | 28 ++--- test/e2e/tokens_test.go | 4 + 14 files changed, 67 insertions(+), 160 deletions(-) diff --git a/go.mod b/go.mod index 332ad26ca7..9b13248292 100644 --- a/go.mod +++ b/go.mod @@ -5,21 +5,15 @@ go 1.16 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/Masterminds/squirrel v1.5.1 - github.com/Microsoft/go-winio v0.5.0 // indirect github.com/aidarkhanov/nanoid v1.0.8 github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect - github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051 // indirect - github.com/containerd/containerd v1.5.7 // indirect - github.com/coreos/etcd v3.3.13+incompatible // indirect github.com/docker/go-units v0.4.0 github.com/getkin/kin-openapi v0.80.0 github.com/ghodss/yaml v1.0.0 github.com/go-openapi/swag v0.19.15 // indirect github.com/go-resty/resty/v2 v2.6.0 github.com/golang-migrate/migrate/v4 v4.15.1 - github.com/google/go-github v17.0.0+incompatible // indirect github.com/google/uuid v1.3.0 - github.com/gorilla/context v1.1.1 // indirect github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.4.2 github.com/hashicorp/errwrap v1.1.0 // indirect @@ -45,8 +39,6 @@ require ( github.com/stretchr/testify v1.7.0 github.com/wayneashleyberry/terminal-dimensions v1.0.0 // indirect github.com/x-cray/logrus-prefixed-formatter v0.5.2 - github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect - github.com/xdg/stringprep v1.0.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonschema v1.2.0 go.uber.org/atomic v1.9.0 // indirect @@ -54,6 +46,5 @@ require ( golang.org/x/sys v0.0.0-20211025112917-711f33c9992c // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 - google.golang.org/grpc v1.41.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) diff --git a/go.sum b/go.sum index db0fde54b9..36bf149d92 100644 --- a/go.sum +++ b/go.sum @@ -39,7 +39,6 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/spanner v1.18.0/go.mod h1:LvAjUXPeJRGNuGpikMULjhLj/t9cRvdc+fxRoLiugXA= cloud.google.com/go/spanner v1.24.0/go.mod h1:EZI0yH1D/PrXK0XH9Ba5LGXTXWeqZv0ClOD/19a0Z58= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= @@ -50,16 +49,14 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-storage-blob-go v0.13.0/go.mod h1:pA9kNqtjUeQF2zOSu4s//nUdBD+e64lEuc4sVnuOfNs= github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/adal v0.9.2/go.mod h1:/3SMAM86bP6wC9Ev35peQDUeqFZBMH07vvUOmg4z/fE= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= @@ -75,8 +72,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/Masterminds/squirrel v1.5.0 h1:JukIZisrUXadA9pl3rMkjhiamxiB0cXiu+HGp/Y8cY8= -github.com/Masterminds/squirrel v1.5.0/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Masterminds/squirrel v1.5.1 h1:kWAKlLLJFxZG7N2E0mBMNWVp5AuUX+JUrnhFN74Eg+w= github.com/Masterminds/squirrel v1.5.1/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= @@ -113,8 +108,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= -github.com/apache/arrow/go/arrow v0.0.0-20210521153258-78c88a9f517b/go.mod h1:R4hW3Ug0s+n4CUsWHKOj00Pu01ZqU4x/hSF5kXUcXKQ= github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY= github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -125,55 +118,30 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v1.3.2/go.mod h1:7OaACgj2SX3XGWnrIjGlJM22h6yD6MEWKvm7levnnM8= -github.com/aws/aws-sdk-go-v2 v1.6.0/go.mod h1:tI4KhsR5VkzlUa2DZAdwx7wCAYGwkZZ1H31PYrBFx1w= github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2/config v1.1.5/go.mod h1:P3F1hku7qzC81txjwXnwOM6Ex6ezkU6+/557Teyb64E= -github.com/aws/aws-sdk-go-v2/config v1.3.0/go.mod h1:lOxzHWDt/k7MMidA/K8DgXL4+ynnZYsDq65Qhs/l3dg= github.com/aws/aws-sdk-go-v2/config v1.6.0/go.mod h1:TNtBVmka80lRPk5+S9ZqVfFszOQAGJJ9KbT3EM3CHNU= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/credentials v1.1.5/go.mod h1:Ir1R6tPiR1/2y1hes8yOijFMz54hzSmgcmCDo6F45Qc= -github.com/aws/aws-sdk-go-v2/credentials v1.2.1/go.mod h1:Rfvim1eZTC9W5s8YJyYYtl1KMk6e8fHv+wMRQGO4Ru0= github.com/aws/aws-sdk-go-v2/credentials v1.3.2/go.mod h1:PACKuTJdt6AlXvEq8rFI4eDmoqDFC5DpVKQbWysaDgM= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.6/go.mod h1:0+fWMitrmIpENiY8/1DyhdYPUCAPvd9UNz9mtCsEoLQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.1.1/go.mod h1:GTXAhrxHQOj9N+J5tYVjwt+rpRyy/42qLjlgw9pz1a0= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.4.0/go.mod h1:Mj/U8OpDbcVcoctrYwA2bak8k/HFPdcLzI/vaiXMwuM= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.1.2/go.mod h1:Azf567f5wBUfUbwpyJJnLM/geFFIzEulGR30L+nQZOE= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.2.1/go.mod h1:2JOqaBP3I6TEm27NLb11UiD9j4HZsJ+EW4N7vCf8WGQ= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.4.0/go.mod h1:eHwXu2+uE/T6gpnYWwBwqoeqRf9IXyCcolyOWDRAErQ= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.5.4/go.mod h1:Ex7XQmbFmgFHrjUX6TN3mApKW5Hglyga+F7wZHTtYhA= -github.com/aws/aws-sdk-go-v2/internal/ini v1.0.0/go.mod h1:g3XMXuxvqSMUjnsXXp/960152w0wFS4CXVYgQaSVOHE= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0/go.mod h1:Q5jATQc+f1MfZp3PDMhn6ry18hGvE0i8yvbXoKbnZaE= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.0.4/go.mod h1:BCfU3Uo2fhKcMZFp9zU5QQGQxqWCOYmZ/27Dju3S/do= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0/go.mod h1:zdjOOy0ojUn3iNELo6ycIHSMCp4xUbycSHfb8PnbbyM= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.2.2/go.mod h1:EASdTcM1lGhUe1/p4gkojHwlGJkeoRjjr1sRCzup3Is= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.3.0/go.mod h1:v8ygadNyATSm6elwJ/4gzJwcFhri9RqS8skgHKiwXPU= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.6/go.mod h1:L0KWr0ASo83PRZu9NaZaDsw3koS6PspKv137DMDZjHo= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1/go.mod h1:2+ehJPkdIdl46VCj67Emz/EH2hpebHZtaLdzqg+sWOI= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.2.2/go.mod h1:NXmNI41bdEsJMrD0v9rUvbGCB5GwdBEpKvUvIY3vTFg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.2.2/go.mod h1:nnutjMLuna0s3GVY/MAkpLX03thyNER06gXvnMAPj5g= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.3.1/go.mod h1:IpjxfORBAFfkMM0VEx5gPPnEy6WV4Hk0F/+zb/SUWyw= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.5.2/go.mod h1:QuL2Ym8BkrLmN4lUofXYq6000/i5jPjosCNK//t6gak= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.7.2/go.mod h1:np7TMuJNT83O0oDOSF8i4dF3dvGqA6hPYYo6YYkzgRA= -github.com/aws/aws-sdk-go-v2/service/s3 v1.5.0/go.mod h1:uwA7gs93Qcss43astPUb1eq4RyceNmYWAQjZFDOAMLo= -github.com/aws/aws-sdk-go-v2/service/s3 v1.8.0/go.mod h1:zHCjYoODbYRLz/iFicYswq1gRoxBnHvpY5h2Vg3/tJ4= github.com/aws/aws-sdk-go-v2/service/s3 v1.12.0/go.mod h1:6J++A5xpo7QDsIeSqPK4UHqMSyPOCopa+zKtqAMhqVQ= github.com/aws/aws-sdk-go-v2/service/s3 v1.16.1/go.mod h1:CQe/KvWV1AqRc65KqeJjrLzr5X2ijnFTTVzJW0VBRCI= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.5/go.mod h1:bpGz0tidC4y39sZkQSkpO/J0tzWCMXHbw6FZ0j1GkWM= -github.com/aws/aws-sdk-go-v2/service/sso v1.2.1/go.mod h1:VimPFPltQ/920i1X0Sb0VJBROLIHkDg2MNP10D46OGs= github.com/aws/aws-sdk-go-v2/service/sso v1.3.2/go.mod h1:J21I6kF+d/6XHVk7kp/cx9YVD2TMD2TbLwtRGVcinXo= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sts v1.2.2/go.mod h1:ssRzzJ2RZOVuKj2Vx1YE7ypfil/BIlgmQnCSW4DistU= -github.com/aws/aws-sdk-go-v2/service/sts v1.4.1/go.mod h1:G9osDWA52WQ38BDcj65VY1cNmcAQXAXTsE8IWH8j81w= github.com/aws/aws-sdk-go-v2/service/sts v1.6.1/go.mod h1:hLZ/AnkIKHLuPGjEiyghNEdvJ2PP0MgOxcmv9EBJ4xs= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/smithy-go v1.3.1/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.4.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= @@ -189,7 +157,6 @@ github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCS github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= @@ -222,7 +189,6 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/cockroachdb/cockroach-go/v2 v2.1.1/go.mod h1:7NtUnP6eK+l6k483WSYNrq3Kb23bWV10IRV1TyeSpwM= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= @@ -310,7 +276,6 @@ github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgU github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= @@ -339,22 +304,19 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/denisenkom/go-mssqldb v0.0.0-20200620013148-b91950f658ec/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dhui/dktest v0.3.4 h1:VbUEcaSP+U2/yUr9d2JhSThXYEnDlGabRSHe2rIE46E= -github.com/dhui/dktest v0.3.4/go.mod h1:4m4n6lmXlmVfESth7mzdcv8nBI5mOb5UROPqjM02csU= +github.com/dhui/dktest v0.3.7 h1:jWjWgHAPDAdqgUr7lAsB3bqB2DKWC3OaA+isfekjRew= github.com/dhui/dktest v0.3.7/go.mod h1:nYMOkafiA07WchSwKnKFUSbGMb2hMm5DrCGiXYG6gwM= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v17.12.0-ce-rc1.0.20210128214336-420b1d36250f+incompatible h1:nhVo1udYfMj0Jsw0lnqrTjjf33aLpdgW9Wve9fHVzhQ= -github.com/docker/docker v17.12.0-ce-rc1.0.20210128214336-420b1d36250f+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.9+incompatible h1:JlsVnETOjM2RLQa0Cc1XCIspUdXW3Zenq9P54uXBm6k= github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= @@ -388,11 +350,9 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -401,8 +361,6 @@ github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXt github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/getkin/kin-openapi v0.77.0 h1:yeShypHFCtG6L0ZyIFWAPZuitkybgyIs9Pg3iFVECgQ= -github.com/getkin/kin-openapi v0.77.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/getkin/kin-openapi v0.80.0 h1:W/s5/DNnDCR8P+pYyafEWlGk4S7/AfQUWXgrRSSAzf8= github.com/getkin/kin-openapi v0.80.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -469,7 +427,6 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= -github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= @@ -487,8 +444,6 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-migrate/migrate/v4 v4.14.2-0.20210521165626-8a1a8534dc64 h1:9l8B/kFljlYwsvh+/hTp/NDZOlA+4oUugGBO/Xk7j/o= -github.com/golang-migrate/migrate/v4 v4.14.2-0.20210521165626-8a1a8534dc64/go.mod h1:tqItCmicY5gua/AYhFQPc+Ryk+Q1BM6SaNjjPalUu/E= github.com/golang-migrate/migrate/v4 v4.15.1 h1:Sakl3Nm6+wQKq0Q62tpFMi5a503bgGhceo2icrgQ9vM= github.com/golang-migrate/migrate/v4 v4.15.1/go.mod h1:/CrBenUbcDqsW29jGTR/XFqCfVi/Y6mHXlooCcSOJMQ= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= @@ -533,7 +488,6 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -547,7 +501,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -582,14 +535,11 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= @@ -717,7 +667,6 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= @@ -739,7 +688,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -750,6 +698,7 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= @@ -769,12 +718,9 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -792,8 +738,6 @@ github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcncea github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= @@ -806,24 +750,18 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= -github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= -github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA= github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/microcosm-cc/bluemonday v1.0.9 h1:dpCwruVKoyrULicJwhuY76jB+nIxRVKv/e248Vx/BXg= -github.com/microcosm-cc/bluemonday v1.0.9/go.mod h1:B2riunDr9benLHghZB7hjIgdwSUzzs0pjCxFrWYEZFU= github.com/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc= github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -840,7 +778,6 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -850,6 +787,7 @@ github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2J github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -869,7 +807,6 @@ github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= @@ -924,7 +861,6 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -932,11 +868,7 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4/v4 v4.1.4/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.7/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -988,8 +920,6 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.0 h1:P2KMzcFwrPoSjkF1WLRPsp3UMLyql8L4v9hQpVeK5so= github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -1017,12 +947,9 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/snowflakedb/gosnowflake v1.4.3/go.mod h1:1kyg2XEduwti88V11PKRHImhXLK5WpGiayY6lFNYb98= github.com/snowflakedb/gosnowflake v1.6.3/go.mod h1:6hLajn6yxuJ4xUHZegMekpq9rnQbGJ7TMwXjgTmA6lg= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1031,15 +958,12 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -1052,8 +976,6 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= @@ -1064,7 +986,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1078,7 +999,6 @@ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= -github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -1107,9 +1027,6 @@ github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVT github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -1138,7 +1055,6 @@ go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3C go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1184,8 +1100,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -1279,7 +1193,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -1291,14 +1204,10 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211006190231-62292e806868 h1:KlOXYy8wQWTUJYFgkUI40Lzr06ofg5IRXUK5C7qZt1k= -golang.org/x/net v0.0.0-20211006190231-62292e806868/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI= golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1316,7 +1225,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -1417,7 +1325,6 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1425,13 +1332,10 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210521090106-6ca3eb03dfc2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1441,14 +1345,10 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025112917-711f33c9992c h1:i4MLwL3EbCgobekQtkVW94UBSPLMadfEGtKq+CAFsEU= golang.org/x/sys v0.0.0-20211025112917-711f33c9992c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w= -golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1574,7 +1474,6 @@ google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjR google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/api v0.45.0/go.mod h1:ISLIJCedJolbZvDfAk+Ctuq5hf+aJ33WgtUsfyFoLXA= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= @@ -1624,7 +1523,6 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200911024640-645f7a48b24f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1636,8 +1534,6 @@ google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210427215850-f767ed18ee4d/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= @@ -1653,8 +1549,7 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e h1:Im71rbA1N3CbIag/PumYhQcNR8bLNmuOtRIyOnnLsT8= -google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1673,7 +1568,6 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= @@ -1710,8 +1604,7 @@ gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/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= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1721,8 +1614,6 @@ gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8 gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= diff --git a/internal/broadcast/datatype.go b/internal/broadcast/datatype.go index 52ace611ae..7246423b0f 100644 --- a/internal/broadcast/datatype.go +++ b/internal/broadcast/datatype.go @@ -43,7 +43,7 @@ func (bm *broadcastManager) BroadcastDatatype(ctx context.Context, ns string, da if err := bm.data.CheckDatatype(ctx, ns, datatype); err != nil { return nil, err } - msg, err := bm.BroadcastDefinitionAsNode(ctx, datatype, fftypes.SystemTagDefineDatatype, waitConfirm) + msg, err := bm.BroadcastDefinitionAsNode(ctx, ns, datatype, fftypes.SystemTagDefineDatatype, waitConfirm) if msg != nil { datatype.Message = msg.Header.ID } diff --git a/internal/broadcast/definition.go b/internal/broadcast/definition.go index 4f3c22be13..c98670167d 100644 --- a/internal/broadcast/definition.go +++ b/internal/broadcast/definition.go @@ -24,34 +24,34 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { - return bm.BroadcastDefinition(ctx, def, &fftypes.Identity{ /* resolve to node default */ }, tag, waitConfirm) +func (bm *broadcastManager) BroadcastDefinitionAsNode(ctx context.Context, ns string, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { + return bm.BroadcastDefinition(ctx, ns, def, &fftypes.Identity{ /* resolve to node default */ }, tag, waitConfirm) } -func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { +func (bm *broadcastManager) BroadcastDefinition(ctx context.Context, ns string, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { err = bm.identity.ResolveInputIdentity(ctx, signingIdentity) if err != nil { return nil, err } - return bm.broadcastDefinitionCommon(ctx, def, signingIdentity, tag, waitConfirm) + return bm.broadcastDefinitionCommon(ctx, ns, def, signingIdentity, tag, waitConfirm) } func (bm *broadcastManager) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { signingIdentity.Author = bm.identity.OrgDID(def) - return bm.broadcastDefinitionCommon(ctx, def, signingIdentity, tag, waitConfirm) + return bm.broadcastDefinitionCommon(ctx, fftypes.SystemNamespace, def, signingIdentity, tag, waitConfirm) } -func (bm *broadcastManager) broadcastDefinitionCommon(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { +func (bm *broadcastManager) broadcastDefinitionCommon(ctx context.Context, ns string, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) { // Serialize it into a data object, as a piece of data we can write to a message data := &fftypes.Data{ Validator: fftypes.ValidatorTypeSystemDefinition, ID: fftypes.NewUUID(), - Namespace: fftypes.SystemNamespace, + Namespace: ns, Created: fftypes.Now(), } data.Value, err = json.Marshal(&def) @@ -71,7 +71,7 @@ func (bm *broadcastManager) broadcastDefinitionCommon(ctx context.Context, def f in := &fftypes.MessageInOut{ Message: fftypes.Message{ Header: fftypes.MessageHeader{ - Namespace: fftypes.SystemNamespace, + Namespace: ns, Type: fftypes.MessageTypeDefinition, Identity: *signingIdentity, Topics: fftypes.FFNameArray{def.Topic()}, @@ -87,7 +87,7 @@ func (bm *broadcastManager) broadcastDefinitionCommon(ctx context.Context, def f // Broadcast the message sender := broadcastSender{ mgr: bm, - namespace: fftypes.SystemNamespace, + namespace: ns, msg: in, resolved: true, } diff --git a/internal/broadcast/definition_test.go b/internal/broadcast/definition_test.go index ab57c9a7e7..020dd10c2e 100644 --- a/internal/broadcast/definition_test.go +++ b/internal/broadcast/definition_test.go @@ -40,7 +40,28 @@ func TestBroadcastDefinitionAsNodeConfirm(t *testing.T) { mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) msa.On("WaitForMessage", bm.ctx, "ff_system", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("pop")) - _, err := bm.BroadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, true) + _, err := bm.BroadcastDefinitionAsNode(bm.ctx, fftypes.SystemNamespace, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, true) + assert.EqualError(t, err, "pop") + + mdi.AssertExpectations(t) + msa.AssertExpectations(t) + mim.AssertExpectations(t) +} + +func TestBroadcastDatatypeDefinitionAsNodeConfirm(t *testing.T) { + bm, cancel := newTestBroadcast(t) + defer cancel() + + mdi := bm.database.(*databasemocks.Plugin) + msa := bm.syncasync.(*syncasyncmocks.Bridge) + mim := bm.identity.(*identitymanagermocks.Manager) + ns := "customNamespace" + + mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(nil) + mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) + msa.On("WaitForMessage", bm.ctx, ns, mock.Anything, mock.Anything).Return(nil, fmt.Errorf("pop")) + + _, err := bm.BroadcastDefinitionAsNode(bm.ctx, ns, &fftypes.Datatype{}, fftypes.SystemTagDefineNamespace, true) assert.EqualError(t, err, "pop") mdi.AssertExpectations(t) @@ -56,7 +77,7 @@ func TestBroadcastDefinitionAsNodeUpsertFail(t *testing.T) { mdi.On("UpsertData", mock.Anything, mock.Anything, true, false).Return(fmt.Errorf("pop")) mim := bm.identity.(*identitymanagermocks.Manager) mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(nil) - _, err := bm.BroadcastDefinitionAsNode(bm.ctx, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) + _, err := bm.BroadcastDefinitionAsNode(bm.ctx, fftypes.SystemNamespace, &fftypes.Namespace{}, fftypes.SystemTagDefineNamespace, false) assert.Regexp(t, "pop", err) } @@ -66,7 +87,7 @@ func TestBroadcastDefinitionBadIdentity(t *testing.T) { mim := bm.identity.(*identitymanagermocks.Manager) mim.On("ResolveInputIdentity", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - _, err := bm.BroadcastDefinition(bm.ctx, &fftypes.Namespace{}, &fftypes.Identity{ + _, err := bm.BroadcastDefinition(bm.ctx, fftypes.SystemNamespace, &fftypes.Namespace{}, &fftypes.Identity{ Author: "wrong", Key: "wrong", }, fftypes.SystemTagDefineNamespace, false) diff --git a/internal/broadcast/manager.go b/internal/broadcast/manager.go index 9876e488ec..4430f21c82 100644 --- a/internal/broadcast/manager.go +++ b/internal/broadcast/manager.go @@ -42,8 +42,8 @@ type Manager interface { BroadcastDatatype(ctx context.Context, ns string, datatype *fftypes.Datatype, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastNamespace(ctx context.Context, ns *fftypes.Namespace, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastMessage(ctx context.Context, ns string, in *fftypes.MessageInOut, waitConfirm bool) (out *fftypes.Message, err error) - BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) - BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) + BroadcastDefinitionAsNode(ctx context.Context, ns string, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) + BroadcastDefinition(ctx context.Context, ns string, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastRootOrgDefinition(ctx context.Context, def *fftypes.Organization, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (msg *fftypes.Message, err error) BroadcastTokenPool(ctx context.Context, ns string, pool *fftypes.TokenPoolAnnouncement, waitConfirm bool) (msg *fftypes.Message, err error) Start() error diff --git a/internal/broadcast/namespace.go b/internal/broadcast/namespace.go index a0bcd4ac3d..6f1a8a3e65 100644 --- a/internal/broadcast/namespace.go +++ b/internal/broadcast/namespace.go @@ -31,7 +31,7 @@ func (bm *broadcastManager) BroadcastNamespace(ctx context.Context, ns *fftypes. if err := ns.Validate(ctx, false); err != nil { return nil, err } - msg, err := bm.BroadcastDefinitionAsNode(ctx, ns, fftypes.SystemTagDefineNamespace, waitConfirm) + msg, err := bm.BroadcastDefinitionAsNode(ctx, fftypes.SystemNamespace, ns, fftypes.SystemTagDefineNamespace, waitConfirm) if msg != nil { ns.Message = msg.Header.ID } diff --git a/internal/broadcast/tokenpool.go b/internal/broadcast/tokenpool.go index da77ea813d..16b63bf8df 100644 --- a/internal/broadcast/tokenpool.go +++ b/internal/broadcast/tokenpool.go @@ -30,7 +30,7 @@ func (bm *broadcastManager) BroadcastTokenPool(ctx context.Context, ns string, p return nil, err } - msg, err = bm.BroadcastDefinitionAsNode(ctx, pool, fftypes.SystemTagDefinePool, waitConfirm) + msg, err = bm.BroadcastDefinitionAsNode(ctx, ns, pool, fftypes.SystemTagDefinePool, waitConfirm) if msg != nil { pool.Message = msg.Header.ID } diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index 12da8eb529..6628adcbcc 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -428,7 +428,7 @@ func (ag *aggregator) attemptMessageDispatch(ctx context.Context, msg *fftypes.M valid := true eventType := fftypes.EventTypeMessageConfirmed switch { - case msg.Header.Namespace == fftypes.SystemNamespace: + case msg.Header.Namespace == fftypes.SystemNamespace || msg.Header.Type == fftypes.MessageTypeDefinition: // We handle system events in-line on the aggregator, as it would be confusing for apps to be // dispatched subsequent events before we have processed the system events they depend on. if valid, err = ag.syshandlers.HandleSystemBroadcast(ctx, msg, data); err != nil { diff --git a/internal/networkmap/register_node.go b/internal/networkmap/register_node.go index f8b78b40e2..01dc631d81 100644 --- a/internal/networkmap/register_node.go +++ b/internal/networkmap/register_node.go @@ -63,7 +63,7 @@ func (nm *networkMap) RegisterNode(ctx context.Context, waitConfirm bool) (node return nil, nil, err } - msg, err = nm.broadcast.BroadcastDefinitionAsNode(ctx, node, fftypes.SystemTagDefineNode, waitConfirm) + msg, err = nm.broadcast.BroadcastDefinitionAsNode(ctx, fftypes.SystemNamespace, node, fftypes.SystemTagDefineNode, waitConfirm) if msg != nil { node.Message = msg.Header.ID } diff --git a/internal/networkmap/register_node_test.go b/internal/networkmap/register_node_test.go index a093819b25..9fb9f21893 100644 --- a/internal/networkmap/register_node_test.go +++ b/internal/networkmap/register_node_test.go @@ -53,7 +53,7 @@ func TestRegisterNodeOk(t *testing.T) { mockMsg := &fftypes.Message{Header: fftypes.MessageHeader{ID: fftypes.NewUUID()}} mbm := nm.broadcast.(*broadcastmocks.Manager) - mbm.On("BroadcastDefinitionAsNode", nm.ctx, mock.Anything, fftypes.SystemTagDefineNode, true).Return(mockMsg, nil) + mbm.On("BroadcastDefinitionAsNode", nm.ctx, fftypes.SystemNamespace, mock.Anything, fftypes.SystemTagDefineNode, true).Return(mockMsg, nil) node, msg, err := nm.RegisterNode(nm.ctx, true) assert.NoError(t, err) diff --git a/internal/syshandlers/syshandler.go b/internal/syshandlers/syshandler.go index f69334cbab..b4555937ea 100644 --- a/internal/syshandlers/syshandler.go +++ b/internal/syshandlers/syshandler.go @@ -92,7 +92,7 @@ func (sh *systemHandlers) HandleSystemBroadcast(ctx context.Context, msg *fftype case fftypes.SystemTagDefinePool: return sh.handleTokenPoolBroadcast(ctx, msg, data) default: - l.Warnf("Unknown topic '%s' for system broadcast ID '%s'", msg.Header.Tag, msg.Header.ID) + l.Debugf("Unknown topic '%s' for system broadcast or definition ID '%s'", msg.Header.Tag, msg.Header.ID) } return false, nil } diff --git a/mocks/broadcastmocks/manager.go b/mocks/broadcastmocks/manager.go index 816b4d61c9..f419341a4f 100644 --- a/mocks/broadcastmocks/manager.go +++ b/mocks/broadcastmocks/manager.go @@ -39,13 +39,13 @@ func (_m *Manager) BroadcastDatatype(ctx context.Context, ns string, datatype *f return r0, r1 } -// BroadcastDefinition provides a mock function with given fields: ctx, def, signingIdentity, tag, waitConfirm -func (_m *Manager) BroadcastDefinition(ctx context.Context, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { - ret := _m.Called(ctx, def, signingIdentity, tag, waitConfirm) +// BroadcastDefinition provides a mock function with given fields: ctx, ns, def, signingIdentity, tag, waitConfirm +func (_m *Manager) BroadcastDefinition(ctx context.Context, ns string, def fftypes.Definition, signingIdentity *fftypes.Identity, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, ns, def, signingIdentity, tag, waitConfirm) var r0 *fftypes.Message - if rf, ok := ret.Get(0).(func(context.Context, fftypes.Definition, *fftypes.Identity, fftypes.SystemTag, bool) *fftypes.Message); ok { - r0 = rf(ctx, def, signingIdentity, tag, waitConfirm) + if rf, ok := ret.Get(0).(func(context.Context, string, fftypes.Definition, *fftypes.Identity, fftypes.SystemTag, bool) *fftypes.Message); ok { + r0 = rf(ctx, ns, def, signingIdentity, tag, waitConfirm) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*fftypes.Message) @@ -53,8 +53,8 @@ func (_m *Manager) BroadcastDefinition(ctx context.Context, def fftypes.Definiti } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, fftypes.Definition, *fftypes.Identity, fftypes.SystemTag, bool) error); ok { - r1 = rf(ctx, def, signingIdentity, tag, waitConfirm) + if rf, ok := ret.Get(1).(func(context.Context, string, fftypes.Definition, *fftypes.Identity, fftypes.SystemTag, bool) error); ok { + r1 = rf(ctx, ns, def, signingIdentity, tag, waitConfirm) } else { r1 = ret.Error(1) } @@ -62,13 +62,13 @@ func (_m *Manager) BroadcastDefinition(ctx context.Context, def fftypes.Definiti return r0, r1 } -// BroadcastDefinitionAsNode provides a mock function with given fields: ctx, def, tag, waitConfirm -func (_m *Manager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { - ret := _m.Called(ctx, def, tag, waitConfirm) +// BroadcastDefinitionAsNode provides a mock function with given fields: ctx, ns, def, tag, waitConfirm +func (_m *Manager) BroadcastDefinitionAsNode(ctx context.Context, ns string, def fftypes.Definition, tag fftypes.SystemTag, waitConfirm bool) (*fftypes.Message, error) { + ret := _m.Called(ctx, ns, def, tag, waitConfirm) var r0 *fftypes.Message - if rf, ok := ret.Get(0).(func(context.Context, fftypes.Definition, fftypes.SystemTag, bool) *fftypes.Message); ok { - r0 = rf(ctx, def, tag, waitConfirm) + if rf, ok := ret.Get(0).(func(context.Context, string, fftypes.Definition, fftypes.SystemTag, bool) *fftypes.Message); ok { + r0 = rf(ctx, ns, def, tag, waitConfirm) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*fftypes.Message) @@ -76,8 +76,8 @@ func (_m *Manager) BroadcastDefinitionAsNode(ctx context.Context, def fftypes.De } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, fftypes.Definition, fftypes.SystemTag, bool) error); ok { - r1 = rf(ctx, def, tag, waitConfirm) + if rf, ok := ret.Get(1).(func(context.Context, string, fftypes.Definition, fftypes.SystemTag, bool) error); ok { + r1 = rf(ctx, ns, def, tag, waitConfirm) } else { r1 = ret.Error(1) } diff --git a/test/e2e/tokens_test.go b/test/e2e/tokens_test.go index c345c72c3d..37db2444d6 100644 --- a/test/e2e/tokens_test.go +++ b/test/e2e/tokens_test.go @@ -50,6 +50,7 @@ func (suite *TokensTestSuite) TestE2EFungibleTokensAsync() { } CreateTokenPool(suite.T(), suite.testState.client1, pool, false) + <-received1 <-received1 pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) assert.Equal(suite.T(), 1, len(pools)) @@ -59,6 +60,7 @@ func (suite *TokensTestSuite) TestE2EFungibleTokensAsync() { assert.Equal(suite.T(), fftypes.TokenTypeFungible, pools[0].Type) assert.NotEmpty(suite.T(), pools[0].ProtocolID) + <-received2 <-received2 pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) assert.Equal(suite.T(), 1, len(pools)) @@ -183,6 +185,8 @@ func (suite *TokensTestSuite) TestE2ENonFungibleTokensSync() { assert.Equal(suite.T(), fftypes.TokenTypeNonFungible, poolOut.Type) assert.NotEmpty(suite.T(), poolOut.ProtocolID) + <-received1 + <-received2 <-received1 <-received2 pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) From f7e8afcad9a7faf12e60b42b83d48aa6c597b499 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Tue, 2 Nov 2021 08:39:31 -0400 Subject: [PATCH 2/6] Add comments to new events in E2E tests Signed-off-by: Nicko Guyer --- test/e2e/tokens_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/e2e/tokens_test.go b/test/e2e/tokens_test.go index 37db2444d6..811e650243 100644 --- a/test/e2e/tokens_test.go +++ b/test/e2e/tokens_test.go @@ -50,8 +50,8 @@ func (suite *TokensTestSuite) TestE2EFungibleTokensAsync() { } CreateTokenPool(suite.T(), suite.testState.client1, pool, false) - <-received1 - <-received1 + <-received1 // event for token pool creation + <-received1 // event for token pool announcement pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) assert.Equal(suite.T(), 1, len(pools)) assert.Equal(suite.T(), "default", pools[0].Namespace) @@ -60,8 +60,8 @@ func (suite *TokensTestSuite) TestE2EFungibleTokensAsync() { assert.Equal(suite.T(), fftypes.TokenTypeFungible, pools[0].Type) assert.NotEmpty(suite.T(), pools[0].ProtocolID) - <-received2 - <-received2 + <-received2 // event for token pool creation + <-received2 // event for token pool announcement pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) assert.Equal(suite.T(), 1, len(pools)) assert.Equal(suite.T(), "default", pools[0].Namespace) @@ -185,10 +185,10 @@ func (suite *TokensTestSuite) TestE2ENonFungibleTokensSync() { assert.Equal(suite.T(), fftypes.TokenTypeNonFungible, poolOut.Type) assert.NotEmpty(suite.T(), poolOut.ProtocolID) - <-received1 - <-received2 - <-received1 - <-received2 + <-received1 // event for token pool creation + <-received2 // event for token pool announcement + <-received1 // event for token pool creation + <-received2 // event for token pool announcement pools = GetTokenPools(suite.T(), suite.testState.client1, suite.testState.startTime) assert.Equal(suite.T(), 1, len(pools)) assert.Equal(suite.T(), "default", pools[0].Namespace) From 7c8bd154935ebaf0990e6f0b42daa713da95e923 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Thu, 11 Nov 2021 16:27:53 -0500 Subject: [PATCH 3/6] Rename syshandlers to definitions Signed-off-by: Nicko Guyer --- Makefile | 66 ++++---- .../definition_handler.go} | 26 ++-- .../definition_handler_datatype.go} | 4 +- .../definition_handler_datatype_test.go} | 34 ++--- .../definition_handler_namespace.go} | 4 +- .../definition_handler_namespace_test.go} | 42 ++--- .../definition_handler_network_node.go} | 4 +- .../definition_handler_network_node_test.go} | 46 +++--- .../definition_handler_network_org.go} | 4 +- .../definition_handler_network_org_test.go} | 46 +++--- .../definition_handler_test.go} | 10 +- .../definition_handler_tokenpool.go} | 6 +- .../definition_handler_tokenpool_test.go} | 50 +++--- .../reply_sender.go | 4 +- .../reply_sender_test.go | 2 +- internal/events/aggregator.go | 14 +- internal/events/aggregator_test.go | 30 ++-- internal/events/dx_callbacks.go | 2 +- internal/events/dx_callbacks_test.go | 14 +- internal/events/event_dispatcher.go | 10 +- internal/events/event_dispatcher_test.go | 2 +- internal/events/event_manager.go | 8 +- internal/events/subscription_manager.go | 12 +- internal/orchestrator/orchestrator.go | 8 +- .../definition_handlers.go | 143 ++++++++++++++++++ mocks/syshandlersmocks/system_handlers.go | 4 +- 26 files changed, 370 insertions(+), 225 deletions(-) rename internal/{syshandlers/syshandler.go => definitions/definition_handler.go} (69%) rename internal/{syshandlers/syshandler_datatype.go => definitions/definition_handler_datatype.go} (91%) rename internal/{syshandlers/syshandler_datatype_test.go => definitions/definition_handler_datatype_test.go} (85%) rename internal/{syshandlers/syshandler_namespace.go => definitions/definition_handler_namespace.go} (91%) rename internal/{syshandlers/syshandler_namespace_test.go => definitions/definition_handler_namespace_test.go} (80%) rename internal/{syshandlers/syshandler_network_node.go => definitions/definition_handler_network_node.go} (93%) rename internal/{syshandlers/syshandler_network_node_test.go => definitions/definition_handler_network_node_test.go} (87%) rename internal/{syshandlers/syshandler_network_org.go => definitions/definition_handler_network_org.go} (93%) rename internal/{syshandlers/syshandler_network_org_test.go => definitions/definition_handler_network_org_test.go} (86%) rename internal/{syshandlers/syshandler_test.go => definitions/definition_handler_test.go} (89%) rename internal/{syshandlers/syshandler_tokenpool.go => definitions/definition_handler_tokenpool.go} (93%) rename internal/{syshandlers/syshandler_tokenpool_test.go => definitions/definition_handler_tokenpool_test.go} (90%) rename internal/{syshandlers => definitions}/reply_sender.go (89%) rename internal/{syshandlers => definitions}/reply_sender_test.go (99%) create mode 100644 mocks/definitionhandlermocks/definition_handlers.go diff --git a/Makefile b/Makefile index 1494f3bf43..b6c1cf14bf 100644 --- a/Makefile +++ b/Makefile @@ -30,39 +30,39 @@ mocks-$(strip $(1))-$(strip $(2)): ${MOCKERY} ${MOCKERY} --case underscore --dir $(1) --name $(2) --outpkg $(3) --output mocks/$(strip $(3)) endef -$(eval $(call makemock, pkg/blockchain, Plugin, blockchainmocks)) -$(eval $(call makemock, pkg/blockchain, Callbacks, blockchainmocks)) -$(eval $(call makemock, pkg/database, Plugin, databasemocks)) -$(eval $(call makemock, pkg/database, Callbacks, databasemocks)) -$(eval $(call makemock, pkg/publicstorage, Plugin, publicstoragemocks)) -$(eval $(call makemock, pkg/publicstorage, Callbacks, publicstoragemocks)) -$(eval $(call makemock, pkg/events, Plugin, eventsmocks)) -$(eval $(call makemock, pkg/events, PluginAll, eventsmocks)) -$(eval $(call makemock, pkg/events, Callbacks, eventsmocks)) -$(eval $(call makemock, pkg/identity, Plugin, identitymocks)) -$(eval $(call makemock, pkg/identity, Callbacks, identitymocks)) -$(eval $(call makemock, pkg/dataexchange, Plugin, dataexchangemocks)) -$(eval $(call makemock, pkg/dataexchange, Callbacks, dataexchangemocks)) -$(eval $(call makemock, pkg/tokens, Plugin, tokenmocks)) -$(eval $(call makemock, pkg/tokens, Callbacks, tokenmocks)) -$(eval $(call makemock, pkg/wsclient, WSClient, wsmocks)) -$(eval $(call makemock, internal/identity, Manager, identitymanagermocks)) -$(eval $(call makemock, internal/batchpin, Submitter, batchpinmocks)) -$(eval $(call makemock, internal/sysmessaging, SystemEvents, sysmessagingmocks)) -$(eval $(call makemock, internal/sysmessaging, MessageSender, sysmessagingmocks)) -$(eval $(call makemock, internal/syncasync, Bridge, syncasyncmocks)) -$(eval $(call makemock, internal/data, Manager, datamocks)) -$(eval $(call makemock, internal/batch, Manager, batchmocks)) -$(eval $(call makemock, internal/broadcast, Manager, broadcastmocks)) -$(eval $(call makemock, internal/privatemessaging, Manager, privatemessagingmocks)) -$(eval $(call makemock, internal/syshandlers, SystemHandlers, syshandlersmocks)) -$(eval $(call makemock, internal/events, EventManager, eventmocks)) -$(eval $(call makemock, internal/networkmap, Manager, networkmapmocks)) -$(eval $(call makemock, internal/assets, Manager, assetmocks)) -$(eval $(call makemock, internal/orchestrator, Orchestrator, orchestratormocks)) -$(eval $(call makemock, internal/apiserver, Server, apiservermocks)) -$(eval $(call makemock, internal/apiserver, IServer, apiservermocks)) -$(eval $(call makemock, internal/txcommon, Helper, txcommonmocks)) +$(eval $(call makemock, pkg/blockchain, Plugin, blockchainmocks)) +$(eval $(call makemock, pkg/blockchain, Callbacks, blockchainmocks)) +$(eval $(call makemock, pkg/database, Plugin, databasemocks)) +$(eval $(call makemock, pkg/database, Callbacks, databasemocks)) +$(eval $(call makemock, pkg/publicstorage, Plugin, publicstoragemocks)) +$(eval $(call makemock, pkg/publicstorage, Callbacks, publicstoragemocks)) +$(eval $(call makemock, pkg/events, Plugin, eventsmocks)) +$(eval $(call makemock, pkg/events, PluginAll, eventsmocks)) +$(eval $(call makemock, pkg/events, Callbacks, eventsmocks)) +$(eval $(call makemock, pkg/identity, Plugin, identitymocks)) +$(eval $(call makemock, pkg/identity, Callbacks, identitymocks)) +$(eval $(call makemock, pkg/dataexchange, Plugin, dataexchangemocks)) +$(eval $(call makemock, pkg/dataexchange, Callbacks, dataexchangemocks)) +$(eval $(call makemock, pkg/tokens, Plugin, tokenmocks)) +$(eval $(call makemock, pkg/tokens, Callbacks, tokenmocks)) +$(eval $(call makemock, pkg/wsclient, WSClient, wsmocks)) +$(eval $(call makemock, internal/identity, Manager, identitymanagermocks)) +$(eval $(call makemock, internal/batchpin, Submitter, batchpinmocks)) +$(eval $(call makemock, internal/sysmessaging, SystemEvents, sysmessagingmocks)) +$(eval $(call makemock, internal/sysmessaging, MessageSender, sysmessagingmocks)) +$(eval $(call makemock, internal/syncasync, Bridge, syncasyncmocks)) +$(eval $(call makemock, internal/data, Manager, datamocks)) +$(eval $(call makemock, internal/batch, Manager, batchmocks)) +$(eval $(call makemock, internal/broadcast, Manager, broadcastmocks)) +$(eval $(call makemock, internal/privatemessaging, Manager, privatemessagingmocks)) +$(eval $(call makemock, internal/definitions, DefinitionHandlers, definitionhandlermocks)) +$(eval $(call makemock, internal/events, EventManager, eventmocks)) +$(eval $(call makemock, internal/networkmap, Manager, networkmapmocks)) +$(eval $(call makemock, internal/assets, Manager, assetmocks)) +$(eval $(call makemock, internal/orchestrator, Orchestrator, orchestratormocks)) +$(eval $(call makemock, internal/apiserver, Server, apiservermocks)) +$(eval $(call makemock, internal/apiserver, IServer, apiservermocks)) +$(eval $(call makemock, internal/txcommon, Helper, txcommonmocks)) firefly-nocgo: ${GOFILES} CGO_ENABLED=0 $(VGO) build -o ${BINARY_NAME}-nocgo -ldflags "-X main.buildDate=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` -X main.buildVersion=$(BUILD_VERSION)" -tags=prod -tags=prod -v diff --git a/internal/syshandlers/syshandler.go b/internal/definitions/definition_handler.go similarity index 69% rename from internal/syshandlers/syshandler.go rename to internal/definitions/definition_handler.go index b4555937ea..7d88454852 100644 --- a/internal/syshandlers/syshandler.go +++ b/internal/definitions/definition_handler.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -31,15 +31,15 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -// SystemHandlers interface allows components to call broadcast/private messaging functions internally (without import cycles) -type SystemHandlers interface { +// DefinitionHandlers interface allows components to call broadcast/private messaging functions internally (without import cycles) +type DefinitionHandlers interface { privatemessaging.GroupManager - HandleSystemBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) + HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) } -type systemHandlers struct { +type definitionHandlers struct { database database.Plugin exchange dataexchange.Plugin data data.Manager @@ -49,8 +49,8 @@ type systemHandlers struct { txhelper txcommon.Helper } -func NewSystemHandlers(di database.Plugin, dx dataexchange.Plugin, dm data.Manager, bm broadcast.Manager, pm privatemessaging.Manager, am assets.Manager) SystemHandlers { - return &systemHandlers{ +func NewDefinitionHandlers(di database.Plugin, dx dataexchange.Plugin, dm data.Manager, bm broadcast.Manager, pm privatemessaging.Manager, am assets.Manager) DefinitionHandlers { + return &definitionHandlers{ database: di, exchange: dx, data: dm, @@ -61,23 +61,23 @@ func NewSystemHandlers(di database.Plugin, dx dataexchange.Plugin, dm data.Manag } } -func (sh *systemHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { +func (sh *definitionHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { return sh.messaging.GetGroupByID(ctx, id) } -func (sh *systemHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { +func (sh *definitionHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { return sh.messaging.GetGroups(ctx, filter) } -func (sh *systemHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { +func (sh *definitionHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { return sh.messaging.ResolveInitGroup(ctx, msg) } -func (sh *systemHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (ok bool, err error) { +func (sh *definitionHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (ok bool, err error) { return sh.messaging.EnsureLocalGroup(ctx, group) } -func (sh *systemHandlers) HandleSystemBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) l.Infof("Confirming system broadcast '%s' [%s]", msg.Header.Tag, msg.Header.ID) switch fftypes.SystemTag(msg.Header.Tag) { @@ -97,7 +97,7 @@ func (sh *systemHandlers) HandleSystemBroadcast(ctx context.Context, msg *fftype return false, nil } -func (sh *systemHandlers) getSystemBroadcastPayload(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data, res fftypes.Definition) (valid bool) { +func (sh *definitionHandlers) getSystemBroadcastPayload(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data, res fftypes.Definition) (valid bool) { l := log.L(ctx) if len(data) != 1 { l.Warnf("Unable to process system broadcast %s - expecting 1 attachement, found %d", msg.Header.ID, len(data)) diff --git a/internal/syshandlers/syshandler_datatype.go b/internal/definitions/definition_handler_datatype.go similarity index 91% rename from internal/syshandlers/syshandler_datatype.go rename to internal/definitions/definition_handler_datatype.go index 89ca1c73d6..1e004d098a 100644 --- a/internal/syshandlers/syshandler_datatype.go +++ b/internal/definitions/definition_handler_datatype.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) handleDatatypeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) handleDatatypeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var dt fftypes.Datatype diff --git a/internal/syshandlers/syshandler_datatype_test.go b/internal/definitions/definition_handler_datatype_test.go similarity index 85% rename from internal/syshandlers/syshandler_datatype_test.go rename to internal/definitions/definition_handler_datatype_test.go index a33ddcb6f4..73251f9b50 100644 --- a/internal/syshandlers/syshandler_datatype_test.go +++ b/internal/definitions/definition_handler_datatype_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -29,7 +29,7 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastDatatypeOk(t *testing.T) { +func TestHandleDefinitionBroadcastDatatypeOk(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -53,7 +53,7 @@ func TestHandleSystemBroadcastDatatypeOk(t *testing.T) { mbi.On("GetDatatypeByName", mock.Anything, "ns1", "name1", "ver1").Return(nil, nil) mbi.On("UpsertDatatype", mock.Anything, mock.Anything, false).Return(nil) mbi.On("InsertEvent", mock.Anything, mock.Anything).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -65,7 +65,7 @@ func TestHandleSystemBroadcastDatatypeOk(t *testing.T) { mbi.AssertExpectations(t) } -func TestHandleSystemBroadcastDatatypeEventFail(t *testing.T) { +func TestHandleDefinitionBroadcastDatatypeEventFail(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -89,7 +89,7 @@ func TestHandleSystemBroadcastDatatypeEventFail(t *testing.T) { mbi.On("GetDatatypeByName", mock.Anything, "ns1", "name1", "ver1").Return(nil, nil) mbi.On("UpsertDatatype", mock.Anything, mock.Anything, false).Return(nil) mbi.On("InsertEvent", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -101,7 +101,7 @@ func TestHandleSystemBroadcastDatatypeEventFail(t *testing.T) { mbi.AssertExpectations(t) } -func TestHandleSystemBroadcastDatatypeMissingID(t *testing.T) { +func TestHandleDefinitionBroadcastDatatypeMissingID(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -118,7 +118,7 @@ func TestHandleSystemBroadcastDatatypeMissingID(t *testing.T) { Value: fftypes.Byteable(b), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -127,7 +127,7 @@ func TestHandleSystemBroadcastDatatypeMissingID(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastBadSchema(t *testing.T) { +func TestHandleDefinitionBroadcastBadSchema(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -147,7 +147,7 @@ func TestHandleSystemBroadcastBadSchema(t *testing.T) { mdm := sh.data.(*datamocks.Manager) mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -158,7 +158,7 @@ func TestHandleSystemBroadcastBadSchema(t *testing.T) { mdm.AssertExpectations(t) } -func TestHandleSystemBroadcastMissingData(t *testing.T) { +func TestHandleDefinitionBroadcastMissingData(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -171,7 +171,7 @@ func TestHandleSystemBroadcastMissingData(t *testing.T) { } dt.Hash = dt.Value.Hash() - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -180,7 +180,7 @@ func TestHandleSystemBroadcastMissingData(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastDatatypeLookupFail(t *testing.T) { +func TestHandleDefinitionBroadcastDatatypeLookupFail(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -202,7 +202,7 @@ func TestHandleSystemBroadcastDatatypeLookupFail(t *testing.T) { mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) mbi := sh.database.(*databasemocks.Plugin) mbi.On("GetDatatypeByName", mock.Anything, "ns1", "name1", "ver1").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: fftypes.SystemNamespace, Tag: string(fftypes.SystemTagDefineDatatype), @@ -215,7 +215,7 @@ func TestHandleSystemBroadcastDatatypeLookupFail(t *testing.T) { mbi.AssertExpectations(t) } -func TestHandleSystemBroadcastUpsertFail(t *testing.T) { +func TestHandleDefinitionBroadcastUpsertFail(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -238,7 +238,7 @@ func TestHandleSystemBroadcastUpsertFail(t *testing.T) { mbi := sh.database.(*databasemocks.Plugin) mbi.On("GetDatatypeByName", mock.Anything, "ns1", "name1", "ver1").Return(nil, nil) mbi.On("UpsertDatatype", mock.Anything, mock.Anything, false).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, @@ -250,7 +250,7 @@ func TestHandleSystemBroadcastUpsertFail(t *testing.T) { mbi.AssertExpectations(t) } -func TestHandleSystemBroadcastDatatypeDuplicate(t *testing.T) { +func TestHandleDefinitionBroadcastDatatypeDuplicate(t *testing.T) { sh := newTestSystemHandlers(t) dt := &fftypes.Datatype{ @@ -272,7 +272,7 @@ func TestHandleSystemBroadcastDatatypeDuplicate(t *testing.T) { mdm.On("CheckDatatype", mock.Anything, "ns1", mock.Anything).Return(nil) mbi := sh.database.(*databasemocks.Plugin) mbi.On("GetDatatypeByName", mock.Anything, "ns1", "name1", "ver1").Return(dt, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineDatatype), }, diff --git a/internal/syshandlers/syshandler_namespace.go b/internal/definitions/definition_handler_namespace.go similarity index 91% rename from internal/syshandlers/syshandler_namespace.go rename to internal/definitions/definition_handler_namespace.go index 186ea15d53..bcda2bec83 100644 --- a/internal/syshandlers/syshandler_namespace.go +++ b/internal/definitions/definition_handler_namespace.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) handleNamespaceBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) handleNamespaceBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var ns fftypes.Namespace diff --git a/internal/syshandlers/syshandler_namespace_test.go b/internal/definitions/definition_handler_namespace_test.go similarity index 80% rename from internal/syshandlers/syshandler_namespace_test.go rename to internal/definitions/definition_handler_namespace_test.go index dc47a8e0cc..5eb8489447 100644 --- a/internal/syshandlers/syshandler_namespace_test.go +++ b/internal/definitions/definition_handler_namespace_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -28,7 +28,7 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastNSOk(t *testing.T) { +func TestHandleDefinitionBroadcastNSOk(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -45,7 +45,7 @@ func TestHandleSystemBroadcastNSOk(t *testing.T) { mdi.On("GetNamespace", mock.Anything, "ns1").Return(nil, nil) mdi.On("UpsertNamespace", mock.Anything, mock.Anything, false).Return(nil) mdi.On("InsertEvent", mock.Anything, mock.Anything).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -56,7 +56,7 @@ func TestHandleSystemBroadcastNSOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNSEventFail(t *testing.T) { +func TestHandleDefinitionBroadcastNSEventFail(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -73,7 +73,7 @@ func TestHandleSystemBroadcastNSEventFail(t *testing.T) { mdi.On("GetNamespace", mock.Anything, "ns1").Return(nil, nil) mdi.On("UpsertNamespace", mock.Anything, mock.Anything, false).Return(nil) mdi.On("InsertEvent", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -84,7 +84,7 @@ func TestHandleSystemBroadcastNSEventFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNSUpsertFail(t *testing.T) { +func TestHandleDefinitionBroadcastNSUpsertFail(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -100,7 +100,7 @@ func TestHandleSystemBroadcastNSUpsertFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetNamespace", mock.Anything, "ns1").Return(nil, nil) mdi.On("UpsertNamespace", mock.Anything, mock.Anything, false).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -111,10 +111,10 @@ func TestHandleSystemBroadcastNSUpsertFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNSMissingData(t *testing.T) { +func TestHandleDefinitionBroadcastNSMissingData(t *testing.T) { sh := newTestSystemHandlers(t) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -123,7 +123,7 @@ func TestHandleSystemBroadcastNSMissingData(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastNSBadID(t *testing.T) { +func TestHandleDefinitionBroadcastNSBadID(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{} @@ -133,7 +133,7 @@ func TestHandleSystemBroadcastNSBadID(t *testing.T) { Value: fftypes.Byteable(b), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -142,14 +142,14 @@ func TestHandleSystemBroadcastNSBadID(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastNSBadData(t *testing.T) { +func TestHandleDefinitionBroadcastNSBadData(t *testing.T) { sh := newTestSystemHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!{json`), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -158,7 +158,7 @@ func TestHandleSystemBroadcastNSBadData(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastDuplicate(t *testing.T) { +func TestHandleDefinitionBroadcastDuplicate(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -173,7 +173,7 @@ func TestHandleSystemBroadcastDuplicate(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetNamespace", mock.Anything, "ns1").Return(ns, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -184,7 +184,7 @@ func TestHandleSystemBroadcastDuplicate(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastDuplicateOverrideLocal(t *testing.T) { +func TestHandleDefinitionBroadcastDuplicateOverrideLocal(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -203,7 +203,7 @@ func TestHandleSystemBroadcastDuplicateOverrideLocal(t *testing.T) { mdi.On("DeleteNamespace", mock.Anything, mock.Anything).Return(nil) mdi.On("UpsertNamespace", mock.Anything, mock.Anything, false).Return(nil) mdi.On("InsertEvent", mock.Anything, mock.Anything).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -214,7 +214,7 @@ func TestHandleSystemBroadcastDuplicateOverrideLocal(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastDuplicateOverrideLocalFail(t *testing.T) { +func TestHandleDefinitionBroadcastDuplicateOverrideLocalFail(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -231,7 +231,7 @@ func TestHandleSystemBroadcastDuplicateOverrideLocalFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetNamespace", mock.Anything, "ns1").Return(ns, nil) mdi.On("DeleteNamespace", mock.Anything, mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, @@ -242,7 +242,7 @@ func TestHandleSystemBroadcastDuplicateOverrideLocalFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastDupCheckFail(t *testing.T) { +func TestHandleDefinitionBroadcastDupCheckFail(t *testing.T) { sh := newTestSystemHandlers(t) ns := &fftypes.Namespace{ @@ -257,7 +257,7 @@ func TestHandleSystemBroadcastDupCheckFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetNamespace", mock.Anything, "ns1").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: string(fftypes.SystemTagDefineNamespace), }, diff --git a/internal/syshandlers/syshandler_network_node.go b/internal/definitions/definition_handler_network_node.go similarity index 93% rename from internal/syshandlers/syshandler_network_node.go rename to internal/definitions/definition_handler_network_node.go index 83ec1a102d..748ad84e56 100644 --- a/internal/syshandlers/syshandler_network_node.go +++ b/internal/definitions/definition_handler_network_node.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var node fftypes.Node diff --git a/internal/syshandlers/syshandler_network_node_test.go b/internal/definitions/definition_handler_network_node_test.go similarity index 87% rename from internal/syshandlers/syshandler_network_node_test.go rename to internal/definitions/definition_handler_network_node_test.go index 3c420070c1..9fc46bbf61 100644 --- a/internal/syshandlers/syshandler_network_node_test.go +++ b/internal/definitions/definition_handler_network_node_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -29,7 +29,7 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastNodeOk(t *testing.T) { +func TestHandleDefinitionBroadcastNodeOk(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -55,7 +55,7 @@ func TestHandleSystemBroadcastNodeOk(t *testing.T) { mdi.On("UpsertNode", mock.Anything, mock.Anything, true).Return(nil) mdx := sh.exchange.(*dataexchangemocks.Plugin) mdx.On("AddPeer", mock.Anything, "peer1", node.DX.Endpoint).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -71,7 +71,7 @@ func TestHandleSystemBroadcastNodeOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeUpsertFail(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -95,7 +95,7 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, nil) mdi.On("GetNodeByID", mock.Anything, node.ID).Return(nil, nil) mdi.On("UpsertNode", mock.Anything, mock.Anything, true).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -111,7 +111,7 @@ func TestHandleSystemBroadcastNodeUpsertFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeAddPeerFail(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -137,7 +137,7 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { mdi.On("UpsertNode", mock.Anything, mock.Anything, true).Return(nil) mdx := sh.exchange.(*dataexchangemocks.Plugin) mdx.On("AddPeer", mock.Anything, "peer1", mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -153,7 +153,7 @@ func TestHandleSystemBroadcastNodeAddPeerFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { +func TestHandleDefinitionBroadcastNodeDupMismatch(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -175,7 +175,7 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(&fftypes.Node{Owner: "0x99999"}, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -191,7 +191,7 @@ func TestHandleSystemBroadcastNodeDupMismatch(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { +func TestHandleDefinitionBroadcastNodeDupOK(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -216,7 +216,7 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { mdi.On("UpsertNode", mock.Anything, mock.Anything, true).Return(nil) mdx := sh.exchange.(*dataexchangemocks.Plugin) mdx.On("AddPeer", mock.Anything, "peer1", mock.Anything).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -232,7 +232,7 @@ func TestHandleSystemBroadcastNodeDupOK(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeGetFail(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -254,7 +254,7 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) mdi.On("GetNode", mock.Anything, "0x23456", "node1").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -270,7 +270,7 @@ func TestHandleSystemBroadcastNodeGetFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { +func TestHandleDefinitionBroadcastNodeBadAuthor(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -291,7 +291,7 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x23456"}, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -307,7 +307,7 @@ func TestHandleSystemBroadcastNodeBadAuthor(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeGetOrgNotFound(t *testing.T) { +func TestHandleDefinitionBroadcastNodeGetOrgNotFound(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -328,7 +328,7 @@ func TestHandleSystemBroadcastNodeGetOrgNotFound(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -344,7 +344,7 @@ func TestHandleSystemBroadcastNodeGetOrgNotFound(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeGetOrgFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeGetOrgFail(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -365,7 +365,7 @@ func TestHandleSystemBroadcastNodeGetOrgFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -381,7 +381,7 @@ func TestHandleSystemBroadcastNodeGetOrgFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastNodeValidateFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeValidateFail(t *testing.T) { sh := newTestSystemHandlers(t) node := &fftypes.Node{ @@ -400,7 +400,7 @@ func TestHandleSystemBroadcastNodeValidateFail(t *testing.T) { Value: fftypes.Byteable(b), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -414,14 +414,14 @@ func TestHandleSystemBroadcastNodeValidateFail(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastNodeUnmarshalFail(t *testing.T) { +func TestHandleDefinitionBroadcastNodeUnmarshalFail(t *testing.T) { sh := newTestSystemHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!json`), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ diff --git a/internal/syshandlers/syshandler_network_org.go b/internal/definitions/definition_handler_network_org.go similarity index 93% rename from internal/syshandlers/syshandler_network_org.go rename to internal/definitions/definition_handler_network_org.go index df819c103f..6beeba9362 100644 --- a/internal/syshandlers/syshandler_network_org.go +++ b/internal/definitions/definition_handler_network_org.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) handleOrganizationBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var org fftypes.Organization diff --git a/internal/syshandlers/syshandler_network_org_test.go b/internal/definitions/definition_handler_network_org_test.go similarity index 86% rename from internal/syshandlers/syshandler_network_org_test.go rename to internal/definitions/definition_handler_network_org_test.go index 0c7818c80c..09a66daeb0 100644 --- a/internal/syshandlers/syshandler_network_org_test.go +++ b/internal/definitions/definition_handler_network_org_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -28,7 +28,7 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastChildOrgOk(t *testing.T) { +func TestHandleDefinitionBroadcastChildOrgOk(t *testing.T) { sh := newTestSystemHandlers(t) parentOrg := &fftypes.Organization{ @@ -58,7 +58,7 @@ func TestHandleSystemBroadcastChildOrgOk(t *testing.T) { mdi.On("GetOrganizationByName", mock.Anything, "org1").Return(nil, nil) mdi.On("GetOrganizationByID", mock.Anything, org.ID).Return(nil, nil) mdi.On("UpsertOrganization", mock.Anything, mock.Anything, true).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -74,7 +74,7 @@ func TestHandleSystemBroadcastChildOrgOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastChildOrgDupOk(t *testing.T) { +func TestHandleDefinitionBroadcastChildOrgDupOk(t *testing.T) { sh := newTestSystemHandlers(t) parentOrg := &fftypes.Organization{ @@ -102,7 +102,7 @@ func TestHandleSystemBroadcastChildOrgDupOk(t *testing.T) { mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(parentOrg, nil) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(org, nil) mdi.On("UpsertOrganization", mock.Anything, mock.Anything, true).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -118,7 +118,7 @@ func TestHandleSystemBroadcastChildOrgDupOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastChildOrgBadKey(t *testing.T) { +func TestHandleDefinitionBroadcastChildOrgBadKey(t *testing.T) { sh := newTestSystemHandlers(t) parentOrg := &fftypes.Organization{ @@ -144,7 +144,7 @@ func TestHandleSystemBroadcastChildOrgBadKey(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(parentOrg, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -160,7 +160,7 @@ func TestHandleSystemBroadcastChildOrgBadKey(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { +func TestHandleDefinitionBroadcastOrgDupMismatch(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -179,7 +179,7 @@ func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -195,7 +195,7 @@ func TestHandleSystemBroadcastOrgDupMismatch(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgUpsertFail(t *testing.T) { +func TestHandleDefinitionBroadcastOrgUpsertFail(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -216,7 +216,7 @@ func TestHandleSystemBroadcastOrgUpsertFail(t *testing.T) { mdi.On("GetOrganizationByName", mock.Anything, "org1").Return(nil, nil) mdi.On("GetOrganizationByID", mock.Anything, org.ID).Return(nil, nil) mdi.On("UpsertOrganization", mock.Anything, mock.Anything, true).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -231,7 +231,7 @@ func TestHandleSystemBroadcastOrgUpsertFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgGetOrgFail(t *testing.T) { +func TestHandleDefinitionBroadcastOrgGetOrgFail(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -249,7 +249,7 @@ func TestHandleSystemBroadcastOrgGetOrgFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -264,7 +264,7 @@ func TestHandleSystemBroadcastOrgGetOrgFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastOrgAuthorMismatch(t *testing.T) { +func TestHandleDefinitionBroadcastOrgAuthorMismatch(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -282,7 +282,7 @@ func TestHandleSystemBroadcastOrgAuthorMismatch(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x12345").Return(&fftypes.Organization{ID: fftypes.NewUUID(), Identity: "0x12345", Parent: "0x9999"}, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -298,7 +298,7 @@ func TestHandleSystemBroadcastOrgAuthorMismatch(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastGetParentFail(t *testing.T) { +func TestHandleDefinitionBroadcastGetParentFail(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -317,7 +317,7 @@ func TestHandleSystemBroadcastGetParentFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -333,7 +333,7 @@ func TestHandleSystemBroadcastGetParentFail(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { +func TestHandleDefinitionBroadcastGetParentNotFound(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -352,7 +352,7 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOrganizationByIdentity", mock.Anything, "0x23456").Return(nil, nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -368,7 +368,7 @@ func TestHandleSystemBroadcastGetParentNotFound(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastValidateFail(t *testing.T) { +func TestHandleDefinitionBroadcastValidateFail(t *testing.T) { sh := newTestSystemHandlers(t) org := &fftypes.Organization{ @@ -383,7 +383,7 @@ func TestHandleSystemBroadcastValidateFail(t *testing.T) { Value: fftypes.Byteable(b), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ @@ -397,14 +397,14 @@ func TestHandleSystemBroadcastValidateFail(t *testing.T) { assert.NoError(t, err) } -func TestHandleSystemBroadcastUnmarshalFail(t *testing.T) { +func TestHandleDefinitionBroadcastUnmarshalFail(t *testing.T) { sh := newTestSystemHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!json`), } - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Namespace: "ns1", Identity: fftypes.Identity{ diff --git a/internal/syshandlers/syshandler_test.go b/internal/definitions/definition_handler_test.go similarity index 89% rename from internal/syshandlers/syshandler_test.go rename to internal/definitions/definition_handler_test.go index 5bf7157fef..74223d7d80 100644 --- a/internal/syshandlers/syshandler_test.go +++ b/internal/definitions/definition_handler_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -31,19 +31,19 @@ import ( "github.com/stretchr/testify/mock" ) -func newTestSystemHandlers(t *testing.T) *systemHandlers { +func newTestSystemHandlers(t *testing.T) *definitionHandlers { mdi := &databasemocks.Plugin{} mdx := &dataexchangemocks.Plugin{} mdm := &datamocks.Manager{} mbm := &broadcastmocks.Manager{} mpm := &privatemessagingmocks.Manager{} mam := &assetmocks.Manager{} - return NewSystemHandlers(mdi, mdx, mdm, mbm, mpm, mam).(*systemHandlers) + return NewDefinitionHandlers(mdi, mdx, mdm, mbm, mpm, mam).(*definitionHandlers) } -func TestHandleSystemBroadcastUnknown(t *testing.T) { +func TestHandleDefinitionBroadcastUnknown(t *testing.T) { sh := newTestSystemHandlers(t) - valid, err := sh.HandleSystemBroadcast(context.Background(), &fftypes.Message{ + valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: "uknown", }, diff --git a/internal/syshandlers/syshandler_tokenpool.go b/internal/definitions/definition_handler_tokenpool.go similarity index 93% rename from internal/syshandlers/syshandler_tokenpool.go rename to internal/definitions/definition_handler_tokenpool.go index 8942e8562c..f43273ba08 100644 --- a/internal/syshandlers/syshandler_tokenpool.go +++ b/internal/definitions/definition_handler_tokenpool.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -24,7 +24,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) persistTokenPool(ctx context.Context, pool *fftypes.TokenPoolAnnouncement) (valid bool, err error) { +func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftypes.TokenPoolAnnouncement) (valid bool, err error) { // Find a matching operation within this transaction fb := database.OperationQueryFactory.NewFilter(ctx) filter := fb.And( @@ -98,7 +98,7 @@ func (sh *systemHandlers) persistTokenPool(ctx context.Context, pool *fftypes.To return true, nil } -func (sh *systemHandlers) handleTokenPoolBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (sh *definitionHandlers) handleTokenPoolBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var pool fftypes.TokenPoolAnnouncement diff --git a/internal/syshandlers/syshandler_tokenpool_test.go b/internal/definitions/definition_handler_tokenpool_test.go similarity index 90% rename from internal/syshandlers/syshandler_tokenpool_test.go rename to internal/definitions/definition_handler_tokenpool_test.go index b316996d4d..b09814f6c8 100644 --- a/internal/syshandlers/syshandler_tokenpool_test.go +++ b/internal/definitions/definition_handler_tokenpool_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -30,7 +30,7 @@ import ( "github.com/stretchr/testify/mock" ) -func TestHandleSystemBroadcastTokenPoolSelfOk(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolSelfOk(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -75,7 +75,7 @@ func TestHandleSystemBroadcastTokenPoolSelfOk(t *testing.T) { return *event.Reference == *pool.ID && event.Namespace == pool.Namespace && event.Type == fftypes.EventTypePoolConfirmed })).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.True(t, valid) assert.NoError(t, err) assert.Equal(t, fftypes.OpStatusSucceeded, tx.Status) @@ -83,7 +83,7 @@ func TestHandleSystemBroadcastTokenPoolSelfOk(t *testing.T) { mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolSelfUpdateOpFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolSelfUpdateOpFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -119,14 +119,14 @@ func TestHandleSystemBroadcastTokenPoolSelfUpdateOpFail(t *testing.T) { mdi.On("GetOperations", context.Background(), mock.Anything).Return(operations, nil, nil) mdi.On("UpdateOperation", context.Background(), opID, mock.Anything).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolSelfGetTXFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolSelfGetTXFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -163,14 +163,14 @@ func TestHandleSystemBroadcastTokenPoolSelfGetTXFail(t *testing.T) { mdi.On("UpdateOperation", context.Background(), opID, mock.Anything).Return(nil) mdi.On("GetTransactionByID", context.Background(), pool.TX.ID).Return(nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolSelfTXMismatch(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolSelfTXMismatch(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -211,14 +211,14 @@ func TestHandleSystemBroadcastTokenPoolSelfTXMismatch(t *testing.T) { return *event.Reference == *pool.ID && event.Namespace == pool.Namespace && event.Type == fftypes.EventTypePoolRejected })).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.NoError(t, err) mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolSelfUpdateTXFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolSelfUpdateTXFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -257,14 +257,14 @@ func TestHandleSystemBroadcastTokenPoolSelfUpdateTXFail(t *testing.T) { mdi.On("GetTransactionByID", context.Background(), pool.TX.ID).Return(tx, nil) mdi.On("UpsertTransaction", context.Background(), tx, false).Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolOk(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolOk(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -313,7 +313,7 @@ func TestHandleSystemBroadcastTokenPoolOk(t *testing.T) { return *p.ID == *pool.ID }), "tx123").Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.True(t, valid) assert.NoError(t, err) @@ -321,7 +321,7 @@ func TestHandleSystemBroadcastTokenPoolOk(t *testing.T) { mam.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolValidateTxFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolValidateTxFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -360,7 +360,7 @@ func TestHandleSystemBroadcastTokenPoolValidateTxFail(t *testing.T) { return *p.ID == *pool.ID }), "tx123").Return(fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") @@ -368,7 +368,7 @@ func TestHandleSystemBroadcastTokenPoolValidateTxFail(t *testing.T) { mam.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolBadTX(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolBadTX(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -410,7 +410,7 @@ func TestHandleSystemBroadcastTokenPoolBadTX(t *testing.T) { return *p.ID == *pool.ID }), "tx123").Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.NoError(t, err) @@ -418,7 +418,7 @@ func TestHandleSystemBroadcastTokenPoolBadTX(t *testing.T) { mam.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolIDMismatch(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolIDMismatch(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -467,7 +467,7 @@ func TestHandleSystemBroadcastTokenPoolIDMismatch(t *testing.T) { return *p.ID == *pool.ID }), "tx123").Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.NoError(t, err) @@ -475,7 +475,7 @@ func TestHandleSystemBroadcastTokenPoolIDMismatch(t *testing.T) { mam.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolFailUpsert(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolFailUpsert(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -521,7 +521,7 @@ func TestHandleSystemBroadcastTokenPoolFailUpsert(t *testing.T) { return *p.ID == *pool.ID }), "tx123").Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") @@ -529,7 +529,7 @@ func TestHandleSystemBroadcastTokenPoolFailUpsert(t *testing.T) { mam.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolOpsFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolOpsFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -562,14 +562,14 @@ func TestHandleSystemBroadcastTokenPoolOpsFail(t *testing.T) { mdi := sh.database.(*databasemocks.Plugin) mdi.On("GetOperations", context.Background(), mock.Anything).Return(nil, nil, fmt.Errorf("pop")) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.EqualError(t, err, "pop") mdi.AssertExpectations(t) } -func TestHandleSystemBroadcastTokenPoolValidateFail(t *testing.T) { +func TestHandleDefinitionBroadcastTokenPoolValidateFail(t *testing.T) { sh := newTestSystemHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ @@ -593,7 +593,7 @@ func TestHandleSystemBroadcastTokenPoolValidateFail(t *testing.T) { return event.Type == fftypes.EventTypePoolRejected })).Return(nil) - valid, err := sh.HandleSystemBroadcast(context.Background(), msg, data) + valid, err := sh.HandleDefinitionBroadcast(context.Background(), msg, data) assert.False(t, valid) assert.NoError(t, err) diff --git a/internal/syshandlers/reply_sender.go b/internal/definitions/reply_sender.go similarity index 89% rename from internal/syshandlers/reply_sender.go rename to internal/definitions/reply_sender.go index 040796c662..59b51f7bfe 100644 --- a/internal/syshandlers/reply_sender.go +++ b/internal/definitions/reply_sender.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *systemHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { +func (sh *definitionHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { var err error if reply.Header.Group != nil { err = sh.messaging.NewMessage(event.Namespace, reply).Send(ctx) diff --git a/internal/syshandlers/reply_sender_test.go b/internal/definitions/reply_sender_test.go similarity index 99% rename from internal/syshandlers/reply_sender_test.go rename to internal/definitions/reply_sender_test.go index 775a829d1a..b9bec11958 100644 --- a/internal/syshandlers/reply_sender_test.go +++ b/internal/definitions/reply_sender_test.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package syshandlers +package definitions import ( "context" diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index 6628adcbcc..374573f177 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -24,9 +24,9 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/definitions" "github.com/hyperledger/firefly/internal/log" "github.com/hyperledger/firefly/internal/retry" - "github.com/hyperledger/firefly/internal/syshandlers" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/fftypes" ) @@ -38,7 +38,7 @@ const ( type aggregator struct { ctx context.Context database database.Plugin - syshandlers syshandlers.SystemHandlers + definitions definitions.DefinitionHandlers data data.Manager eventPoller *eventPoller newPins chan int64 @@ -47,12 +47,12 @@ type aggregator struct { retry *retry.Retry } -func newAggregator(ctx context.Context, di database.Plugin, sh syshandlers.SystemHandlers, dm data.Manager, en *eventNotifier) *aggregator { +func newAggregator(ctx context.Context, di database.Plugin, sh definitions.DefinitionHandlers, dm data.Manager, en *eventNotifier) *aggregator { batchSize := config.GetInt(config.EventAggregatorBatchSize) ag := &aggregator{ ctx: log.WithLogField(ctx, "role", "aggregator"), database: di, - syshandlers: sh, + definitions: sh, data: dm, newPins: make(chan int64), offchainBatches: make(chan *fftypes.UUID, 1), // hops to queuedRewinds with a shouldertab on the event poller @@ -340,7 +340,7 @@ func (ag *aggregator) attemptContextInit(ctx context.Context, msg *fftypes.Messa l := log.L(ctx) // It might be the system topic/context initializing the group - group, err := ag.syshandlers.ResolveInitGroup(ctx, msg) + group, err := ag.definitions.ResolveInitGroup(ctx, msg) if err != nil || group == nil { return nil, err } @@ -428,10 +428,10 @@ func (ag *aggregator) attemptMessageDispatch(ctx context.Context, msg *fftypes.M valid := true eventType := fftypes.EventTypeMessageConfirmed switch { - case msg.Header.Namespace == fftypes.SystemNamespace || msg.Header.Type == fftypes.MessageTypeDefinition: + case msg.Header.Type == fftypes.MessageTypeDefinition: // We handle system events in-line on the aggregator, as it would be confusing for apps to be // dispatched subsequent events before we have processed the system events they depend on. - if valid, err = ag.syshandlers.HandleSystemBroadcast(ctx, msg, data); err != nil { + if valid, err = ag.definitions.HandleDefinitionBroadcast(ctx, msg, data); err != nil { // Should only return errors that are retryable return false, err } diff --git a/internal/events/aggregator_test.go b/internal/events/aggregator_test.go index dec44a69f9..71d368450c 100644 --- a/internal/events/aggregator_test.go +++ b/internal/events/aggregator_test.go @@ -28,6 +28,7 @@ import ( "github.com/hyperledger/firefly/mocks/syshandlersmocks" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/fftypes" + "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -64,7 +65,7 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { mdi := ag.database.(*databasemocks.Plugin) mdm := ag.data.(*datamocks.Manager) - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) // Get the batch mdi.On("GetBatchByID", ag.ctx, batchID).Return(&fftypes.Batch{ @@ -630,7 +631,7 @@ func TestAttemptContextInitGetGroupByIDFail(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(nil, fmt.Errorf("pop")) _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ @@ -651,7 +652,7 @@ func TestAttemptContextInitGroupNotFound(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(nil, nil) _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ @@ -674,7 +675,7 @@ func TestAttemptContextInitAuthorMismatch(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author2", 0) - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -702,7 +703,7 @@ func TestAttemptContextInitNoMatch(t *testing.T) { defer cancel() groupID := fftypes.NewRandB32() - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -731,7 +732,7 @@ func TestAttemptContextInitGetPinsFail(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) mdi := ag.database.(*databasemocks.Plugin) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ @@ -763,7 +764,7 @@ func TestAttemptContextInitGetPinsBlocked(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) mdi := ag.database.(*databasemocks.Plugin) - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -797,7 +798,7 @@ func TestAttemptContextInitInsertPinsFail(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) mdi := ag.database.(*databasemocks.Plugin) - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*syshandlersmocks.SystemHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -936,12 +937,11 @@ func TestAttemptMessageDispatchFailValidateBadSystem(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) - msh.On("HandleSystemBroadcast", mock.Anything, mock.Anything, mock.Anything).Return(false, nil) - mdm := ag.data.(*datamocks.Manager) mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) + mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) + mdi := ag.database.(*databasemocks.Plugin) mdi.On("UpdateMessage", ag.ctx, mock.Anything, mock.MatchedBy(func(u database.Update) bool { update, err := u.Finalize() @@ -979,11 +979,13 @@ func TestAttemptMessageDispatchFailValidateSystemFail(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.syshandlers.(*syshandlersmocks.SystemHandlers) - msh.On("HandleSystemBroadcast", mock.Anything, mock.Anything, mock.Anything).Return(false, fmt.Errorf("pop")) - mdm := ag.data.(*datamocks.Manager) mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) + mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) + + dbm := ag.database.(*databasemocks.Plugin) + dbm.On("UpdateMessage", ag.ctx, mock.Anything, mock.Anything).Return(nil) + dbm.On("InsertEvent", ag.ctx, mock.Anything).Return(errors.Errorf("pop")) _, err := ag.attemptMessageDispatch(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ diff --git a/internal/events/dx_callbacks.go b/internal/events/dx_callbacks.go index b6e5dcef63..3e45556d54 100644 --- a/internal/events/dx_callbacks.go +++ b/internal/events/dx_callbacks.go @@ -275,7 +275,7 @@ func (em *eventManager) unpinnedMessageReceived(peerID string, message *fftypes. return em.retry.Do(em.ctx, "unpinned message received", func(attempt int) (bool, error) { err := em.database.RunAsGroup(em.ctx, func(ctx context.Context) error { - if valid, err := em.syshandlers.EnsureLocalGroup(ctx, group); err != nil || !valid { + if valid, err := em.definitions.EnsureLocalGroup(ctx, group); err != nil || !valid { return err } diff --git a/internal/events/dx_callbacks_test.go b/internal/events/dx_callbacks_test.go index 6dea5bad66..cf86628a1d 100644 --- a/internal/events/dx_callbacks_test.go +++ b/internal/events/dx_callbacks_test.go @@ -598,7 +598,7 @@ func TestMessageReceiveMessageIdentityFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")) @@ -635,7 +635,7 @@ func TestMessageReceiveMessageIdentityIncorrect(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil) @@ -672,7 +672,7 @@ func TestMessageReceiveMessagePersistMessageFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -722,7 +722,7 @@ func TestMessageReceiveMessagePersistDataFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -772,7 +772,7 @@ func TestMessageReceiveMessagePersistEventFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -824,7 +824,7 @@ func TestMessageReceiveMessageEnsureLocalGroupFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(false, fmt.Errorf("pop")) err = em.MessageReceived(mdx, "peer1", b) @@ -866,7 +866,7 @@ func TestMessageReceiveMessageEnsureLocalGroupReject(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*syshandlersmocks.SystemHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(false, nil) err = em.MessageReceived(mdx, "peer1", b) diff --git a/internal/events/event_dispatcher.go b/internal/events/event_dispatcher.go index 99312890f7..27d91326b2 100644 --- a/internal/events/event_dispatcher.go +++ b/internal/events/event_dispatcher.go @@ -24,10 +24,10 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/definitions" "github.com/hyperledger/firefly/internal/i18n" "github.com/hyperledger/firefly/internal/log" "github.com/hyperledger/firefly/internal/retry" - "github.com/hyperledger/firefly/internal/syshandlers" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/events" "github.com/hyperledger/firefly/pkg/fftypes" @@ -52,7 +52,7 @@ type eventDispatcher struct { data data.Manager database database.Plugin transport events.Plugin - syshandlers syshandlers.SystemHandlers + definitions definitions.DefinitionHandlers elected bool eventPoller *eventPoller inflight map[fftypes.UUID]*fftypes.Event @@ -65,7 +65,7 @@ type eventDispatcher struct { changeEvents chan *fftypes.ChangeEvent } -func newEventDispatcher(ctx context.Context, ei events.Plugin, di database.Plugin, dm data.Manager, sh syshandlers.SystemHandlers, connID string, sub *subscription, en *eventNotifier, cel *changeEventListener) *eventDispatcher { +func newEventDispatcher(ctx context.Context, ei events.Plugin, di database.Plugin, dm data.Manager, sh definitions.DefinitionHandlers, connID string, sub *subscription, en *eventNotifier, cel *changeEventListener) *eventDispatcher { ctx, cancelCtx := context.WithCancel(ctx) readAhead := config.GetUint(config.SubscriptionDefaultsReadAhead) if sub.definition.Options.ReadAhead != nil { @@ -80,7 +80,7 @@ func newEventDispatcher(ctx context.Context, ei events.Plugin, di database.Plugi "sub", fmt.Sprintf("%s/%s:%s", sub.definition.ID, sub.definition.Namespace, sub.definition.Name)), database: di, transport: ei, - syshandlers: sh, + definitions: sh, data: dm, connID: connID, cancelCtx: cancelCtx, @@ -424,7 +424,7 @@ func (ed *eventDispatcher) deliveryResponse(response *fftypes.EventDeliveryRespo // We might have a message to send, do that before we dispatch the ack // Note a failure to send the reply does not invalidate the ack if response.Reply != nil { - ed.syshandlers.SendReply(ed.ctx, event, response.Reply) + ed.definitions.SendReply(ed.ctx, event, response.Reply) } l.Debugf("Response for %s event: %.10d/%s [%s]: ref=%s/%s rejected=%t info='%s'", ed.transport.Name(), event.Sequence, event.ID, event.Type, event.Namespace, event.Reference, response.Rejected, response.Info) diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index b67468f7d5..c12e0dc559 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -859,7 +859,7 @@ func TestEventDispatcherWithReply(t *testing.T) { ed, cancel := newTestEventDispatcher(sub) cancel() ed.acksNacks = make(chan ackNack, 2) - msh := ed.syshandlers.(*syshandlersmocks.SystemHandlers) + msh := ed.definitions.(*syshandlersmocks.SystemHandlers) msh.On("SendReply", ed.ctx, mock.Anything, mock.Anything).Return(&fftypes.Message{}, nil) event1 := fftypes.NewUUID() diff --git a/internal/events/event_manager.go b/internal/events/event_manager.go index 57ed08e910..1dc8178c9c 100644 --- a/internal/events/event_manager.go +++ b/internal/events/event_manager.go @@ -24,13 +24,13 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/definitions" "github.com/hyperledger/firefly/internal/events/eifactory" "github.com/hyperledger/firefly/internal/events/system" "github.com/hyperledger/firefly/internal/i18n" "github.com/hyperledger/firefly/internal/identity" "github.com/hyperledger/firefly/internal/log" "github.com/hyperledger/firefly/internal/retry" - "github.com/hyperledger/firefly/internal/syshandlers" "github.com/hyperledger/firefly/internal/sysmessaging" "github.com/hyperledger/firefly/internal/txcommon" "github.com/hyperledger/firefly/pkg/blockchain" @@ -74,7 +74,7 @@ type eventManager struct { publicstorage publicstorage.Plugin database database.Plugin identity identity.Manager - syshandlers syshandlers.SystemHandlers + definitions definitions.DefinitionHandlers data data.Manager subManager *subscriptionManager retry retry.Retry @@ -87,7 +87,7 @@ type eventManager struct { internalEvents *system.Events } -func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.Plugin, im identity.Manager, sh syshandlers.SystemHandlers, dm data.Manager) (EventManager, error) { +func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.Plugin, im identity.Manager, sh definitions.DefinitionHandlers, dm data.Manager) (EventManager, error) { if pi == nil || di == nil || im == nil || dm == nil { return nil, i18n.NewError(ctx, i18n.MsgInitializationNilDepError) } @@ -98,7 +98,7 @@ func NewEventManager(ctx context.Context, pi publicstorage.Plugin, di database.P publicstorage: pi, database: di, identity: im, - syshandlers: sh, + definitions: sh, data: dm, retry: retry.Retry{ InitialDelay: config.GetDuration(config.EventAggregatorRetryInitDelay), diff --git a/internal/events/subscription_manager.go b/internal/events/subscription_manager.go index 3cd8d9a2d8..c9f6382267 100644 --- a/internal/events/subscription_manager.go +++ b/internal/events/subscription_manager.go @@ -23,12 +23,12 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/internal/data" + "github.com/hyperledger/firefly/internal/definitions" "github.com/hyperledger/firefly/internal/events/eifactory" "github.com/hyperledger/firefly/internal/events/system" "github.com/hyperledger/firefly/internal/i18n" "github.com/hyperledger/firefly/internal/log" "github.com/hyperledger/firefly/internal/retry" - "github.com/hyperledger/firefly/internal/syshandlers" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/events" "github.com/hyperledger/firefly/pkg/fftypes" @@ -58,7 +58,7 @@ type subscriptionManager struct { database database.Plugin data data.Manager eventNotifier *eventNotifier - syshandlers syshandlers.SystemHandlers + definitions definitions.DefinitionHandlers transports map[string]events.Plugin connections map[string]*connection mux sync.Mutex @@ -71,7 +71,7 @@ type subscriptionManager struct { retry retry.Retry } -func newSubscriptionManager(ctx context.Context, di database.Plugin, dm data.Manager, en *eventNotifier, sh syshandlers.SystemHandlers) (*subscriptionManager, error) { +func newSubscriptionManager(ctx context.Context, di database.Plugin, dm data.Manager, en *eventNotifier, sh definitions.DefinitionHandlers) (*subscriptionManager, error) { ctx, cancelCtx := context.WithCancel(ctx) sm := &subscriptionManager{ ctx: ctx, @@ -85,7 +85,7 @@ func newSubscriptionManager(ctx context.Context, di database.Plugin, dm data.Man maxSubs: uint64(config.GetUint(config.SubscriptionMax)), cancelCtx: cancelCtx, eventNotifier: en, - syshandlers: sh, + definitions: sh, retry: retry.Retry{ InitialDelay: config.GetDuration(config.SubscriptionsRetryInitialDelay), MaximumDelay: config.GetDuration(config.SubscriptionsRetryMaxDelay), @@ -381,7 +381,7 @@ func (sm *subscriptionManager) matchSubToConnLocked(conn *connection, sub *subsc } if conn.transport == sub.definition.Transport && conn.matcher(sub.definition.SubscriptionRef) { if _, ok := conn.dispatchers[*sub.definition.ID]; !ok { - dispatcher := newEventDispatcher(sm.ctx, conn.ei, sm.database, sm.data, sm.syshandlers, conn.id, sub, sm.eventNotifier, sm.cel) + dispatcher := newEventDispatcher(sm.ctx, conn.ei, sm.database, sm.data, sm.definitions, conn.id, sub, sm.eventNotifier, sm.cel) conn.dispatchers[*sub.definition.ID] = dispatcher dispatcher.start() } @@ -418,7 +418,7 @@ func (sm *subscriptionManager) ephemeralSubscription(ei events.Plugin, connID, n } // Create the dispatcher, and start immediately - dispatcher := newEventDispatcher(sm.ctx, ei, sm.database, sm.data, sm.syshandlers, connID, newSub, sm.eventNotifier, sm.cel) + dispatcher := newEventDispatcher(sm.ctx, ei, sm.database, sm.data, sm.definitions, connID, newSub, sm.eventNotifier, sm.cel) dispatcher.start() conn.dispatchers[*subID] = dispatcher diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index d8a5e2fa00..dc503dfc3d 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -29,6 +29,7 @@ import ( "github.com/hyperledger/firefly/internal/data" "github.com/hyperledger/firefly/internal/database/difactory" "github.com/hyperledger/firefly/internal/dataexchange/dxfactory" + "github.com/hyperledger/firefly/internal/definitions" "github.com/hyperledger/firefly/internal/events" "github.com/hyperledger/firefly/internal/i18n" "github.com/hyperledger/firefly/internal/identity" @@ -38,7 +39,6 @@ import ( "github.com/hyperledger/firefly/internal/privatemessaging" "github.com/hyperledger/firefly/internal/publicstorage/psfactory" "github.com/hyperledger/firefly/internal/syncasync" - "github.com/hyperledger/firefly/internal/syshandlers" "github.com/hyperledger/firefly/internal/tokens/tifactory" "github.com/hyperledger/firefly/pkg/blockchain" "github.com/hyperledger/firefly/pkg/database" @@ -135,7 +135,7 @@ type orchestrator struct { batch batch.Manager broadcast broadcast.Manager messaging privatemessaging.Manager - syshandlers syshandlers.SystemHandlers + definitions definitions.DefinitionHandlers data data.Manager syncasync syncasync.Bridge batchpin batchpin.Submitter @@ -413,10 +413,10 @@ func (or *orchestrator) initComponents(ctx context.Context) (err error) { } } - or.syshandlers = syshandlers.NewSystemHandlers(or.database, or.dataexchange, or.data, or.broadcast, or.messaging, or.assets) + or.definitions = definitions.NewDefinitionHandlers(or.database, or.dataexchange, or.data, or.broadcast, or.messaging, or.assets) if or.events == nil { - or.events, err = events.NewEventManager(ctx, or.publicstorage, or.database, or.identity, or.syshandlers, or.data) + or.events, err = events.NewEventManager(ctx, or.publicstorage, or.database, or.identity, or.definitions, or.data) if err != nil { return err } diff --git a/mocks/definitionhandlermocks/definition_handlers.go b/mocks/definitionhandlermocks/definition_handlers.go new file mode 100644 index 0000000000..108e2e3ab7 --- /dev/null +++ b/mocks/definitionhandlermocks/definition_handlers.go @@ -0,0 +1,143 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package definitionhandlermocks + +import ( + context "context" + + database "github.com/hyperledger/firefly/pkg/database" + + fftypes "github.com/hyperledger/firefly/pkg/fftypes" + + mock "github.com/stretchr/testify/mock" +) + +// DefinitionHandlers is an autogenerated mock type for the DefinitionHandlers type +type DefinitionHandlers struct { + mock.Mock +} + +// EnsureLocalGroup provides a mock function with given fields: ctx, group +func (_m *DefinitionHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (bool, error) { + ret := _m.Called(ctx, group) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Group) bool); ok { + r0 = rf(ctx, group) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Group) error); ok { + r1 = rf(ctx, group) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetGroupByID provides a mock function with given fields: ctx, id +func (_m *DefinitionHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { + ret := _m.Called(ctx, id) + + var r0 *fftypes.Group + if rf, ok := ret.Get(0).(func(context.Context, string) *fftypes.Group); ok { + r0 = rf(ctx, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Group) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetGroups provides a mock function with given fields: ctx, filter +func (_m *DefinitionHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { + ret := _m.Called(ctx, filter) + + var r0 []*fftypes.Group + if rf, ok := ret.Get(0).(func(context.Context, database.AndFilter) []*fftypes.Group); ok { + r0 = rf(ctx, filter) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*fftypes.Group) + } + } + + var r1 *database.FilterResult + if rf, ok := ret.Get(1).(func(context.Context, database.AndFilter) *database.FilterResult); ok { + r1 = rf(ctx, filter) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*database.FilterResult) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(context.Context, database.AndFilter) error); ok { + r2 = rf(ctx, filter) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// HandleDefinitionBroadcast provides a mock function with given fields: ctx, msg, data +func (_m *DefinitionHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (bool, error) { + ret := _m.Called(ctx, msg, data) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Message, []*fftypes.Data) bool); ok { + r0 = rf(ctx, msg, data) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Message, []*fftypes.Data) error); ok { + r1 = rf(ctx, msg, data) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ResolveInitGroup provides a mock function with given fields: ctx, msg +func (_m *DefinitionHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { + ret := _m.Called(ctx, msg) + + var r0 *fftypes.Group + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Message) *fftypes.Group); ok { + r0 = rf(ctx, msg) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*fftypes.Group) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Message) error); ok { + r1 = rf(ctx, msg) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SendReply provides a mock function with given fields: ctx, event, reply +func (_m *DefinitionHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { + _m.Called(ctx, event, reply) +} diff --git a/mocks/syshandlersmocks/system_handlers.go b/mocks/syshandlersmocks/system_handlers.go index 12031e33ad..b5110e34a3 100644 --- a/mocks/syshandlersmocks/system_handlers.go +++ b/mocks/syshandlersmocks/system_handlers.go @@ -92,8 +92,8 @@ func (_m *SystemHandlers) GetGroups(ctx context.Context, filter database.AndFilt return r0, r1, r2 } -// HandleSystemBroadcast provides a mock function with given fields: ctx, msg, data -func (_m *SystemHandlers) HandleSystemBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (bool, error) { +// HandleDefinitionBroadcast provides a mock function with given fields: ctx, msg, data +func (_m *SystemHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (bool, error) { ret := _m.Called(ctx, msg, data) var r0 bool From a9e65e59e7721d1fdf4801ab105924958be44bfa Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Thu, 11 Nov 2021 17:19:49 -0500 Subject: [PATCH 4/6] Update tests and mocks Signed-off-by: Nicko Guyer --- Makefile | 2 +- .../definition_handler_datatype_test.go | 16 +- .../definition_handler_namespace_test.go | 20 +-- .../definition_handler_network_node_test.go | 22 +-- .../definition_handler_network_org_test.go | 22 +-- .../definitions/definition_handler_test.go | 10 +- .../definition_handler_tokenpool_test.go | 24 +-- internal/definitions/reply_sender_test.go | 6 +- internal/events/aggregator_test.go | 40 ++--- internal/events/dx_callbacks_test.go | 16 +- internal/events/event_dispatcher_test.go | 6 +- internal/events/event_manager_test.go | 6 +- internal/events/subscription_manager_test.go | 4 +- .../definition_handlers.go | 2 +- mocks/syshandlersmocks/system_handlers.go | 142 ------------------ 15 files changed, 98 insertions(+), 240 deletions(-) rename mocks/{definitionhandlermocks => definitionsmocks}/definition_handlers.go (99%) delete mode 100644 mocks/syshandlersmocks/system_handlers.go diff --git a/Makefile b/Makefile index b6c1cf14bf..9524562766 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ $(eval $(call makemock, internal/data, Manager, datamocks $(eval $(call makemock, internal/batch, Manager, batchmocks)) $(eval $(call makemock, internal/broadcast, Manager, broadcastmocks)) $(eval $(call makemock, internal/privatemessaging, Manager, privatemessagingmocks)) -$(eval $(call makemock, internal/definitions, DefinitionHandlers, definitionhandlermocks)) +$(eval $(call makemock, internal/definitions, DefinitionHandlers, definitionsmocks)) $(eval $(call makemock, internal/events, EventManager, eventmocks)) $(eval $(call makemock, internal/networkmap, Manager, networkmapmocks)) $(eval $(call makemock, internal/assets, Manager, assetmocks)) diff --git a/internal/definitions/definition_handler_datatype_test.go b/internal/definitions/definition_handler_datatype_test.go index 73251f9b50..f930bc3b5a 100644 --- a/internal/definitions/definition_handler_datatype_test.go +++ b/internal/definitions/definition_handler_datatype_test.go @@ -30,7 +30,7 @@ import ( ) func TestHandleDefinitionBroadcastDatatypeOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -66,7 +66,7 @@ func TestHandleDefinitionBroadcastDatatypeOk(t *testing.T) { } func TestHandleDefinitionBroadcastDatatypeEventFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -102,7 +102,7 @@ func TestHandleDefinitionBroadcastDatatypeEventFail(t *testing.T) { } func TestHandleDefinitionBroadcastDatatypeMissingID(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ Validator: fftypes.ValidatorTypeJSON, @@ -128,7 +128,7 @@ func TestHandleDefinitionBroadcastDatatypeMissingID(t *testing.T) { } func TestHandleDefinitionBroadcastBadSchema(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -159,7 +159,7 @@ func TestHandleDefinitionBroadcastBadSchema(t *testing.T) { } func TestHandleDefinitionBroadcastMissingData(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -181,7 +181,7 @@ func TestHandleDefinitionBroadcastMissingData(t *testing.T) { } func TestHandleDefinitionBroadcastDatatypeLookupFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -216,7 +216,7 @@ func TestHandleDefinitionBroadcastDatatypeLookupFail(t *testing.T) { } func TestHandleDefinitionBroadcastUpsertFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), @@ -251,7 +251,7 @@ func TestHandleDefinitionBroadcastUpsertFail(t *testing.T) { } func TestHandleDefinitionBroadcastDatatypeDuplicate(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) dt := &fftypes.Datatype{ ID: fftypes.NewUUID(), diff --git a/internal/definitions/definition_handler_namespace_test.go b/internal/definitions/definition_handler_namespace_test.go index 5eb8489447..9e0c91649b 100644 --- a/internal/definitions/definition_handler_namespace_test.go +++ b/internal/definitions/definition_handler_namespace_test.go @@ -29,7 +29,7 @@ import ( ) func TestHandleDefinitionBroadcastNSOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -57,7 +57,7 @@ func TestHandleDefinitionBroadcastNSOk(t *testing.T) { } func TestHandleDefinitionBroadcastNSEventFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -85,7 +85,7 @@ func TestHandleDefinitionBroadcastNSEventFail(t *testing.T) { } func TestHandleDefinitionBroadcastNSUpsertFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -112,7 +112,7 @@ func TestHandleDefinitionBroadcastNSUpsertFail(t *testing.T) { } func TestHandleDefinitionBroadcastNSMissingData(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ @@ -124,7 +124,7 @@ func TestHandleDefinitionBroadcastNSMissingData(t *testing.T) { } func TestHandleDefinitionBroadcastNSBadID(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{} b, err := json.Marshal(&ns) @@ -143,7 +143,7 @@ func TestHandleDefinitionBroadcastNSBadID(t *testing.T) { } func TestHandleDefinitionBroadcastNSBadData(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!{json`), @@ -159,7 +159,7 @@ func TestHandleDefinitionBroadcastNSBadData(t *testing.T) { } func TestHandleDefinitionBroadcastDuplicate(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -185,7 +185,7 @@ func TestHandleDefinitionBroadcastDuplicate(t *testing.T) { } func TestHandleDefinitionBroadcastDuplicateOverrideLocal(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -215,7 +215,7 @@ func TestHandleDefinitionBroadcastDuplicateOverrideLocal(t *testing.T) { } func TestHandleDefinitionBroadcastDuplicateOverrideLocalFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), @@ -243,7 +243,7 @@ func TestHandleDefinitionBroadcastDuplicateOverrideLocalFail(t *testing.T) { } func TestHandleDefinitionBroadcastDupCheckFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) ns := &fftypes.Namespace{ ID: fftypes.NewUUID(), diff --git a/internal/definitions/definition_handler_network_node_test.go b/internal/definitions/definition_handler_network_node_test.go index 9fc46bbf61..c38afb833f 100644 --- a/internal/definitions/definition_handler_network_node_test.go +++ b/internal/definitions/definition_handler_network_node_test.go @@ -30,7 +30,7 @@ import ( ) func TestHandleDefinitionBroadcastNodeOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -72,7 +72,7 @@ func TestHandleDefinitionBroadcastNodeOk(t *testing.T) { } func TestHandleDefinitionBroadcastNodeUpsertFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -112,7 +112,7 @@ func TestHandleDefinitionBroadcastNodeUpsertFail(t *testing.T) { } func TestHandleDefinitionBroadcastNodeAddPeerFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -154,7 +154,7 @@ func TestHandleDefinitionBroadcastNodeAddPeerFail(t *testing.T) { } func TestHandleDefinitionBroadcastNodeDupMismatch(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -192,7 +192,7 @@ func TestHandleDefinitionBroadcastNodeDupMismatch(t *testing.T) { } func TestHandleDefinitionBroadcastNodeDupOK(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -233,7 +233,7 @@ func TestHandleDefinitionBroadcastNodeDupOK(t *testing.T) { } func TestHandleDefinitionBroadcastNodeGetFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -271,7 +271,7 @@ func TestHandleDefinitionBroadcastNodeGetFail(t *testing.T) { } func TestHandleDefinitionBroadcastNodeBadAuthor(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -308,7 +308,7 @@ func TestHandleDefinitionBroadcastNodeBadAuthor(t *testing.T) { } func TestHandleDefinitionBroadcastNodeGetOrgNotFound(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -345,7 +345,7 @@ func TestHandleDefinitionBroadcastNodeGetOrgNotFound(t *testing.T) { } func TestHandleDefinitionBroadcastNodeGetOrgFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -382,7 +382,7 @@ func TestHandleDefinitionBroadcastNodeGetOrgFail(t *testing.T) { } func TestHandleDefinitionBroadcastNodeValidateFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) node := &fftypes.Node{ ID: fftypes.NewUUID(), @@ -415,7 +415,7 @@ func TestHandleDefinitionBroadcastNodeValidateFail(t *testing.T) { } func TestHandleDefinitionBroadcastNodeUnmarshalFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!json`), diff --git a/internal/definitions/definition_handler_network_org_test.go b/internal/definitions/definition_handler_network_org_test.go index 09a66daeb0..44ecd2285a 100644 --- a/internal/definitions/definition_handler_network_org_test.go +++ b/internal/definitions/definition_handler_network_org_test.go @@ -29,7 +29,7 @@ import ( ) func TestHandleDefinitionBroadcastChildOrgOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) parentOrg := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -75,7 +75,7 @@ func TestHandleDefinitionBroadcastChildOrgOk(t *testing.T) { } func TestHandleDefinitionBroadcastChildOrgDupOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) parentOrg := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -119,7 +119,7 @@ func TestHandleDefinitionBroadcastChildOrgDupOk(t *testing.T) { } func TestHandleDefinitionBroadcastChildOrgBadKey(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) parentOrg := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -161,7 +161,7 @@ func TestHandleDefinitionBroadcastChildOrgBadKey(t *testing.T) { } func TestHandleDefinitionBroadcastOrgDupMismatch(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -196,7 +196,7 @@ func TestHandleDefinitionBroadcastOrgDupMismatch(t *testing.T) { } func TestHandleDefinitionBroadcastOrgUpsertFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -232,7 +232,7 @@ func TestHandleDefinitionBroadcastOrgUpsertFail(t *testing.T) { } func TestHandleDefinitionBroadcastOrgGetOrgFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -265,7 +265,7 @@ func TestHandleDefinitionBroadcastOrgGetOrgFail(t *testing.T) { } func TestHandleDefinitionBroadcastOrgAuthorMismatch(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -299,7 +299,7 @@ func TestHandleDefinitionBroadcastOrgAuthorMismatch(t *testing.T) { } func TestHandleDefinitionBroadcastGetParentFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -334,7 +334,7 @@ func TestHandleDefinitionBroadcastGetParentFail(t *testing.T) { } func TestHandleDefinitionBroadcastGetParentNotFound(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -369,7 +369,7 @@ func TestHandleDefinitionBroadcastGetParentNotFound(t *testing.T) { } func TestHandleDefinitionBroadcastValidateFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) org := &fftypes.Organization{ ID: fftypes.NewUUID(), @@ -398,7 +398,7 @@ func TestHandleDefinitionBroadcastValidateFail(t *testing.T) { } func TestHandleDefinitionBroadcastUnmarshalFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) data := &fftypes.Data{ Value: fftypes.Byteable(`!json`), diff --git a/internal/definitions/definition_handler_test.go b/internal/definitions/definition_handler_test.go index 74223d7d80..8db52dc6f2 100644 --- a/internal/definitions/definition_handler_test.go +++ b/internal/definitions/definition_handler_test.go @@ -31,7 +31,7 @@ import ( "github.com/stretchr/testify/mock" ) -func newTestSystemHandlers(t *testing.T) *definitionHandlers { +func newTestDefinitionHandlers(t *testing.T) *definitionHandlers { mdi := &databasemocks.Plugin{} mdx := &dataexchangemocks.Plugin{} mdm := &datamocks.Manager{} @@ -42,7 +42,7 @@ func newTestSystemHandlers(t *testing.T) *definitionHandlers { } func TestHandleDefinitionBroadcastUnknown(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) valid, err := sh.HandleDefinitionBroadcast(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: "uknown", @@ -53,7 +53,7 @@ func TestHandleDefinitionBroadcastUnknown(t *testing.T) { } func TestGetSystemBroadcastPayloadMissingData(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) valid := sh.getSystemBroadcastPayload(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: "uknown", @@ -63,7 +63,7 @@ func TestGetSystemBroadcastPayloadMissingData(t *testing.T) { } func TestGetSystemBroadcastPayloadBadJSON(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) valid := sh.getSystemBroadcastPayload(context.Background(), &fftypes.Message{ Header: fftypes.MessageHeader{ Tag: "uknown", @@ -75,7 +75,7 @@ func TestGetSystemBroadcastPayloadBadJSON(t *testing.T) { func TestPrivateMessagingPassthroughs(t *testing.T) { ctx := context.Background() - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) mpm := sh.messaging.(*privatemessagingmocks.Manager) mpm.On("GetGroupByID", ctx, mock.Anything).Return(nil, nil) mpm.On("GetGroups", ctx, mock.Anything).Return(nil, nil, nil) diff --git a/internal/definitions/definition_handler_tokenpool_test.go b/internal/definitions/definition_handler_tokenpool_test.go index b09814f6c8..feeef82723 100644 --- a/internal/definitions/definition_handler_tokenpool_test.go +++ b/internal/definitions/definition_handler_tokenpool_test.go @@ -31,7 +31,7 @@ import ( ) func TestHandleDefinitionBroadcastTokenPoolSelfOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -84,7 +84,7 @@ func TestHandleDefinitionBroadcastTokenPoolSelfOk(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolSelfUpdateOpFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -127,7 +127,7 @@ func TestHandleDefinitionBroadcastTokenPoolSelfUpdateOpFail(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolSelfGetTXFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -171,7 +171,7 @@ func TestHandleDefinitionBroadcastTokenPoolSelfGetTXFail(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolSelfTXMismatch(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -219,7 +219,7 @@ func TestHandleDefinitionBroadcastTokenPoolSelfTXMismatch(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolSelfUpdateTXFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -265,7 +265,7 @@ func TestHandleDefinitionBroadcastTokenPoolSelfUpdateTXFail(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -322,7 +322,7 @@ func TestHandleDefinitionBroadcastTokenPoolOk(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolValidateTxFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -369,7 +369,7 @@ func TestHandleDefinitionBroadcastTokenPoolValidateTxFail(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolBadTX(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -419,7 +419,7 @@ func TestHandleDefinitionBroadcastTokenPoolBadTX(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolIDMismatch(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -476,7 +476,7 @@ func TestHandleDefinitionBroadcastTokenPoolIDMismatch(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolFailUpsert(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -530,7 +530,7 @@ func TestHandleDefinitionBroadcastTokenPoolFailUpsert(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolOpsFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{ @@ -570,7 +570,7 @@ func TestHandleDefinitionBroadcastTokenPoolOpsFail(t *testing.T) { } func TestHandleDefinitionBroadcastTokenPoolValidateFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) pool := &fftypes.TokenPoolAnnouncement{ TokenPool: fftypes.TokenPool{}, diff --git a/internal/definitions/reply_sender_test.go b/internal/definitions/reply_sender_test.go index b9bec11958..4a37546534 100644 --- a/internal/definitions/reply_sender_test.go +++ b/internal/definitions/reply_sender_test.go @@ -29,7 +29,7 @@ import ( ) func TestSendReplyBroadcastFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) mms := &sysmessagingmocks.MessageSender{} mbm := sh.broadcast.(*broadcastmocks.Manager) mbm.On("NewBroadcast", "ns1", mock.Anything).Return(mms) @@ -45,7 +45,7 @@ func TestSendReplyBroadcastFail(t *testing.T) { } func TestSendReplyPrivateFail(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) mms := &sysmessagingmocks.MessageSender{} mpm := sh.messaging.(*privatemessagingmocks.Manager) mpm.On("NewMessage", "ns1", mock.Anything).Return(mms) @@ -67,7 +67,7 @@ func TestSendReplyPrivateFail(t *testing.T) { } func TestSendReplyPrivateOk(t *testing.T) { - sh := newTestSystemHandlers(t) + sh := newTestDefinitionHandlers(t) msg := &fftypes.Message{ Header: fftypes.MessageHeader{ diff --git a/internal/events/aggregator_test.go b/internal/events/aggregator_test.go index 71d368450c..31c99dabe7 100644 --- a/internal/events/aggregator_test.go +++ b/internal/events/aggregator_test.go @@ -25,10 +25,9 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/hyperledger/firefly/mocks/datamocks" - "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/mocks/definitionsmocks" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/fftypes" - "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -36,7 +35,7 @@ import ( func newTestAggregator() (*aggregator, func()) { mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} - msh := &syshandlersmocks.SystemHandlers{} + msh := &definitionsmocks.DefinitionHandlers{} ctx, cancel := context.WithCancel(context.Background()) ag := newAggregator(ctx, mdi, msh, mdm, newEventNotifier(ctx, "ut")) return ag, cancel @@ -65,7 +64,7 @@ func TestAggregationMaskedZeroNonceMatch(t *testing.T) { mdi := ag.database.(*databasemocks.Plugin) mdm := ag.data.(*datamocks.Manager) - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) // Get the batch mdi.On("GetBatchByID", ag.ctx, batchID).Return(&fftypes.Batch{ @@ -631,7 +630,7 @@ func TestAttemptContextInitGetGroupByIDFail(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(nil, fmt.Errorf("pop")) _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ @@ -652,7 +651,7 @@ func TestAttemptContextInitGroupNotFound(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(nil, nil) _, err := ag.attemptContextInit(ag.ctx, &fftypes.Message{ @@ -675,7 +674,7 @@ func TestAttemptContextInitAuthorMismatch(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author2", 0) - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -703,7 +702,7 @@ func TestAttemptContextInitNoMatch(t *testing.T) { defer cancel() groupID := fftypes.NewRandB32() - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -732,7 +731,7 @@ func TestAttemptContextInitGetPinsFail(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) mdi := ag.database.(*databasemocks.Plugin) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ @@ -764,7 +763,7 @@ func TestAttemptContextInitGetPinsBlocked(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) mdi := ag.database.(*databasemocks.Plugin) - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -798,7 +797,7 @@ func TestAttemptContextInitInsertPinsFail(t *testing.T) { groupID := fftypes.NewRandB32() zeroHash := ag.calcHash("topic1", groupID, "author1", 0) mdi := ag.database.(*databasemocks.Plugin) - msh := ag.definitions.(*syshandlersmocks.SystemHandlers) + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("ResolveInitGroup", ag.ctx, mock.Anything).Return(&fftypes.Group{ GroupIdentity: fftypes.GroupIdentity{ Members: fftypes.Members{ @@ -937,11 +936,12 @@ func TestAttemptMessageDispatchFailValidateBadSystem(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) + msh.On("HandleDefinitionBroadcast", mock.Anything, mock.Anything, mock.Anything).Return(false, nil) + mdm := ag.data.(*datamocks.Manager) mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) - mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) - mdi := ag.database.(*databasemocks.Plugin) mdi.On("UpdateMessage", ag.ctx, mock.Anything, mock.MatchedBy(func(u database.Update) bool { update, err := u.Finalize() @@ -964,8 +964,9 @@ func TestAttemptMessageDispatchFailValidateBadSystem(t *testing.T) { _, err := ag.attemptMessageDispatch(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ + Type: fftypes.MessageTypeDefinition, ID: fftypes.NewUUID(), - Namespace: fftypes.SystemNamespace, + Namespace: "any", }, Data: fftypes.DataRefs{ {ID: fftypes.NewUUID()}, @@ -979,18 +980,17 @@ func TestAttemptMessageDispatchFailValidateSystemFail(t *testing.T) { ag, cancel := newTestAggregator() defer cancel() + msh := ag.definitions.(*definitionsmocks.DefinitionHandlers) + msh.On("HandleDefinitionBroadcast", mock.Anything, mock.Anything, mock.Anything).Return(false, fmt.Errorf("pop")) + mdm := ag.data.(*datamocks.Manager) mdm.On("GetMessageData", ag.ctx, mock.Anything, true).Return([]*fftypes.Data{}, true, nil) - mdm.On("ValidateAll", ag.ctx, mock.Anything).Return(false, nil) - - dbm := ag.database.(*databasemocks.Plugin) - dbm.On("UpdateMessage", ag.ctx, mock.Anything, mock.Anything).Return(nil) - dbm.On("InsertEvent", ag.ctx, mock.Anything).Return(errors.Errorf("pop")) _, err := ag.attemptMessageDispatch(ag.ctx, &fftypes.Message{ Header: fftypes.MessageHeader{ + Type: fftypes.MessageTypeDefinition, ID: fftypes.NewUUID(), - Namespace: fftypes.SystemNamespace, + Namespace: "any", }, Data: fftypes.DataRefs{ {ID: fftypes.NewUUID()}, diff --git a/internal/events/dx_callbacks_test.go b/internal/events/dx_callbacks_test.go index cf86628a1d..6350b1f69a 100644 --- a/internal/events/dx_callbacks_test.go +++ b/internal/events/dx_callbacks_test.go @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/hyperledger/firefly/mocks/dataexchangemocks" - "github.com/hyperledger/firefly/mocks/syshandlersmocks" + "github.com/hyperledger/firefly/mocks/definitionsmocks" "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -598,7 +598,7 @@ func TestMessageReceiveMessageIdentityFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return(nil, nil, fmt.Errorf("pop")) @@ -635,7 +635,7 @@ func TestMessageReceiveMessageIdentityIncorrect(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{}, nil, nil) @@ -672,7 +672,7 @@ func TestMessageReceiveMessagePersistMessageFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -722,7 +722,7 @@ func TestMessageReceiveMessagePersistDataFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -772,7 +772,7 @@ func TestMessageReceiveMessagePersistEventFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(true, nil) mdi.On("GetNodes", em.ctx, mock.Anything).Return([]*fftypes.Node{ @@ -824,7 +824,7 @@ func TestMessageReceiveMessageEnsureLocalGroupFail(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(false, fmt.Errorf("pop")) err = em.MessageReceived(mdx, "peer1", b) @@ -866,7 +866,7 @@ func TestMessageReceiveMessageEnsureLocalGroupReject(t *testing.T) { mdi := em.database.(*databasemocks.Plugin) mdx := &dataexchangemocks.Plugin{} - msh := em.definitions.(*syshandlersmocks.SystemHandlers) + msh := em.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("EnsureLocalGroup", em.ctx, mock.Anything).Return(false, nil) err = em.MessageReceived(mdx, "peer1", b) diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index c12e0dc559..079a1a9dd5 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -26,8 +26,8 @@ import ( "github.com/hyperledger/firefly/internal/log" "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/definitionsmocks" "github.com/hyperledger/firefly/mocks/eventsmocks" - "github.com/hyperledger/firefly/mocks/syshandlersmocks" "github.com/hyperledger/firefly/pkg/database" "github.com/hyperledger/firefly/pkg/events" "github.com/hyperledger/firefly/pkg/fftypes" @@ -41,7 +41,7 @@ func newTestEventDispatcher(sub *subscription) (*eventDispatcher, func()) { mei.On("Capabilities").Return(&events.Capabilities{ChangeEvents: true}).Maybe() mei.On("Name").Return("ut").Maybe() mdm := &datamocks.Manager{} - msh := &syshandlersmocks.SystemHandlers{} + msh := &definitionsmocks.DefinitionHandlers{} ctx, cancel := context.WithCancel(context.Background()) return newEventDispatcher(ctx, mei, mdi, mdm, msh, fftypes.NewUUID().String(), sub, newEventNotifier(ctx, "ut"), newChangeEventListener(ctx)), func() { cancel() @@ -859,7 +859,7 @@ func TestEventDispatcherWithReply(t *testing.T) { ed, cancel := newTestEventDispatcher(sub) cancel() ed.acksNacks = make(chan ackNack, 2) - msh := ed.definitions.(*syshandlersmocks.SystemHandlers) + msh := ed.definitions.(*definitionsmocks.DefinitionHandlers) msh.On("SendReply", ed.ctx, mock.Anything, mock.Anything).Return(&fftypes.Message{}, nil) event1 := fftypes.NewUUID() diff --git a/internal/events/event_manager_test.go b/internal/events/event_manager_test.go index 9d512b1300..0ef7628e1f 100644 --- a/internal/events/event_manager_test.go +++ b/internal/events/event_manager_test.go @@ -26,11 +26,11 @@ import ( "github.com/hyperledger/firefly/mocks/broadcastmocks" "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/definitionsmocks" "github.com/hyperledger/firefly/mocks/eventsmocks" "github.com/hyperledger/firefly/mocks/identitymanagermocks" "github.com/hyperledger/firefly/mocks/privatemessagingmocks" "github.com/hyperledger/firefly/mocks/publicstoragemocks" - "github.com/hyperledger/firefly/mocks/syshandlersmocks" "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -44,7 +44,7 @@ func newTestEventManager(t *testing.T) (*eventManager, func()) { mpi := &publicstoragemocks.Plugin{} met := &eventsmocks.Plugin{} mdm := &datamocks.Manager{} - msh := &syshandlersmocks.SystemHandlers{} + msh := &definitionsmocks.DefinitionHandlers{} mbm := &broadcastmocks.Manager{} mpm := &privatemessagingmocks.Manager{} met.On("Name").Return("ut").Maybe() @@ -90,7 +90,7 @@ func TestStartStopBadTransports(t *testing.T) { mim := &identitymanagermocks.Manager{} mpi := &publicstoragemocks.Plugin{} mdm := &datamocks.Manager{} - msh := &syshandlersmocks.SystemHandlers{} + msh := &definitionsmocks.DefinitionHandlers{} mbm := &broadcastmocks.Manager{} mpm := &privatemessagingmocks.Manager{} _, err := NewEventManager(context.Background(), mpi, mdi, mim, msh, mdm, mbm, mpm) diff --git a/internal/events/subscription_manager_test.go b/internal/events/subscription_manager_test.go index f442e93f4b..51e5179080 100644 --- a/internal/events/subscription_manager_test.go +++ b/internal/events/subscription_manager_test.go @@ -24,8 +24,8 @@ import ( "github.com/hyperledger/firefly/internal/config" "github.com/hyperledger/firefly/mocks/databasemocks" "github.com/hyperledger/firefly/mocks/datamocks" + "github.com/hyperledger/firefly/mocks/definitionsmocks" "github.com/hyperledger/firefly/mocks/eventsmocks" - "github.com/hyperledger/firefly/mocks/syshandlersmocks" "github.com/hyperledger/firefly/pkg/events" "github.com/hyperledger/firefly/pkg/fftypes" "github.com/stretchr/testify/assert" @@ -38,7 +38,7 @@ func newTestSubManager(t *testing.T, mei *eventsmocks.PluginAll) (*subscriptionM mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} - msh := &syshandlersmocks.SystemHandlers{} + msh := &definitionsmocks.DefinitionHandlers{} ctx, cancel := context.WithCancel(context.Background()) mei.On("Name").Return("ut") diff --git a/mocks/definitionhandlermocks/definition_handlers.go b/mocks/definitionsmocks/definition_handlers.go similarity index 99% rename from mocks/definitionhandlermocks/definition_handlers.go rename to mocks/definitionsmocks/definition_handlers.go index 108e2e3ab7..d2d2a560e4 100644 --- a/mocks/definitionhandlermocks/definition_handlers.go +++ b/mocks/definitionsmocks/definition_handlers.go @@ -1,6 +1,6 @@ // Code generated by mockery v1.0.0. DO NOT EDIT. -package definitionhandlermocks +package definitionsmocks import ( context "context" diff --git a/mocks/syshandlersmocks/system_handlers.go b/mocks/syshandlersmocks/system_handlers.go deleted file mode 100644 index b5110e34a3..0000000000 --- a/mocks/syshandlersmocks/system_handlers.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package syshandlersmocks - -import ( - context "context" - - database "github.com/hyperledger/firefly/pkg/database" - fftypes "github.com/hyperledger/firefly/pkg/fftypes" - - mock "github.com/stretchr/testify/mock" -) - -// SystemHandlers is an autogenerated mock type for the SystemHandlers type -type SystemHandlers struct { - mock.Mock -} - -// EnsureLocalGroup provides a mock function with given fields: ctx, group -func (_m *SystemHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (bool, error) { - ret := _m.Called(ctx, group) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Group) bool); ok { - r0 = rf(ctx, group) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Group) error); ok { - r1 = rf(ctx, group) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetGroupByID provides a mock function with given fields: ctx, id -func (_m *SystemHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { - ret := _m.Called(ctx, id) - - var r0 *fftypes.Group - if rf, ok := ret.Get(0).(func(context.Context, string) *fftypes.Group); ok { - r0 = rf(ctx, id) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*fftypes.Group) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetGroups provides a mock function with given fields: ctx, filter -func (_m *SystemHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { - ret := _m.Called(ctx, filter) - - var r0 []*fftypes.Group - if rf, ok := ret.Get(0).(func(context.Context, database.AndFilter) []*fftypes.Group); ok { - r0 = rf(ctx, filter) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*fftypes.Group) - } - } - - var r1 *database.FilterResult - if rf, ok := ret.Get(1).(func(context.Context, database.AndFilter) *database.FilterResult); ok { - r1 = rf(ctx, filter) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*database.FilterResult) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, database.AndFilter) error); ok { - r2 = rf(ctx, filter) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// HandleDefinitionBroadcast provides a mock function with given fields: ctx, msg, data -func (_m *SystemHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (bool, error) { - ret := _m.Called(ctx, msg, data) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Message, []*fftypes.Data) bool); ok { - r0 = rf(ctx, msg, data) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Message, []*fftypes.Data) error); ok { - r1 = rf(ctx, msg, data) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ResolveInitGroup provides a mock function with given fields: ctx, msg -func (_m *SystemHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { - ret := _m.Called(ctx, msg) - - var r0 *fftypes.Group - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.Message) *fftypes.Group); ok { - r0 = rf(ctx, msg) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*fftypes.Group) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *fftypes.Message) error); ok { - r1 = rf(ctx, msg) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SendReply provides a mock function with given fields: ctx, event, reply -func (_m *SystemHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { - _m.Called(ctx, event, reply) -} From 6f0498fe635bae3c831c53843ee1fb437bdbc1f7 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Fri, 12 Nov 2021 09:20:17 -0500 Subject: [PATCH 5/6] Improve codestyle Signed-off-by: Nicko Guyer --- internal/definitions/definition_handler.go | 30 +++++++++---------- .../definition_handler_datatype.go | 12 ++++---- .../definition_handler_namespace.go | 12 ++++---- .../definition_handler_network_node.go | 14 ++++----- .../definition_handler_network_org.go | 14 ++++----- .../definition_handler_tokenpool.go | 24 +++++++-------- internal/definitions/reply_sender.go | 6 ++-- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/internal/definitions/definition_handler.go b/internal/definitions/definition_handler.go index 7d88454852..dac2344cfc 100644 --- a/internal/definitions/definition_handler.go +++ b/internal/definitions/definition_handler.go @@ -61,43 +61,43 @@ func NewDefinitionHandlers(di database.Plugin, dx dataexchange.Plugin, dm data.M } } -func (sh *definitionHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { - return sh.messaging.GetGroupByID(ctx, id) +func (dh *definitionHandlers) GetGroupByID(ctx context.Context, id string) (*fftypes.Group, error) { + return dh.messaging.GetGroupByID(ctx, id) } -func (sh *definitionHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { - return sh.messaging.GetGroups(ctx, filter) +func (dh *definitionHandlers) GetGroups(ctx context.Context, filter database.AndFilter) ([]*fftypes.Group, *database.FilterResult, error) { + return dh.messaging.GetGroups(ctx, filter) } -func (sh *definitionHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { - return sh.messaging.ResolveInitGroup(ctx, msg) +func (dh *definitionHandlers) ResolveInitGroup(ctx context.Context, msg *fftypes.Message) (*fftypes.Group, error) { + return dh.messaging.ResolveInitGroup(ctx, msg) } -func (sh *definitionHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (ok bool, err error) { - return sh.messaging.EnsureLocalGroup(ctx, group) +func (dh *definitionHandlers) EnsureLocalGroup(ctx context.Context, group *fftypes.Group) (ok bool, err error) { + return dh.messaging.EnsureLocalGroup(ctx, group) } -func (sh *definitionHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) HandleDefinitionBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) l.Infof("Confirming system broadcast '%s' [%s]", msg.Header.Tag, msg.Header.ID) switch fftypes.SystemTag(msg.Header.Tag) { case fftypes.SystemTagDefineDatatype: - return sh.handleDatatypeBroadcast(ctx, msg, data) + return dh.handleDatatypeBroadcast(ctx, msg, data) case fftypes.SystemTagDefineNamespace: - return sh.handleNamespaceBroadcast(ctx, msg, data) + return dh.handleNamespaceBroadcast(ctx, msg, data) case fftypes.SystemTagDefineOrganization: - return sh.handleOrganizationBroadcast(ctx, msg, data) + return dh.handleOrganizationBroadcast(ctx, msg, data) case fftypes.SystemTagDefineNode: - return sh.handleNodeBroadcast(ctx, msg, data) + return dh.handleNodeBroadcast(ctx, msg, data) case fftypes.SystemTagDefinePool: - return sh.handleTokenPoolBroadcast(ctx, msg, data) + return dh.handleTokenPoolBroadcast(ctx, msg, data) default: l.Debugf("Unknown topic '%s' for system broadcast or definition ID '%s'", msg.Header.Tag, msg.Header.ID) } return false, nil } -func (sh *definitionHandlers) getSystemBroadcastPayload(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data, res fftypes.Definition) (valid bool) { +func (dh *definitionHandlers) getSystemBroadcastPayload(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data, res fftypes.Definition) (valid bool) { l := log.L(ctx) if len(data) != 1 { l.Warnf("Unable to process system broadcast %s - expecting 1 attachement, found %d", msg.Header.ID, len(data)) diff --git a/internal/definitions/definition_handler_datatype.go b/internal/definitions/definition_handler_datatype.go index 1e004d098a..10e355b16c 100644 --- a/internal/definitions/definition_handler_datatype.go +++ b/internal/definitions/definition_handler_datatype.go @@ -23,11 +23,11 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) handleDatatypeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) handleDatatypeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var dt fftypes.Datatype - valid = sh.getSystemBroadcastPayload(ctx, msg, data, &dt) + valid = dh.getSystemBroadcastPayload(ctx, msg, data, &dt) if !valid { return false, nil } @@ -37,12 +37,12 @@ func (sh *definitionHandlers) handleDatatypeBroadcast(ctx context.Context, msg * return false, nil } - if err = sh.data.CheckDatatype(ctx, dt.Namespace, &dt); err != nil { + if err = dh.data.CheckDatatype(ctx, dt.Namespace, &dt); err != nil { l.Warnf("Unable to process datatype broadcast %s - schema check: %s", msg.Header.ID, err) return false, nil } - existing, err := sh.database.GetDatatypeByName(ctx, dt.Namespace, dt.Name, dt.Version) + existing, err := dh.database.GetDatatypeByName(ctx, dt.Namespace, dt.Name, dt.Version) if err != nil { return false, err // We only return database errors } @@ -51,12 +51,12 @@ func (sh *definitionHandlers) handleDatatypeBroadcast(ctx context.Context, msg * return false, nil } - if err = sh.database.UpsertDatatype(ctx, &dt, false); err != nil { + if err = dh.database.UpsertDatatype(ctx, &dt, false); err != nil { return false, err } event := fftypes.NewEvent(fftypes.EventTypeDatatypeConfirmed, dt.Namespace, dt.ID) - if err = sh.database.InsertEvent(ctx, event); err != nil { + if err = dh.database.InsertEvent(ctx, event); err != nil { return false, err } diff --git a/internal/definitions/definition_handler_namespace.go b/internal/definitions/definition_handler_namespace.go index bcda2bec83..bb04c74c78 100644 --- a/internal/definitions/definition_handler_namespace.go +++ b/internal/definitions/definition_handler_namespace.go @@ -23,11 +23,11 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) handleNamespaceBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) handleNamespaceBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var ns fftypes.Namespace - valid = sh.getSystemBroadcastPayload(ctx, msg, data, &ns) + valid = dh.getSystemBroadcastPayload(ctx, msg, data, &ns) if !valid { return false, nil } @@ -36,7 +36,7 @@ func (sh *definitionHandlers) handleNamespaceBroadcast(ctx context.Context, msg return false, nil } - existing, err := sh.database.GetNamespace(ctx, ns.Name) + existing, err := dh.database.GetNamespace(ctx, ns.Name) if err != nil { return false, err // We only return database errors } @@ -46,17 +46,17 @@ func (sh *definitionHandlers) handleNamespaceBroadcast(ctx context.Context, msg return false, nil } // Remove the local definition - if err = sh.database.DeleteNamespace(ctx, existing.ID); err != nil { + if err = dh.database.DeleteNamespace(ctx, existing.ID); err != nil { return false, err } } - if err = sh.database.UpsertNamespace(ctx, &ns, false); err != nil { + if err = dh.database.UpsertNamespace(ctx, &ns, false); err != nil { return false, err } event := fftypes.NewEvent(fftypes.EventTypeNamespaceConfirmed, ns.Name, ns.ID) - if err = sh.database.InsertEvent(ctx, event); err != nil { + if err = dh.database.InsertEvent(ctx, event); err != nil { return false, err } diff --git a/internal/definitions/definition_handler_network_node.go b/internal/definitions/definition_handler_network_node.go index 748ad84e56..d7f761a6a6 100644 --- a/internal/definitions/definition_handler_network_node.go +++ b/internal/definitions/definition_handler_network_node.go @@ -23,11 +23,11 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var node fftypes.Node - valid = sh.getSystemBroadcastPayload(ctx, msg, data, &node) + valid = dh.getSystemBroadcastPayload(ctx, msg, data, &node) if !valid { return false, nil } @@ -37,7 +37,7 @@ func (sh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *ffty return false, nil } - owner, err := sh.database.GetOrganizationByIdentity(ctx, node.Owner) + owner, err := dh.database.GetOrganizationByIdentity(ctx, node.Owner) if err != nil { return false, err // We only return database errors } @@ -51,9 +51,9 @@ func (sh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *ffty return false, nil } - existing, err := sh.database.GetNode(ctx, node.Owner, node.Name) + existing, err := dh.database.GetNode(ctx, node.Owner, node.Name) if err == nil && existing == nil { - existing, err = sh.database.GetNodeByID(ctx, node.ID) + existing, err = dh.database.GetNodeByID(ctx, node.ID) } if err != nil { return false, err // We only return database errors @@ -66,12 +66,12 @@ func (sh *definitionHandlers) handleNodeBroadcast(ctx context.Context, msg *ffty node.ID = nil // we keep the existing ID } - if err = sh.database.UpsertNode(ctx, &node, true); err != nil { + if err = dh.database.UpsertNode(ctx, &node, true); err != nil { return false, err } // Tell the data exchange about this node. Treat these errors like database errors - and return for retry processing - if err = sh.exchange.AddPeer(ctx, node.DX.Peer, node.DX.Endpoint); err != nil { + if err = dh.exchange.AddPeer(ctx, node.DX.Peer, node.DX.Endpoint); err != nil { return false, err } diff --git a/internal/definitions/definition_handler_network_org.go b/internal/definitions/definition_handler_network_org.go index 6beeba9362..e8a6f68e71 100644 --- a/internal/definitions/definition_handler_network_org.go +++ b/internal/definitions/definition_handler_network_org.go @@ -23,11 +23,11 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var org fftypes.Organization - valid = sh.getSystemBroadcastPayload(ctx, msg, data, &org) + valid = dh.getSystemBroadcastPayload(ctx, msg, data, &org) if !valid { return false, nil } @@ -38,7 +38,7 @@ func (sh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, m } if org.Parent != "" { - parent, err := sh.database.GetOrganizationByIdentity(ctx, org.Parent) + parent, err := dh.database.GetOrganizationByIdentity(ctx, org.Parent) if err != nil { return false, err // We only return database errors } @@ -53,11 +53,11 @@ func (sh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, m } } - existing, err := sh.database.GetOrganizationByIdentity(ctx, org.Identity) + existing, err := dh.database.GetOrganizationByIdentity(ctx, org.Identity) if err == nil && existing == nil { - existing, err = sh.database.GetOrganizationByName(ctx, org.Name) + existing, err = dh.database.GetOrganizationByName(ctx, org.Name) if err == nil && existing == nil { - existing, err = sh.database.GetOrganizationByID(ctx, org.ID) + existing, err = dh.database.GetOrganizationByID(ctx, org.ID) } } if err != nil { @@ -71,7 +71,7 @@ func (sh *definitionHandlers) handleOrganizationBroadcast(ctx context.Context, m org.ID = nil // we keep the existing ID } - if err = sh.database.UpsertOrganization(ctx, &org, true); err != nil { + if err = dh.database.UpsertOrganization(ctx, &org, true); err != nil { return false, err } diff --git a/internal/definitions/definition_handler_tokenpool.go b/internal/definitions/definition_handler_tokenpool.go index f43273ba08..9f4c73e205 100644 --- a/internal/definitions/definition_handler_tokenpool.go +++ b/internal/definitions/definition_handler_tokenpool.go @@ -24,14 +24,14 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftypes.TokenPoolAnnouncement) (valid bool, err error) { +func (dh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftypes.TokenPoolAnnouncement) (valid bool, err error) { // Find a matching operation within this transaction fb := database.OperationQueryFactory.NewFilter(ctx) filter := fb.And( fb.Eq("tx", pool.TX.ID), fb.Eq("type", fftypes.OpTypeTokenAnnouncePool), ) - operations, _, err := sh.database.GetOperations(ctx, filter) + operations, _, err := dh.database.GetOperations(ctx, filter) if err != nil { return false, err // retryable } @@ -41,12 +41,12 @@ func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftype update := database.OperationQueryFactory.NewUpdate(ctx). Set("status", fftypes.OpStatusSucceeded). Set("output", fftypes.JSONObject{"message": pool.Message}) - if err := sh.database.UpdateOperation(ctx, operations[0].ID, update); err != nil { + if err := dh.database.UpdateOperation(ctx, operations[0].ID, update); err != nil { return false, err // retryable } // Validate received info matches the database - transaction, err := sh.database.GetTransactionByID(ctx, pool.TX.ID) + transaction, err := dh.database.GetTransactionByID(ctx, pool.TX.ID) if err != nil { return false, err // retryable } @@ -57,14 +57,14 @@ func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftype // Mark transaction completed transaction.Status = fftypes.OpStatusSucceeded - err = sh.database.UpsertTransaction(ctx, transaction, false) + err = dh.database.UpsertTransaction(ctx, transaction, false) if err != nil { return false, err // retryable } } else { // No local announce operation found (broadcast originated from another node) log.L(ctx).Infof("Validating token pool transaction '%s' with protocol ID '%s'", pool.TX.ID, pool.ProtocolTxID) - err = sh.assets.ValidateTokenPoolTx(ctx, &pool.TokenPool, pool.ProtocolTxID) + err = dh.assets.ValidateTokenPoolTx(ctx, &pool.TokenPool, pool.ProtocolTxID) if err != nil { log.L(ctx).Errorf("Failed to validate token pool transaction '%s': %v", pool.TX.ID, err) return false, err // retryable @@ -80,13 +80,13 @@ func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftype }, ProtocolID: pool.ProtocolTxID, } - valid, err = sh.txhelper.PersistTransaction(ctx, transaction) + valid, err = dh.txhelper.PersistTransaction(ctx, transaction) if !valid || err != nil { return valid, err } } - err = sh.database.UpsertTokenPool(ctx, &pool.TokenPool) + err = dh.database.UpsertTokenPool(ctx, &pool.TokenPool) if err != nil { if err == database.IDMismatch { log.L(ctx).Errorf("Invalid token pool '%s'. ID mismatch with existing record", pool.ID) @@ -98,18 +98,18 @@ func (sh *definitionHandlers) persistTokenPool(ctx context.Context, pool *fftype return true, nil } -func (sh *definitionHandlers) handleTokenPoolBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { +func (dh *definitionHandlers) handleTokenPoolBroadcast(ctx context.Context, msg *fftypes.Message, data []*fftypes.Data) (valid bool, err error) { l := log.L(ctx) var pool fftypes.TokenPoolAnnouncement - valid = sh.getSystemBroadcastPayload(ctx, msg, data, &pool) + valid = dh.getSystemBroadcastPayload(ctx, msg, data, &pool) if valid { if err = pool.Validate(ctx, true); err != nil { l.Warnf("Unable to process token pool broadcast %s - validate failed: %s", msg.Header.ID, err) valid = false } else { pool.Message = msg.Header.ID - valid, err = sh.persistTokenPool(ctx, &pool) + valid, err = dh.persistTokenPool(ctx, &pool) if err != nil { return valid, err } @@ -124,6 +124,6 @@ func (sh *definitionHandlers) handleTokenPoolBroadcast(ctx context.Context, msg l.Warnf("Token pool rejected id=%s author=%s", pool.ID, msg.Header.Author) event = fftypes.NewEvent(fftypes.EventTypePoolRejected, pool.Namespace, pool.ID) } - err = sh.database.InsertEvent(ctx, event) + err = dh.database.InsertEvent(ctx, event) return valid, err } diff --git a/internal/definitions/reply_sender.go b/internal/definitions/reply_sender.go index 59b51f7bfe..495b2d9c40 100644 --- a/internal/definitions/reply_sender.go +++ b/internal/definitions/reply_sender.go @@ -23,12 +23,12 @@ import ( "github.com/hyperledger/firefly/pkg/fftypes" ) -func (sh *definitionHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { +func (dh *definitionHandlers) SendReply(ctx context.Context, event *fftypes.Event, reply *fftypes.MessageInOut) { var err error if reply.Header.Group != nil { - err = sh.messaging.NewMessage(event.Namespace, reply).Send(ctx) + err = dh.messaging.NewMessage(event.Namespace, reply).Send(ctx) } else { - err = sh.broadcast.NewBroadcast(event.Namespace, reply).Send(ctx) + err = dh.broadcast.NewBroadcast(event.Namespace, reply).Send(ctx) } if err != nil { log.L(ctx).Errorf("Failed to send reply: %s", err) From 1ff29f877bb16fd46c252bfcac85166b0757758a Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 24 Nov 2021 13:37:42 -0500 Subject: [PATCH 6/6] Update log message and comments for definitions Signed-off-by: Nicko Guyer --- internal/definitions/definition_handler.go | 2 +- internal/events/aggregator.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/definitions/definition_handler.go b/internal/definitions/definition_handler.go index 6c27a9169f..eaaac89505 100644 --- a/internal/definitions/definition_handler.go +++ b/internal/definitions/definition_handler.go @@ -103,7 +103,7 @@ func (dh *definitionHandlers) HandleSystemBroadcast(ctx context.Context, msg *ff case fftypes.SystemTagDefinePool: return dh.handleTokenPoolBroadcast(ctx, msg, data) default: - l.Warnf("Unknown topic '%s' for system broadcast ID '%s'", msg.Header.Tag, msg.Header.ID) + l.Warnf("Unknown SystemTag '%s' for definition ID '%s'", msg.Header.Tag, msg.Header.ID) return ActionReject, nil } switch { diff --git a/internal/events/aggregator.go b/internal/events/aggregator.go index ae6f3e5159..9c6b5bcb2a 100644 --- a/internal/events/aggregator.go +++ b/internal/events/aggregator.go @@ -432,8 +432,8 @@ func (ag *aggregator) attemptMessageDispatch(ctx context.Context, msg *fftypes.M eventType := fftypes.EventTypeMessageConfirmed switch { case msg.Header.Type == fftypes.MessageTypeDefinition: - // We handle system events in-line on the aggregator, as it would be confusing for apps to be - // dispatched subsequent events before we have processed the system events they depend on. + // We handle definition events in-line on the aggregator, as it would be confusing for apps to be + // dispatched subsequent events before we have processed the definition events they depend on. var action definitions.SystemBroadcastAction action, err = ag.definitions.HandleSystemBroadcast(ctx, msg, data) if action == definitions.ActionRetry || action == definitions.ActionWait {