From d595d52dabb8f4953b5c23d3a8154cac13d00306 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 2 Dec 2020 13:15:05 +0100 Subject: [PATCH] feat: add sql persister (#350) --- .circleci/config.yml | 4 +- api/keto/acl/v1alpha1/read_service.pb.go | 6 +- api/keto/acl/v1alpha1/read_service.proto | 2 +- cmd/namespace/migrate.go | 7 +- go.mod | 7 +- go.sum | 137 +++++++++------ internal/check/engine_test.go | 31 ++-- internal/driver/configuration/provider.go | 2 + .../driver/configuration/provider_viper.go | 71 +++++--- .../configuration/provider_viper_test.go | 6 +- internal/driver/driver_default.go | 18 ++ internal/driver/registry.go | 1 + internal/driver/registry_default.go | 136 ++++++++++----- internal/expand/engine_test.go | 19 ++- internal/namespace/definitons.go | 28 +++- internal/persistence/definitions.go | 11 +- internal/persistence/memory/definitions.go | 28 ---- internal/persistence/memory/namespace.go | 41 ----- internal/persistence/memory/relationtuples.go | 119 ------------- .../persistence/memory/relationtuples_test.go | 116 ------------- ...201110175414_relationtuple.sqlite.down.sql | 1 + ...20201110175414_relationtuple.sqlite.up.sql | 5 + internal/persistence/sql/namespace.go | 84 ++++++++++ internal/persistence/sql/pagination_test.go | 49 ++++++ internal/persistence/sql/persister.go | 115 +++++++++++++ internal/persistence/sql/relationtuples.go | 157 ++++++++++++++++++ internal/relationtuple/definitions.go | 9 +- internal/relationtuple/read_server.go | 2 +- internal/x/pagination.go | 4 +- 29 files changed, 737 insertions(+), 479 deletions(-) delete mode 100644 internal/persistence/memory/definitions.go delete mode 100644 internal/persistence/memory/namespace.go delete mode 100644 internal/persistence/memory/relationtuples.go delete mode 100644 internal/persistence/memory/relationtuples_test.go create mode 100644 internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.down.sql create mode 100644 internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.up.sql create mode 100644 internal/persistence/sql/namespace.go create mode 100644 internal/persistence/sql/pagination_test.go create mode 100644 internal/persistence/sql/persister.go create mode 100644 internal/persistence/sql/relationtuples.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 82614b39b..e8e471f6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,9 +41,9 @@ jobs: # Tests - - run: go test -race -short -v $(go list ./... | grep -v cmd) + run: go test -tags sqlite -race -short -v $(go list ./... | grep -v cmd) - - run: go-acc -v -o coverage.txt ./... + run: go-acc -o coverage.txt ./... -- -v -tags sqlite # Submit coverage details - diff --git a/api/keto/acl/v1alpha1/read_service.pb.go b/api/keto/acl/v1alpha1/read_service.pb.go index f93f67ae2..46d1b4d31 100644 --- a/api/keto/acl/v1alpha1/read_service.pb.go +++ b/api/keto/acl/v1alpha1/read_service.pb.go @@ -52,7 +52,7 @@ type ListRelationTuplesRequest struct { Snaptoken string `protobuf:"bytes,3,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"` // Optional. The maximum number of // RelationTuples to return in the response. - PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // Optional. A pagination token returned from // a previous call to `ListRelationTuples` that // indicates where the page should start at. @@ -112,7 +112,7 @@ func (x *ListRelationTuplesRequest) GetSnaptoken() string { return "" } -func (x *ListRelationTuplesRequest) GetPageSize() int32 { +func (x *ListRelationTuplesRequest) GetPageSize() uint32 { if x != nil { return x.PageSize } @@ -298,7 +298,7 @@ var file_keto_acl_v1alpha1_read_service_proto_rawDesc = []byte{ 0x6b, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6e, 0x61, 0x70, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6e, 0x61, 0x70, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, - 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x8f, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, diff --git a/api/keto/acl/v1alpha1/read_service.proto b/api/keto/acl/v1alpha1/read_service.proto index d4c22271c..f002628d0 100644 --- a/api/keto/acl/v1alpha1/read_service.proto +++ b/api/keto/acl/v1alpha1/read_service.proto @@ -61,7 +61,7 @@ message ListRelationTuplesRequest { string snaptoken = 3; // Optional. The maximum number of // RelationTuples to return in the response. - int32 page_size = 4; + uint32 page_size = 4; // Optional. A pagination token returned from // a previous call to `ListRelationTuples` that // indicates where the page should start at. diff --git a/cmd/namespace/migrate.go b/cmd/namespace/migrate.go index 9e4593ef8..ca1ef9583 100644 --- a/cmd/namespace/migrate.go +++ b/cmd/namespace/migrate.go @@ -1,6 +1,7 @@ package namespace import ( + "context" "errors" "fmt" @@ -27,7 +28,7 @@ func NewMigrateCmd() *cobra.Command { return err } - status, err := d.Registry().NamespaceManager().NamespaceStatus(n) + status, err := d.Registry().NamespaceMigrator().NamespaceStatus(context.Background(), n.ID) if err != nil { if !errors.Is(err, persistence.ErrNamespaceUnknown) { _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get status for namespace \"%s\": %+v\n", n.Name, err) @@ -49,12 +50,12 @@ func NewMigrateCmd() *cobra.Command { } } - if err := d.Registry().NamespaceManager().MigrateNamespaceUp(n); err != nil { + if err := d.Registry().NamespaceMigrator().MigrateNamespaceUp(context.Background(), n); err != nil { _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not apply namespace migration: %+v\n", err) return cmdx.FailSilently(cmd) } - status, err = d.Registry().NamespaceManager().NamespaceStatus(n) + status, err = d.Registry().NamespaceMigrator().NamespaceStatus(context.Background(), n.ID) if err != nil { _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get status for namespace \"%s\": %+v\n", n.Name, err) return cmdx.FailSilently(cmd) diff --git a/go.mod b/go.mod index c95538f70..ba6cf7691 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/ory/keto replace google.golang.org/protobuf v1.25.1-0.20201020201750-d3470999428b => google.golang.org/protobuf v1.25.0 require ( + github.com/HdrHistogram/hdrhistogram-go v1.0.1 // indirect github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect github.com/bufbuild/buf v0.31.1 github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect @@ -14,18 +15,19 @@ require ( github.com/go-openapi/validate v0.19.3 github.com/go-swagger/go-swagger v0.21.1-0.20200107003254-1c98855b472d github.com/gobuffalo/packr v1.24.1 // indirect + github.com/gobuffalo/pop/v5 v5.3.1 github.com/golang/protobuf v1.4.3 github.com/gorilla/sessions v1.1.3 github.com/gorilla/websocket v1.4.2 github.com/julienschmidt/httprouter v1.2.0 - github.com/markbates/pkger v0.17.0 + github.com/markbates/pkger v0.17.1 github.com/ory/cli v0.0.11 github.com/ory/go-acc v0.2.3 github.com/ory/graceful v0.1.1 github.com/ory/herodot v0.9.1 github.com/ory/jsonschema/v3 v3.0.1 github.com/ory/viper v1.7.5 - github.com/ory/x v0.0.154 + github.com/ory/x v0.0.165 github.com/pkg/errors v0.9.1 github.com/rs/cors v1.6.0 github.com/rubenv/sql-migrate v0.0.0-20190327083759-54bad0a9b051 // indirect @@ -38,6 +40,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/tidwall/gjson v1.6.0 github.com/tidwall/sjson v1.1.1 // indirect + github.com/uber/jaeger-lib v2.4.0+incompatible // indirect go.mongodb.org/mongo-driver v1.3.4 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6 diff --git a/go.sum b/go.sum index 46d723b75..5a38bc351 100644 --- a/go.sum +++ b/go.sum @@ -21,13 +21,13 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v4.0.0+incompatible h1:Dq8Dr+4sV1gBO1sHDWdW+4G+PdsA+YSJOK925MxrrCY= github.com/DataDog/datadog-go v4.0.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7 h1:qELHH0AWCvf98Yf+CNIJx9vOZOfHFDDzgDRYsnNk/vs= github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60= +github.com/HdrHistogram/hdrhistogram-go v1.0.1 h1:GX8GAYDuhlFQnI2fRDHQhTlkHMz8bEn0jTI6LJU0mpw= +github.com/HdrHistogram/hdrhistogram-go v1.0.1/go.mod h1:BWJ+nMSHY3L41Zj7CA3uXnloDp7xxV0YvstAE7nKTaM= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.0.3 h1:znjIyLfpXEDQjOIEWh+ehwpTU14UzUPub3c3sm36u14= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -52,6 +52,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= @@ -60,7 +62,6 @@ github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 h1:4daAzAu0 github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/aws/aws-sdk-go v1.23.19/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-xray-sdk-go v0.9.4/go.mod h1:XtMKdBQfpVut+tJEwI7+dJFRxxRdxHDyVNp2tHXRq04= -github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w= github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -68,11 +69,10 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1U github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmatcuk/doublestar/v2 v2.0.3/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQmTZRptLie8RgRw= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bufbuild/buf v0.31.1 h1:IbOhb3xaDR6/dZpbonOBi+9XZYlWD6RIrHMd6aLRjK8= github.com/bufbuild/buf v0.31.1/go.mod h1:/r1xLhsU+T6zm5sp7ydjKfXIFJ0MD89rQ3bB/EUrI4o= -github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY= github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -88,15 +88,11 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= -github.com/cockroachdb/cockroach-go v0.0.0-20200312223839-f565e4789405 h1:i1XXyBMAGL7NqogtoS6NHQ/IJwCbG0R725hAhEhldOI= github.com/cockroachdb/cockroach-go v0.0.0-20200312223839-f565e4789405/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= -github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882bXEDKfWIf0wa8HRvpnBoPszJJXL+TVbBw4M= github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200107194136-26c1120b8d41 h1:kIFnQBO7rQ0XkMe6xEwbybYHBEaWmh/f++laI6Emt7M= github.com/containerd/continuity v0.0.0-20200107194136-26c1120b8d41/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c h1:8ahmSVELW1wghbjerVAyuEYD5+Dio66RYvSS0iGfL1M= github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= @@ -115,6 +111,9 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cucumber/godog v0.8.1 h1:lVb+X41I4YDreE+ibZ50bdXmySxgRviYFgKY6Aw4XE8= +github.com/cucumber/godog v0.8.1/go.mod h1:vSh3r/lM+psC1BPXvdkSEuNjmXfpVqrMGYAElF6hxnA= 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= @@ -137,6 +136,10 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/elastic/go-sysinfo v1.1.1 h1:ZVlaLDyhVkDfjwPGU55CQRCRolNpc7P0BbyhhQZQmMI= +github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= +github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY= +github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= github.com/elazarl/goproxy v0.0.0-20181003060214-f58a169a71a5/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -231,7 +234,6 @@ github.com/go-openapi/validate v0.19.3 h1:PAH/2DylwWcIU1s0Y7k3yNmeAgWOcKrNE2Q7Ww github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -277,6 +279,7 @@ github.com/gobuffalo/envy v1.6.15 h1:OsV5vOpHYUpP7ZLS6sem1y40/lNX1BZj+ynMiRi21lQ github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/envy v1.8.1 h1:RUr68liRvs0TS1D5qdW3mQv2SjAsu1QWMCx1tG4kDjs= github.com/gobuffalo/envy v1.8.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= github.com/gobuffalo/envy v1.9.0 h1:eZR0DuEgVLfeIb1zIKt3bT4YovIMf9O9LXQeCZLXpqE= github.com/gobuffalo/envy v1.9.0/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= @@ -292,8 +295,9 @@ github.com/gobuffalo/events v1.1.9/go.mod h1:/0nf8lMtP5TkgNbzYxR6Bl4GzBy5s5TebgN github.com/gobuffalo/events v1.3.1/go.mod h1:9JOkQVoyRtailYVE/JJ2ZQ/6i4gTjM5t2HsZK4C1cSA= github.com/gobuffalo/events v1.4.1/go.mod h1:SjXgWKpeSuvQDvGhgMz5IXx3Czu+IbL+XPLR41NvVQY= github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= -github.com/gobuffalo/fizz v1.9.8 h1:K0uXVQ/hF1NaETpW++bTvK4A+42GCioKzpvdtSfkiRM= github.com/gobuffalo/fizz v1.9.8/go.mod h1:w1FEn1yKNVCc49KnADGyYGRPH7jFON3ak4Bj1yUudHo= +github.com/gobuffalo/fizz v1.10.0 h1:I8vad0PnmR+CLjSnZ5L5jlhBm4S88UIGOoZZL3/3e24= +github.com/gobuffalo/fizz v1.10.0/go.mod h1:J2XGPO0AfJ1zKw7+2BA+6FEGAkyEsdCOLvN93WCT2WI= github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= github.com/gobuffalo/flect v0.0.0-20181007231023-ae7ed6bfe683/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= @@ -407,6 +411,7 @@ github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130/go.mod h1:Jv github.com/gobuffalo/mw-i18n v0.0.0-20180802152014-e3060b7e13d6/go.mod h1:91AQfukc52A6hdfIfkxzyr+kpVYDodgAeT5cjX1UIj4= github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e/go.mod h1:6OJr6VwSzgJMqWMj7TYmRUqzNe2LXu/W1rRW4MAz/ME= github.com/gobuffalo/mw-tokenauth v0.0.0-20181001105134-8545f626c189/go.mod h1:UqBF00IfKvd39ni5+yI5MLMjAf4gX7cDKN/26zDOD6c= +github.com/gobuffalo/nulls v0.2.0 h1:7R0Uec6JlZI02TR29zrs3KFIuUV8Sqe/s/j3yLvs+gc= github.com/gobuffalo/nulls v0.2.0/go.mod h1:w4q8RoSCEt87Q0K0sRIZWYeIxkxog5mh3eN3C/n+dUc= github.com/gobuffalo/nulls v0.3.0 h1:yfOsQarm6pD7Crg/VnpI9Odh5nBlO+eDeKRiHYZOsTA= github.com/gobuffalo/nulls v0.3.0/go.mod h1:UP49vd/k+bcaz6m0cHMyuk8oQ7XgLnkfxeiVoPAvBSs= @@ -451,8 +456,9 @@ github.com/gobuffalo/packr/v2 v2.0.10/go.mod h1:n90ZuXIc2KN2vFAOQascnPItp9A2g9QY github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/packr/v2 v2.4.0/go.mod h1:ra341gygw9/61nSjAbfwcwh8IrYL4WmR4IsPkPBhQiY= github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08= -github.com/gobuffalo/packr/v2 v2.7.1 h1:n3CIW5T17T8v4GGK5sWXLVWJhCz7b5aNLSxW6gYim4o= github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= +github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zNVIY= +github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g= github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= @@ -460,10 +466,12 @@ github.com/gobuffalo/plush v3.7.22+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5s github.com/gobuffalo/plush v3.7.23+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.30+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.31+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.32+incompatible h1:sxY0WMa6J1pMuomTUQ8n2TlR3otiCVZaq21gSrHLScU= github.com/gobuffalo/plush v3.7.32+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.8.2+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.8.3+incompatible h1:kzvUTnFPhwyfPEsx7U7LI05/IIslZVGnAlMA1heWub8= github.com/gobuffalo/plush v3.8.3+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush/v4 v4.0.0 h1:ZHdmfr2R7DQ77XzWZK2PGKJOXm9NRy21EZ6Rw7FhuNw= github.com/gobuffalo/plush/v4 v4.0.0/go.mod h1:ErFS3UxKqEb8fpFJT7lYErfN/Nw6vHGiDMTjxpk5bQ0= github.com/gobuffalo/plushgen v0.0.0-20181128164830-d29dcb966cb2/go.mod h1:r9QwptTFnuvSaSRjpSp4S2/4e2D3tJhARYbvEBcKSb4= github.com/gobuffalo/plushgen v0.0.0-20181203163832-9fc4964505c2/go.mod h1:opEdT33AA2HdrIwK1aibqnTJDVVKXC02Bar/GT1YRVs= @@ -472,11 +480,13 @@ github.com/gobuffalo/plushgen v0.0.0-20190104222512-177cd2b872b3/go.mod h1:tYxCo github.com/gobuffalo/plushgen v0.1.2/go.mod h1:3U71v6HWZpVER1nInTXeAwdoRNsRd4W8aeIa1Lyp+Bk= github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= github.com/gobuffalo/pop v4.8.3+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.4+incompatible h1:5v15ZgICK3MFTU90QRqCaqDUf4wcriIbws1hqpYL2Xo= github.com/gobuffalo/pop v4.8.4+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= github.com/gobuffalo/pop v4.13.1+incompatible h1:AhbqPxNOBN/DBb2DBaiBqzOXIBQXxEYzngHHJ+ytP4g= github.com/gobuffalo/pop v4.13.1+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= -github.com/gobuffalo/pop/v5 v5.0.11 h1:BzSFbylk6+w2pEj+8yFHPxsShiJvg6ZV8rcAPNVdmtw= github.com/gobuffalo/pop/v5 v5.0.11/go.mod h1:mZJHJbA3cy2V18abXYuVop2ldEJ8UZ2DK6qOekC5u5g= +github.com/gobuffalo/pop/v5 v5.3.1 h1:dJbBPy6e0G0VRjn28md3fk16wpYIBv5iYVQWd0eqmkQ= +github.com/gobuffalo/pop/v5 v5.3.1/go.mod h1:vcEDhh6cJ3WVENqJDFt/6z7zNb7lLnlN8vj3n5G9rYA= github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= github.com/gobuffalo/release v1.0.42/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= @@ -498,6 +508,7 @@ github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY9 github.com/gobuffalo/syncx v0.1.0/go.mod h1:Mg/s+5pv7IgxEp6sA+NFpqS4o2x+R9dQNwbwT0iuOGQ= github.com/gobuffalo/tags v2.0.11+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= github.com/gobuffalo/tags v2.0.14+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/tags v2.0.15+incompatible h1:qc5hMXPsXD+zYPSlNgqzlpVW7z/+GJEVCqn245BEUIY= github.com/gobuffalo/tags v2.0.15+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= github.com/gobuffalo/tags v2.1.0+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= github.com/gobuffalo/tags v2.1.7+incompatible h1:GUxxh34f9SI4U0Pj3ZqvopO9SlzuqSf+g4ZGSPSszt4= @@ -508,10 +519,12 @@ github.com/gobuffalo/tags/v3 v3.1.0/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajv github.com/gobuffalo/uuid v2.0.3+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= github.com/gobuffalo/uuid v2.0.4+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/validate v2.0.3+incompatible h1:6f4JCEz11Zi6iIlexMv7Jz10RBPvgI795AOaubtCwTE= github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= github.com/gobuffalo/validate v2.0.4+incompatible h1:ZTxozrIw8qQ5nfhShmc4izjYPTsPhfdXTdhXOd5OS9o= github.com/gobuffalo/validate v2.0.4+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= +github.com/gobuffalo/validate/v3 v3.1.0 h1:/QQN920PciCfBs3aywtJTvDTHmBFMKoiwkshUWa/HLQ= github.com/gobuffalo/validate/v3 v3.1.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= github.com/gobuffalo/validate/v3 v3.2.0 h1:Zrpkz2kuZ4rGXLaO3IHVlwX512/cUWRvNjw46Cjhz2Q= github.com/gobuffalo/validate/v3 v3.2.0/go.mod h1:PrhDOdDHxtN8KUgMvF3TDL0r1YZXV4sQnyFX/EmeETY= @@ -576,9 +589,10 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/go-jsonnet v0.16.0/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -618,6 +632,7 @@ github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gotestyourself/gotestyourself v1.3.0 h1:9X3T0HDKAY/58/sEPpTkmyOg4wbb1ab9tZfV44mTSeE= github.com/gotestyourself/gotestyourself v1.3.0/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= @@ -661,10 +676,11 @@ github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80s github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.3.2 h1:9UIGICxEAW70RQDGilGwsCG63NCcm5amjuBQCFzrmsw= github.com/jackc/pgconn v1.3.2/go.mod h1:LvCquS3HbBKwgl7KbX9KyqEIumJAbm1UMcTvGaIf3bM= github.com/jackc/pgconn v1.5.0 h1:oFSOilzIZkyg787M1fEmyMfOUUvwj0daqYMfaWwNL4o= github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.6.0 h1:8FiBxMxS/Z0eQ9BeE1HhL6pzPL1R5x+ZuQ+T86WgZ4I= +github.com/jackc/pgconn v1.6.0/go.mod h1:yeseQo4xhQbgyJs2c87RAXOH2i624N0Fh1KSPJya7qo= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= @@ -679,13 +695,16 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.1 h1:Rdjp4NFjwHnEslx2b66FfCI2S0LhO4itac3hXz6WX9M= github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= +github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.2.0 h1:JuOJqN8dtahBO+jqvtAdMiY32NI5obiZRWa+C17Vd4s= github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= +github.com/jackc/pgtype v1.3.0 h1:l8JvKrby3RI7Kg3bYEeU9TA4vqC38QDpFCfcrC7KuN0= +github.com/jackc/pgtype v1.3.0/go.mod h1:b0JqxHvPmljG+HQ5IsvQ0yqeSi4nGcDTVjFoiLDb0Ik= github.com/jackc/pgx v3.2.0+incompatible h1:0Vihzu20St42/UDsvZGdNE6jak7oi/UOeMzwMPHkgFY= github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jackc/pgx v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o= @@ -693,8 +712,9 @@ github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGk github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.4.1 h1:OBZhZFlzBMC9yUD6wAFzlFFuxfZTV+YvloSPO1k+puA= github.com/jackc/pgx/v4 v4.4.1/go.mod h1:6iSW+JznC0YT+SgBn7rNxoEBsBgSmnC5FwyCekOGUiE= +github.com/jackc/pgx/v4 v4.6.0 h1:Fh0O9GdlG4gYpjpwOqjdEodJUQM9jzN3Hdv7PN0xmm0= +github.com/jackc/pgx/v4 v4.6.0/go.mod h1:vPh43ZzxijXUVJ+t/EmXBtFmbFVO72cuneCT9oAlxAg= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -707,6 +727,8 @@ github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0 h1:5B0uxl2lzNRVkJVg+u github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= +github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak= github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= @@ -727,7 +749,10 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/karrick/godirwalk v1.10.9/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/karrick/godirwalk v1.15.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/karrick/godirwalk v1.15.5/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= +github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/go-bindata v3.16.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM= @@ -757,6 +782,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -766,8 +793,11 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/luna-duclos/instrumentedsql v0.0.0-20181127104832-b7d587d28109/go.mod h1:PWUIzhtavmOR965zfawVsHXbEuU1G29BPZ/CB3C7jXk= -github.com/luna-duclos/instrumentedsql v1.1.2 h1:AZdd9TU/kFArfxF0Wi8PLNzniBUgo/c1vDhhjwZPANE= github.com/luna-duclos/instrumentedsql v1.1.2/go.mod h1:4LGbEqDnopzNAiyxPPDXhLspyunZxgPTMJBKtC6U0BQ= +github.com/luna-duclos/instrumentedsql v1.1.3 h1:t7mvC0z1jUt5A0UQ6I/0H31ryymuQRnJcWCiqV3lSAA= +github.com/luna-duclos/instrumentedsql v1.1.3/go.mod h1:9J1njvFds+zN7y85EDhN9XNQLANWwZt2ULeIC8yMNYs= +github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4 h1:b8Uu5JfweuhcXIqANFs9dOw5zanFj89GYOGlyys37ds= +github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4/go.mod h1:YnZVBK+MxEr2sn1rbf4UMqsBd0uKaCOq52UtmbfDKNM= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -782,6 +812,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= github.com/markbates/deplist v1.1.3/go.mod h1:BF7ioVzAJYEtzQN/os4rt8H8Ti3h0T7EoN+7eyALktE= +github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= +github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= github.com/markbates/grift v1.0.4/go.mod h1:wbmtW74veyx+cgfwFhlnnMWqhoz55rnHR47oMXzsyVs= github.com/markbates/hmax v1.0.0 h1:yo2N0gBoCnUMKhV/VRLHomT6Y9wUm+oQQENuWJqCdlM= @@ -796,9 +828,12 @@ github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4 h1:Mlji5gkcpzkqTRO github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 h1:JgVTCPf0uBVcUSWpyXmGpgOc62nK5HWUBKAGc3Qqa5k= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= github.com/markbates/pkger v0.17.0 h1:RFfyBPufP2V6cddUyyEVSHBpaAnM1WzaMNyqomeT+iY= github.com/markbates/pkger v0.17.0/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= +github.com/markbates/pkger v0.17.1 h1:/MKEtWqtc0mZvu9OinB9UzVN9iYCwLWuyUv4Bw+PCno= +github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/markbates/refresh v1.4.10/go.mod h1:NDPHvotuZmTmesXxr95C9bjlw1/0frJwtME2dzcVKhc= github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= @@ -808,6 +843,7 @@ github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGf github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -817,13 +853,13 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= @@ -845,7 +881,6 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg= github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -857,6 +892,8 @@ github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJ github.com/moul/http2curl v0.0.0-20170919181001-9ac6cf4d929b/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +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/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oleiade/reflections v1.0.0/go.mod h1:RbATFBbKYkVdqmSFtx13Bb/tVhR0lgOBXunWTZKeL4w= @@ -905,19 +942,14 @@ github.com/ory/go-acc v0.0.0-20181118080137-ddc355013f90 h1:Bpk3eqc3rbJT2mE+uS9E github.com/ory/go-acc v0.0.0-20181118080137-ddc355013f90/go.mod h1:sxnvPCxChFuSmTJGj8FdMupeq1BezCiEpDjTUXQ4hf4= github.com/ory/go-acc v0.2.3 h1:RcMhQwLuC60V26CTu19wGKhj6bVaTyG+nQH/Y/oaFfk= github.com/ory/go-acc v0.2.3/go.mod h1:4Kb/UnPcT8qRAk3IAxta+hvVapdxTLWtrr7bFLlEgpw= -github.com/ory/go-convenience v0.1.0 h1:zouLKfF2GoSGnJwGq+PE/nJAE6dj2Zj5QlTgmMTsTS8= github.com/ory/go-convenience v0.1.0/go.mod h1:uEY/a60PL5c12nYz4V5cHY03IBmwIAEm8TWB0yn9KNs= github.com/ory/gochimp3 v0.0.0-20200417124117-ccd242db3655 h1:H/zV2+eEGc4KZC4c2zYobnm3MRfuxJS+QQZQGsjJjsE= github.com/ory/gochimp3 v0.0.0-20200417124117-ccd242db3655/go.mod h1:UkHph/q1UfWxoWtS2mT8Hb4PrCHJxjTdBjT9RkJoMnk= -github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8 h1:e2S2FmxqSbhFyVNP24HncpRY+X1qAZmtE3nZ0gJKR4Q= github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8/go.mod h1:wsH1C4nIeeQClDtD5AH7kF1uTS6zWyqfjVDTmB0Em7A= -github.com/ory/gojsonschema v1.1.1-0.20190919112458-f254ca73d5e9 h1:LDIG2Mnha10nFZuVXv3GIBqhQ1+JLwRXPcP4Ykx5VOY= github.com/ory/gojsonschema v1.1.1-0.20190919112458-f254ca73d5e9/go.mod h1:BNZpdJgB74KOLSsWFvzw6roXg1I6O51WO8roMmW+T7Y= github.com/ory/graceful v0.1.1 h1:zx+8tDObLPrG+7Tc8jKYlXsqWnLtOQA1IZ/FAAKHMXU= github.com/ory/graceful v0.1.1/go.mod h1:zqu70l95WrKHF4AZ6tXHvAqAvpY6M7g6ttaAVcMm7KU= -github.com/ory/herodot v0.6.2 h1:zOb5MsuMn7AH9/Ewc/EK83yqcNViK1m1l3C2UuP3RcA= github.com/ory/herodot v0.6.2/go.mod h1:3BOneqcyBsVybCPAJoi92KN2BpJHcmDqAMcAAaJiJow= -github.com/ory/herodot v0.7.0 h1:DGPUyPDBZwQSaQzci4UW/edjG6OWixZTwXyfjBgEVgs= github.com/ory/herodot v0.7.0/go.mod h1:YXKOfAXYdQojDP5sD8m0ajowq3+QXNdtxA+QiUXBwn0= github.com/ory/herodot v0.8.3 h1:lNsrWg0qrsf7vYEDBjKJ8DlCypw87rkjqukp22xnl14= github.com/ory/herodot v0.8.3/go.mod h1:rvLjxOAlU5omtmgjCfazQX2N82EpMfl3BytBWc1jjsk= @@ -925,21 +957,17 @@ github.com/ory/herodot v0.9.1 h1:GkyXUfAN4oyW6jTE4FgJkpPTBr1FTN0zx/cet6IsJMI= github.com/ory/herodot v0.9.1/go.mod h1:GYF7mp8/WFRYDYJBR989lipjgx3NTjjdVdUC+hpB8mc= github.com/ory/jsonschema/v3 v3.0.1 h1:xzV7w2rt/Qn+jvh71joIXNKKOCqqNyTlaIxdxU0IQJc= github.com/ory/jsonschema/v3 v3.0.1/go.mod h1:jgLHekkFk0uiGdEWGleC+tOm6JSSP8cbf17PnBuGXlw= -github.com/ory/viper v1.5.6 h1:w4ceGgWwWLzAFYQ7bHaDZmwNsAto2JPVdyQjQnn7VWI= github.com/ory/viper v1.5.6/go.mod h1:TYmpFpKLxjQwvT4f0QPpkOn4sDXU1kDgAwJpgLYiQ28= -github.com/ory/viper v1.7.4 h1:3RWBt7Pq9kSFNxLaRT0ljNdbtaWisCQG1cLPn2Yd4UY= github.com/ory/viper v1.7.4/go.mod h1:T6sodNZKNGPpashUOk7EtXz2isovz8oCd57GNVkkNmE= github.com/ory/viper v1.7.5 h1:+xVdq7SU3e1vNaCsk/ixsfxE4zylk1TJUiJrY647jUE= github.com/ory/viper v1.7.5/go.mod h1:ypOuyJmEUb3oENywQZRgeAMwqgOyDqwboO1tj3DjTaM= github.com/ory/x v0.0.84/go.mod h1:RXLPBG7B+hAViONVg0sHwK+U/ie1Y/NeXrq1JcARfoE= -github.com/ory/x v0.0.93 h1:lZG4tjrkJ8cxI85463kD7Cq8h1YxZcPVzCkFcu2WXXI= github.com/ory/x v0.0.93/go.mod h1:lfcTaGXpTZs7IEQAW00r9EtTCOxD//SiP5uWtNiz31g= github.com/ory/x v0.0.110/go.mod h1:DJfkE3GdakhshNhw4zlKoRaL/ozg/lcTahA9OCih2BE= github.com/ory/x v0.0.127/go.mod h1:FwUujfFuCj5d+xgLn4fGMYPnzriR5bdAIulFXMtnK0M= -github.com/ory/x v0.0.128 h1:sArBGCH5s+0Zv0jD+t639Vy22URAD6XskBnD9r0+ESk= github.com/ory/x v0.0.128/go.mod h1:ykx1XOsl9taQtoW2yNvuxl/feEfTfrZTcbY1U7841tI= -github.com/ory/x v0.0.154 h1:yq8ShPqoUBSjwPsEgGV9C09Loj5v0gJ4fNRacflyVmQ= -github.com/ory/x v0.0.154/go.mod h1:0gChD0a8jhUSuiCavAjcbdQxOe0PHFHlMHey2YXpQC4= +github.com/ory/x v0.0.165 h1:PdLzbWj95+1hIkclBVeOchzIv3n/wSYJqRHQeEWueWA= +github.com/ory/x v0.0.165/go.mod h1:OmHWAMal8+FhNJgDh1KkN8ik24ubjPSJQNdnTj6tzCQ= github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= @@ -948,7 +976,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= -github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= @@ -978,7 +1005,10 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -1009,11 +1039,9 @@ github.com/santhosh-tekuri/jsonschema/v2 v2.1.0 h1:7KOtBzox6l1PbyZCuQfo923yIBpoM github.com/santhosh-tekuri/jsonschema/v2 v2.1.0/go.mod h1:yzJzKUGV4RbWqWIBBP4wSOBqavX5saE02yirLS0OTyg= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/analytics-go v3.0.1+incompatible h1:W7T3ieNQjPFMb+SE8SAVYo6mPkKK/Y37wYdiNf5lCVg= github.com/segmentio/analytics-go v3.0.1+incompatible/go.mod h1:C7CYBtQWk4vRk2RyLu0qOcbHJ18E3F1HV2C/8JvKN48= github.com/segmentio/analytics-go v3.1.0+incompatible h1:IyiOfUgQFVHvsykKKbdI7ZsH374uv3/DfZUo9+G0Z80= github.com/segmentio/analytics-go v3.1.0+incompatible/go.mod h1:C7CYBtQWk4vRk2RyLu0qOcbHJ18E3F1HV2C/8JvKN48= -github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c h1:rsRTAcCR5CeNLkvgBVSjQoDGRRt6kggsE6XYBqCv2KQ= github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c/go.mod h1:kJ9mm9YmoWSkk+oQ+5Cj8DEoRCX2JT6As4kEtIIOp1M= github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 h1:ZuhckGJ10ulaKkdvJtiAqsLTiPrLaXSdnVgXJKJkTxE= github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc= @@ -1078,6 +1106,7 @@ github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU 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 v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v0.0.7/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= @@ -1096,7 +1125,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.2.1 h1:bIcUwXqLseLF3BDAZduuNfekWG87ibtFxi59Bq+oI9M= github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= @@ -1140,16 +1168,14 @@ github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ= github.com/toqueteos/webbrowser v1.2.0/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM= -github.com/uber-go/atomic v1.3.2 h1:Azu9lPBWRNKzYXSIwRfgRuDuS0YKsK4NFhiQv98gkxo= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= -github.com/uber/jaeger-client-go v2.15.0+incompatible h1:NP3qsSqNxh8VYr956ur1N/1C1PjvOJnJykCzcD5QHbk= github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM= github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo= github.com/uber/jaeger-lib v1.5.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw= github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ= +github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= @@ -1158,7 +1184,6 @@ github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -1169,6 +1194,14 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= +go.elastic.co/apm v1.8.0 h1:AWEKpHwRal0yCMd4K8Oxy1HAa7xid+xq1yy+XjgoVU0= +go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0= +go.elastic.co/apm/module/apmhttp v1.8.0 h1:5AJPefWJzWDLX/47XIDfaloGiYWkkOQEULvlrI6Ieaw= +go.elastic.co/apm/module/apmhttp v1.8.0/go.mod h1:9LPFlEON51/lRbnWDfqAWErihIiAFDUMfMV27YjoWQ8= +go.elastic.co/apm/module/apmot v1.8.0 h1:7r8b5RGDN5gAUG7FoegzJ24+jFSZF7FvY2ODODaKFYk= +go.elastic.co/apm/module/apmot v1.8.0/go.mod h1:Q5Xzabte8G/fkvDjr1jlDuOSUt9hkVWNZEHh6ZNaTjI= +go.elastic.co/fastjson v1.0.0 h1:ooXV/ABvf+tBul26jcVViPT3sBir0PvXgibYB1IQQzg= +go.elastic.co/fastjson v1.0.0/go.mod h1:PmeUOMMtLHQr9ZS9J9owrAVg0FkaZDRZJEFTTGHtchs= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1 h1:Sq1fR+0c58RME5EoqKdjkiQAmPjmfHlZOoRI6fTUOcs= @@ -1180,12 +1213,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/otel v0.6.0 h1:+vkHm/XwJ7ekpISV2Ixew93gCrxTbuwTF5rSewnLLgw= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.13.0 h1:T6W6DcsRSLxMCv2J96fAkHaKu+V3tW/8vXdPNe/1B1A= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.13.0/go.mod h1:TwTkyRaTam1pOIb2wxcAiC2hkMVbokXkt6DEt5nDkD8= go.opentelemetry.io/otel v0.6.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek= +go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= +go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.1 h1:rsqfU5vBkVknbhUGbAUwQKR2H4ItV8tjJ+6kJX4cxHM= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= @@ -1239,7 +1274,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200320181102-891825fb96df h1:lDWgvUvNnaTnNBc/dwOty86cFeKoKWbwy2wQj0gIxbU= golang.org/x/crypto v0.0.0-20200320181102-891825fb96df/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 h1:3zb4D3T4G8jdExgVU/95+vQXfpEPiMdCaZgmGVxjNHM= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1266,7 +1300,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367 h1:0IiAsCRByjO2QjX7ZPkw5oU9x+n1YqRL802rjC0c3Aw= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -1310,21 +1343,19 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200219183655-46282727080f/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced h1:4oqSq7eft7MdPKBGQK11X9WYUxmj6ZLgGTqYIbY1kyw= golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -1340,7 +1371,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1389,12 +1419,12 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03 h1:b3JiLYVaG9kHjTcOQIoUh978YMCO7oVTQQBLudU47zY= golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd h1:3x5uuvBgE6oaXJjCOvpCC1IpgJogqQ+PqGGU3ZxAgII= golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200121082415-34d275377bf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1481,6 +1511,7 @@ golang.org/x/tools v0.0.0-20191224055732-dd894d0a8a40/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200203215610-ab391d50b528/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6 h1:nULzSsKgihxFGLnQFv2T7lE5vIhOtg8ZPpJHapEt7o0= golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -1541,7 +1572,6 @@ google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.0 h1:IBKSUNL2uBS2DkJBncPP+TwT0sp9tgA8A75NjHt6umg= google.golang.org/grpc v1.33.0/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= @@ -1571,6 +1601,8 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= @@ -1582,7 +1614,6 @@ gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.55.0 h1:E8yzL5unfpW3M6fz/eB7Cb5MQAYSZ7GKo4Qth+N2sgQ= gopkg.in/ini.v1 v1.55.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww= gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1618,6 +1649,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= +howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= diff --git a/internal/check/engine_test.go b/internal/check/engine_test.go index 585338c6d..4c3274399 100644 --- a/internal/check/engine_test.go +++ b/internal/check/engine_test.go @@ -16,6 +16,15 @@ import ( "github.com/ory/keto/internal/driver" ) +func newReg(t *testing.T, namespaces ...*namespace.Namespace) driver.Registry { + reg := driver.NewMemoryTestDriver(t).Registry() + reg.NamespaceManager().SetNamespaces(t, namespaces...) + for _, n := range namespaces { + require.NoError(t, reg.NamespaceMigrator().MigrateNamespaceUp(context.Background(), n)) + } + return reg +} + func TestEngine(t *testing.T) { t.Run("direct inclusion", func(t *testing.T) { rel := relationtuple.InternalRelationTuple{ @@ -25,8 +34,7 @@ func TestEngine(t *testing.T) { Subject: &relationtuple.SubjectID{ID: "user"}, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: rel.Namespace})) + reg := newReg(t, &namespace.Namespace{Name: rel.Namespace, ID: 1}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &rel)) e := check.NewEngine(reg) @@ -60,8 +68,7 @@ func TestEngine(t *testing.T) { Subject: &mark, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: sofaNamespace})) + reg := newReg(t, &namespace.Namespace{Name: sofaNamespace, ID: 1}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &cleaningRelation, &markProducesDust)) e := check.NewEngine(reg) @@ -87,8 +94,7 @@ func TestEngine(t *testing.T) { Subject: user, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: rel.Namespace})) + reg := newReg(t, &namespace.Namespace{Name: rel.Namespace, ID: 10}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &rel)) e := check.NewEngine(reg) @@ -119,8 +125,7 @@ func TestEngine(t *testing.T) { Subject: &relationtuple.SubjectID{ID: "user"}, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: ""})) + reg := newReg(t, &namespace.Namespace{Name: "", ID: 1}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &access, &user)) e := check.NewEngine(reg) @@ -155,8 +160,7 @@ func TestEngine(t *testing.T) { Subject: &relationtuple.SubjectID{ID: "your mother"}, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: diaryNamespace})) + reg := newReg(t, &namespace.Namespace{Name: diaryNamespace, ID: 1}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &readDiary, &user)) e := check.NewEngine(reg) @@ -210,9 +214,7 @@ func TestEngine(t *testing.T) { Subject: &user, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: someNamespace, ID: 0})) - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: orgNamespace, ID: 1})) + reg := newReg(t, &namespace.Namespace{Name: someNamespace, ID: 0}, &namespace.Namespace{Name: orgNamespace, ID: 1}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &writeRel, &orgOwnerRel, &userMembershipRel)) e := check.NewEngine(reg) @@ -262,8 +264,7 @@ func TestEngine(t *testing.T) { Subject: &user, } - reg := &driver.RegistryDefault{} - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: ""})) + reg := newReg(t, &namespace.Namespace{Name: "", ID: 2}) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &parent, &directoryAccess)) e := check.NewEngine(reg) diff --git a/internal/driver/configuration/provider.go b/internal/driver/configuration/provider.go index 06aa3c6ae..17166b959 100644 --- a/internal/driver/configuration/provider.go +++ b/internal/driver/configuration/provider.go @@ -10,6 +10,8 @@ import ( ) type Provider interface { + namespace.Manager + CORSEnabled() bool CORSOptions() cors.Options ListenOn() string diff --git a/internal/driver/configuration/provider_viper.go b/internal/driver/configuration/provider_viper.go index 12788ddbf..5680345be 100644 --- a/internal/driver/configuration/provider_viper.go +++ b/internal/driver/configuration/provider_viper.go @@ -1,10 +1,12 @@ package configuration import ( + "context" "fmt" "io/ioutil" "path/filepath" "strings" + "testing" "github.com/ghodss/yaml" @@ -28,7 +30,8 @@ const ( ) type ViperProvider struct { - l *logrusx.Logger + l *logrusx.Logger + namespaces []*namespace.Namespace } func NewViperProvider(l *logrusx.Logger) Provider { @@ -73,37 +76,55 @@ func (v *ViperProvider) TracingJaegerConfig() *tracing.JaegerConfig { } func (v *ViperProvider) Namespaces() []*namespace.Namespace { - namespaceDir := viperx.GetString(v.l, ViperKeyNamespacePath, "./keto-namespaces") + if v.namespaces == nil { + namespaceDir := viperx.GetString(v.l, ViperKeyNamespacePath, "./keto-namespaces") - infos, err := ioutil.ReadDir(namespaceDir) - if err != nil { - v.l.WithError(err).Errorf("Could no read namespace directory %s.", namespaceDir) - return nil - } + infos, err := ioutil.ReadDir(namespaceDir) + if err != nil { + v.l.WithError(err).Errorf("Could no read namespace directory %s.", namespaceDir) + return nil + } - var namespaces []*namespace.Namespace - for _, info := range infos { - fn := info.Name() + v.namespaces = make([]*namespace.Namespace, 0, len(infos)) + for _, info := range infos { + fn := info.Name() - if info.IsDir() || !(strings.HasSuffix(fn, ".yaml") || strings.HasSuffix(fn, ".yml") || strings.HasSuffix(fn, ".json")) { - v.l.Infof("Skipping file %s in namespace directory because it is not *.{yaml|yml|json}", fn) - continue - } + if info.IsDir() || !(strings.HasSuffix(fn, ".yaml") || strings.HasSuffix(fn, ".yml") || strings.HasSuffix(fn, ".json")) { + v.l.Infof("Skipping file %s in namespace directory because it is not *.{yaml|yml|json}", fn) + continue + } - fc, err := ioutil.ReadFile(filepath.Join(namespaceDir, fn)) - if err != nil { - v.l.WithError(err).Errorf("Could not read namespace file %s.", fn) - continue - } + fc, err := ioutil.ReadFile(filepath.Join(namespaceDir, fn)) + if err != nil { + v.l.WithError(err).Errorf("Could not read namespace file %s.", fn) + continue + } + + namesp := namespace.Namespace{} + if err := yaml.Unmarshal(fc, &namesp); err != nil { + v.l.WithError(err).Errorf("Could not unmarshal namespace file %s.", fn) + continue + } - namesp := namespace.Namespace{} - if err := yaml.Unmarshal(fc, &namesp); err != nil { - v.l.WithError(err).Errorf("Could not unmarshal namespace file %s.", fn) - continue + v.namespaces = append(v.namespaces, &namesp) } - namespaces = append(namespaces, &namesp) + return v.namespaces } - return namespaces + return v.namespaces +} + +func (v *ViperProvider) GetNamespace(_ context.Context, name string) (*namespace.Namespace, error) { + for _, n := range v.namespaces { + if n.Name == name { + return n, nil + } + } + + return nil, namespace.ErrNamespaceNotFound +} + +func (v *ViperProvider) SetNamespaces(_ *testing.T, namespaces ...*namespace.Namespace) { + v.namespaces = namespaces } diff --git a/internal/driver/configuration/provider_viper_test.go b/internal/driver/configuration/provider_viper_test.go index e700adf3a..e3c8fe455 100644 --- a/internal/driver/configuration/provider_viper_test.go +++ b/internal/driver/configuration/provider_viper_test.go @@ -51,7 +51,7 @@ id: 1 require.Len(t, hook.Entries, 0) - assert.Len(t, namespaces, 1) + require.Len(t, namespaces, 1) assert.Equal(t, &namespace.Namespace{ ID: 1, Name: "videos", @@ -73,7 +73,7 @@ id: 1 assert.Equal(t, logrus.InfoLevel, hook.Entries[0].Level) assert.Contains(t, hook.Entries[0].Message, "unsupported.file") - assert.Len(t, namespaces, 1) + require.Len(t, namespaces, 1) assert.Equal(t, &namespace.Namespace{ Name: "namespace name", ID: 2, @@ -91,7 +91,7 @@ id: 1 assert.Equal(t, logrus.ErrorLevel, hook.Entries[0].Level) assert.Contains(t, hook.Entries[0].Message, "malformed.yml") - assert.Len(t, namespaces, 1) + require.Len(t, namespaces, 1) assert.Equal(t, &namespace.Namespace{ Name: "some name", ID: 1, diff --git a/internal/driver/driver_default.go b/internal/driver/driver_default.go index a3a546d3c..078a5fb6e 100644 --- a/internal/driver/driver_default.go +++ b/internal/driver/driver_default.go @@ -1,7 +1,11 @@ package driver import ( + "testing" + + "github.com/ory/viper" "github.com/ory/x/logrusx" + "github.com/stretchr/testify/require" "github.com/ory/keto/internal/driver/configuration" ) @@ -32,6 +36,20 @@ func NewDefaultDriver(l *logrusx.Logger, version, build, date string) Driver { return &DefaultDriver{r: r, c: c} } +func NewMemoryTestDriver(t *testing.T) Driver { + l := logrusx.New("keto", "test") + + c := configuration.NewViperProvider(l) + viper.Set(configuration.ViperKeyDSN, configuration.DSNMemory) + + r, err := NewRegistry(c) + require.NoError(t, err) + + require.NoError(t, r.Init()) + + return &DefaultDriver{r: r, c: c} +} + func (r *DefaultDriver) Configuration() configuration.Provider { return r.c } diff --git a/internal/driver/registry.go b/internal/driver/registry.go index 602f918ed..5f35feda8 100644 --- a/internal/driver/registry.go +++ b/internal/driver/registry.go @@ -30,6 +30,7 @@ type Registry interface { relationtuple.ManagerProvider namespace.ManagerProvider + namespace.MigratorProvider expand.EngineProvider check.EngineProvider diff --git a/internal/driver/registry_default.go b/internal/driver/registry_default.go index 844c4638c..1eeaf5627 100644 --- a/internal/driver/registry_default.go +++ b/internal/driver/registry_default.go @@ -1,6 +1,11 @@ package driver import ( + "context" + + "github.com/pkg/errors" + + "github.com/gobuffalo/pop/v5" "github.com/ory/herodot" "github.com/ory/x/healthx" "github.com/ory/x/logrusx" @@ -9,13 +14,14 @@ import ( "github.com/ory/keto/internal/driver/configuration" "github.com/ory/keto/internal/namespace" + "github.com/ory/keto/internal/persistence/sql" + "github.com/ory/keto/internal/persistence" "github.com/ory/keto/internal/expand" "github.com/ory/keto/internal/check" - "github.com/ory/keto/internal/persistence/memory" "github.com/ory/keto/internal/relationtuple" "github.com/ory/keto/internal/x" ) @@ -26,45 +32,24 @@ var _ x.LoggerProvider = &RegistryDefault{} var _ Registry = &RegistryDefault{} type RegistryDefault struct { - p persistence.Persister - l *logrusx.Logger - w herodot.Writer - ce *check.Engine - ee *expand.Engine - c configuration.Provider + p persistence.Persister + l *logrusx.Logger + w herodot.Writer + ce *check.Engine + ee *expand.Engine + conn *pop.Connection + c configuration.Provider + hh *healthx.Handler + + version, hash, date string } func (r *RegistryDefault) CanHandle(dsn string) bool { - panic("implement me") + return true } func (r *RegistryDefault) Ping() error { - panic("implement me") -} - -func (r *RegistryDefault) Init() error { - namespaceConfigs := r.c.Namespaces() - for _, n := range namespaceConfigs { - s, err := r.NamespaceManager().NamespaceStatus(n) - - if err != nil { - if r.c.DSN() == configuration.DSNMemory { - // auto migrate on memory - if err := r.NamespaceManager().MigrateNamespaceUp(n); err != nil { - r.l.WithError(err).Errorf("Could not auto-migrate namespace %s.", n.Name) - } - continue - } - - r.l.Warnf("Namespace %s is defined in the config but not yet migrated. It is ignored until you explicitly migrate it.", n.Name) - - continue - } - - r.l.Infof("Namespace %s is migrated to version %d.", n.Name, s.CurrentVersion) - } - - return nil + return r.conn.Open() } func (r *RegistryDefault) WithConfig(c configuration.Provider) Registry { @@ -78,23 +63,28 @@ func (r *RegistryDefault) WithLogger(l *logrusx.Logger) Registry { } func (r *RegistryDefault) WithBuildInfo(version, hash, date string) Registry { + r.version, r.hash, r.date = version, hash, date return r } func (r *RegistryDefault) BuildVersion() string { - panic("implement me") + return r.version } func (r *RegistryDefault) BuildDate() string { - panic("implement me") + return r.date } func (r *RegistryDefault) BuildHash() string { - panic("implement me") + return r.hash } func (r *RegistryDefault) HealthHandler() *healthx.Handler { - panic("implement me") + if r.hh == nil { + r.hh = healthx.NewHandler(r.Writer(), r.version, healthx.ReadyCheckers{}) + } + + return r.hh } func (r *RegistryDefault) Tracer() *tracing.Tracer { @@ -116,19 +106,17 @@ func (r *RegistryDefault) Writer() herodot.Writer { } func (r *RegistryDefault) RelationTupleManager() relationtuple.Manager { - if r.p == nil { - r.p = memory.NewPersister() - } return r.p } -func (r *RegistryDefault) NamespaceManager() namespace.Manager { - if r.p == nil { - r.p = memory.NewPersister() - } +func (r *RegistryDefault) NamespaceMigrator() namespace.Migrator { return r.p } +func (r *RegistryDefault) NamespaceManager() namespace.Manager { + return r.c +} + func (r *RegistryDefault) PermissionEngine() *check.Engine { if r.ce == nil { r.ce = check.NewEngine(r) @@ -142,3 +130,61 @@ func (r *RegistryDefault) ExpandEngine() *expand.Engine { } return r.ee } + +func (r *RegistryDefault) Persister() persistence.Persister { + return r.p +} + +func (r *RegistryDefault) Migrator() (persistence.Migrator, error) { + return r.p.(persistence.Migrator), nil +} + +func (r *RegistryDefault) Init() error { + c, err := pop.NewConnection(&pop.ConnectionDetails{ + URL: "sqlite://:memory:?_fk=true", + }) + if err != nil { + return errors.WithStack(err) + } + + r.conn = c + if err := c.Open(); err != nil { + return errors.WithStack(err) + } + + r.p, err = sql.NewPersister(r.conn, r.Logger(), r.c) + if err != nil { + return err + } + + m, err := r.Migrator() + if err != nil { + return err + } + if err := m.MigrateUp(context.Background()); err != nil { + return err + } + + namespaceConfigs := r.c.Namespaces() + for _, n := range namespaceConfigs { + s, err := r.NamespaceMigrator().NamespaceStatus(context.Background(), n.ID) + if err != nil { + if r.c.DSN() == configuration.DSNMemory { + // auto migrate when DSN is memory + if err := r.NamespaceMigrator().MigrateNamespaceUp(context.Background(), n); err != nil { + r.l.WithError(err).Errorf("Could not auto-migrate namespace %s.", n.Name) + } + continue + } + + r.l.Warnf("Namespace %s is defined in the config but not yet migrated. It is ignored until you explicitly migrate it.", n.Name) + continue + } + + if s.CurrentVersion != s.NextVersion { + r.l.Warnf("Namespace %s is not migrated to the latest version, it will be ignored until you explicitly migrate it.", n.Name) + } + } + + return nil +} diff --git a/internal/expand/engine_test.go b/internal/expand/engine_test.go index 0de06d940..ed35e3657 100644 --- a/internal/expand/engine_test.go +++ b/internal/expand/engine_test.go @@ -16,8 +16,14 @@ import ( "github.com/ory/keto/internal/driver" ) -func newTestEngine(_ *testing.T) (*driver.RegistryDefault, *expand.Engine) { - reg := &driver.RegistryDefault{} +func newTestEngine(t *testing.T, namespaces ...*namespace.Namespace) (driver.Registry, *expand.Engine) { + reg := driver.NewMemoryTestDriver(t).Registry() + reg.NamespaceManager().SetNamespaces(t, namespaces...) + + for _, n := range namespaces { + require.NoError(t, reg.NamespaceMigrator().MigrateNamespaceUp(context.Background(), n)) + } + e := expand.NewEngine(reg) return reg, e } @@ -55,9 +61,8 @@ func TestEngine(t *testing.T) { Subject: paul, }, } - reg, e := newTestEngine(t) + reg, e := newTestEngine(t, &namespace.Namespace{Name: ""}) - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: ""})) require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), boulderers...)) tree, err := e.BuildTree(context.Background(), bouldererUserSet, 100) @@ -79,7 +84,6 @@ func TestEngine(t *testing.T) { }) t.Run("case=expands two levels", func(t *testing.T) { - reg, e := newTestEngine(t) expectedTree := &expand.Tree{ Type: expand.Union, Subject: &relationtuple.SubjectSet{ @@ -132,7 +136,7 @@ func TestEngine(t *testing.T) { }, } - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: ""})) + reg, e := newTestEngine(t, &namespace.Namespace{Name: ""}) for _, group := range expectedTree.Children { require.NoError(t, reg.RelationTupleManager().WriteRelationTuples(context.Background(), &relationtuple.InternalRelationTuple{ @@ -159,8 +163,7 @@ func TestEngine(t *testing.T) { }) t.Run("case=respects max depth", func(t *testing.T) { - reg, e := newTestEngine(t) - require.NoError(t, reg.NamespaceManager().MigrateNamespaceUp(&namespace.Namespace{Name: ""})) + reg, e := newTestEngine(t, &namespace.Namespace{Name: ""}) root := "root" prev := root diff --git a/internal/namespace/definitons.go b/internal/namespace/definitons.go index 92c9989f6..781376108 100644 --- a/internal/namespace/definitons.go +++ b/internal/namespace/definitons.go @@ -1,32 +1,46 @@ package namespace import ( + "context" "encoding/json" + "errors" "fmt" + "testing" "github.com/ory/x/cmdx" ) type ( Namespace struct { - ID int `json:"id"` - Name string `json:"name"` - Config json.RawMessage + ID int `json:"id" db:"id"` + Name string `json:"name" db:"-"` + Config json.RawMessage `json:"config" db:"-"` } Status struct { - CurrentVersion int `json:"current_version" db:"version"` + CurrentVersion int `json:"current_version" db:"-"` NextVersion int `json:"next_version" db:"-"` } + Migrator interface { + MigrateNamespaceUp(ctx context.Context, n *Namespace) error + NamespaceStatus(ctx context.Context, id int) (*Status, error) + } Manager interface { - MigrateNamespaceUp(n *Namespace) error - NamespaceStatus(n *Namespace) (*Status, error) + GetNamespace(ctx context.Context, name string) (*Namespace, error) + SetNamespaces(_ *testing.T, namespaces ...*Namespace) } ManagerProvider interface { NamespaceManager() Manager } + MigratorProvider interface { + NamespaceMigrator() Migrator + } ) -var _ cmdx.OutputEntry = &Status{} +var ( + _ cmdx.OutputEntry = &Status{} + + ErrNamespaceNotFound = errors.New("could not find namespace") +) func (s *Status) Header() []string { return []string{ diff --git a/internal/persistence/definitions.go b/internal/persistence/definitions.go index 4026438ad..f241dcf41 100644 --- a/internal/persistence/definitions.go +++ b/internal/persistence/definitions.go @@ -1,17 +1,24 @@ package persistence import ( + "context" "errors" "github.com/ory/keto/internal/namespace" + "github.com/ory/keto/internal/relationtuple" ) type Persister interface { relationtuple.Manager - namespace.Manager + namespace.Migrator +} + +type Migrator interface { + MigrateUp(ctx context.Context) error } var ( - ErrNamespaceUnknown = errors.New("namespace unknown") + ErrNamespaceUnknown = errors.New("namespace unknown") + ErrMalformedPageToken = errors.New("malformed page token") ) diff --git a/internal/persistence/memory/definitions.go b/internal/persistence/memory/definitions.go deleted file mode 100644 index 09c3baa0d..000000000 --- a/internal/persistence/memory/definitions.go +++ /dev/null @@ -1,28 +0,0 @@ -package memory - -import ( - "sync" - - "github.com/ory/keto/internal/namespace" - - "github.com/ory/keto/internal/relationtuple" -) - -const mostRecentNamespaceVersion = 1 - -type Persister struct { - sync.RWMutex - - relations map[int][]*relationtuple.InternalRelationTuple - - namespacesStatus map[int]*namespace.Status - namespaces map[string]*namespace.Namespace -} - -func NewPersister() *Persister { - return &Persister{ - relations: make(map[int][]*relationtuple.InternalRelationTuple), - namespacesStatus: make(map[int]*namespace.Status), - namespaces: make(map[string]*namespace.Namespace), - } -} diff --git a/internal/persistence/memory/namespace.go b/internal/persistence/memory/namespace.go deleted file mode 100644 index e022bc372..000000000 --- a/internal/persistence/memory/namespace.go +++ /dev/null @@ -1,41 +0,0 @@ -package memory - -import ( - "github.com/ory/keto/internal/namespace" - "github.com/ory/keto/internal/persistence" -) - -var _ namespace.Manager = &Persister{} - -func (p *Persister) MigrateNamespaceUp(n *namespace.Namespace) error { - p.Lock() - defer p.Unlock() - - currStatus, ok := p.namespacesStatus[n.ID] - if !ok { - currStatus = &namespace.Status{} - p.namespacesStatus[n.ID] = currStatus - nc := *n - p.namespaces[n.Name] = &nc - } - - if currStatus.CurrentVersion < mostRecentNamespaceVersion { - currStatus.CurrentVersion = mostRecentNamespaceVersion - } - - return nil -} - -func (p *Persister) NamespaceStatus(n *namespace.Namespace) (*namespace.Status, error) { - p.RLock() - defer p.RUnlock() - - s, ok := p.namespacesStatus[n.ID] - if !ok { - return nil, persistence.ErrNamespaceUnknown - } - - sc := *s - sc.NextVersion = mostRecentNamespaceVersion - return &sc, nil -} diff --git a/internal/persistence/memory/relationtuples.go b/internal/persistence/memory/relationtuples.go deleted file mode 100644 index 580574f1d..000000000 --- a/internal/persistence/memory/relationtuples.go +++ /dev/null @@ -1,119 +0,0 @@ -package memory - -import ( - "context" - "fmt" - "strconv" - - "github.com/ory/keto/internal/persistence" - - "github.com/ory/keto/internal/x" - - "github.com/ory/keto/internal/relationtuple" -) - -type ( - queryFilter func(r *relationtuple.InternalRelationTuple) bool -) - -var _ relationtuple.Manager = &Persister{} - -func (p *Persister) paginateRelations(rels []*relationtuple.InternalRelationTuple, options ...x.PaginationOptionSetter) ([]*relationtuple.InternalRelationTuple, string, error) { - if len(rels) == 0 { - return rels, "0", nil - } - - pagination := x.GetPaginationOptions(options...) - if pagination.Token == "" { - pagination.Token = "0" - } - - start, err := strconv.ParseInt(pagination.Token, 0, 0) - if err != nil { - return nil, "-1", err - } - veryLast := len(rels) - end := int(start) + pagination.Size - if veryLast < end { - end = veryLast - } - return rels[start:end], fmt.Sprintf("%d", veryLast+1), nil -} - -func buildRelationQueryFilter(query *relationtuple.RelationQuery) queryFilter { - var filters []queryFilter - - filters = append(filters, func(r *relationtuple.InternalRelationTuple) bool { - return query.Namespace == r.Namespace - }) - - if query.Object != "" { - filters = append(filters, func(r *relationtuple.InternalRelationTuple) bool { - return query.Object == r.Object - }) - } - - if query.Relation != "" { - filters = append(filters, func(r *relationtuple.InternalRelationTuple) bool { - return r.Relation == query.Relation - }) - } - - if query.Subject != nil { - filters = append(filters, func(r *relationtuple.InternalRelationTuple) bool { - return query.Subject.Equals(r.Subject) - }) - } - - // Create composite filter - return func(r *relationtuple.InternalRelationTuple) bool { - // this is lazy-evaluating the AND of all filters - for _, filter := range filters { - if !filter(r) { - return false - } - } - return true - } -} - -func (p *Persister) GetRelationTuples(_ context.Context, query *relationtuple.RelationQuery, options ...x.PaginationOptionSetter) ([]*relationtuple.InternalRelationTuple, string, error) { - p.RLock() - defer p.RUnlock() - - if query == nil { - return nil, "-1", nil - } - - filter := buildRelationQueryFilter(query) - - n, ok := p.namespaces[query.Namespace] - if !ok { - return nil, "-1", persistence.ErrNamespaceUnknown - } - - var res []*relationtuple.InternalRelationTuple - for _, r := range p.relations[n.ID] { - if filter(r) { - // If one filter matches add relation to response - res = append(res, r) - } - } - - return p.paginateRelations(res, options...) -} - -func (p *Persister) WriteRelationTuples(_ context.Context, rs ...*relationtuple.InternalRelationTuple) error { - p.Lock() - defer p.Unlock() - - for _, r := range rs { - n, ok := p.namespaces[r.Namespace] - if !ok { - return persistence.ErrNamespaceUnknown - } - - p.relations[n.ID] = append(p.relations[n.ID], r) - } - return nil -} diff --git a/internal/persistence/memory/relationtuples_test.go b/internal/persistence/memory/relationtuples_test.go deleted file mode 100644 index e6957cf60..000000000 --- a/internal/persistence/memory/relationtuples_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package memory - -import ( - "context" - "fmt" - "testing" - - "github.com/ory/keto/internal/namespace" - - "github.com/ory/keto/internal/relationtuple" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func newTestSetup(t *testing.T) (p *Persister, rel1, rel2, rel3, rel4 *relationtuple.InternalRelationTuple) { - p = NewPersister() - rel1 = &relationtuple.InternalRelationTuple{ - Object: "obj", - Namespace: "rel1", - Relation: "rel1 name", - Subject: &relationtuple.SubjectID{ID: "rel1 user"}, - } - rel2 = &relationtuple.InternalRelationTuple{ - Object: "obj", - Namespace: "rel2", - Relation: "rel2 name", - Subject: &relationtuple.SubjectID{ID: "rel2 user"}, - } - rel3 = &relationtuple.InternalRelationTuple{ - Object: "obj", - Namespace: "rel3", - Relation: "shared name", - Subject: &relationtuple.SubjectSet{ - Object: "user set obj", - Namespace: "rel3", - Relation: "rel3 user set", - }, - } - rel4 = &relationtuple.InternalRelationTuple{ - Object: "obj", - Namespace: "rel4", - Relation: "shared name", - Subject: &relationtuple.SubjectID{ID: "rel4 user"}, - } - - require.NoError(t, p.MigrateNamespaceUp(&namespace.Namespace{Name: rel1.Namespace, ID: 0})) - require.NoError(t, p.MigrateNamespaceUp(&namespace.Namespace{Name: rel2.Namespace, ID: 1})) - require.NoError(t, p.MigrateNamespaceUp(&namespace.Namespace{Name: rel3.Namespace, ID: 2})) - require.NoError(t, p.MigrateNamespaceUp(&namespace.Namespace{Name: rel4.Namespace, ID: 3})) - require.NoError(t, p.WriteRelationTuples(context.Background(), rel1, rel2, rel3, rel4)) - return -} - -func TestGetRelationTuples(t *testing.T) { - p, rel1, rel2, rel3, _ := newTestSetup(t) - - for i, tc := range []struct { - query *relationtuple.RelationQuery - expected []*relationtuple.InternalRelationTuple - }{ - { - query: &relationtuple.RelationQuery{Object: rel1.Object, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Subject: rel1.Subject, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Relation: rel1.Relation, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Object: rel1.Object, Subject: rel1.Subject, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Object: rel1.Object, Relation: rel1.Relation, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Subject: rel1.Subject, Relation: rel1.Relation, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Object: rel1.Object, Subject: rel1.Subject, Relation: rel1.Relation, Namespace: rel1.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel1}, - }, - { - query: &relationtuple.RelationQuery{Object: rel2.Object, Namespace: rel2.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel2}, - }, - { - query: &relationtuple.RelationQuery{Subject: rel3.Subject, Namespace: rel3.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel3}, - }, - { - query: &relationtuple.RelationQuery{Object: rel3.Object, Relation: rel3.Relation, Namespace: rel3.Namespace}, - expected: []*relationtuple.InternalRelationTuple{rel3}, - }, - { - expected: []*relationtuple.InternalRelationTuple{}, - }, - } { - t.Run(fmt.Sprintf("case=%d", i), func(t *testing.T) { - res, _, err := p.GetRelationTuples(context.Background(), tc.query) - require.NoError(t, err) - - assert.Equal(t, len(tc.expected), len(res), "query: %s\nexpected: %+v\n got: %+v", tc.query, tc.expected, res) - for _, r := range tc.expected { - assert.Contains(t, res, r) - } - }) - } -} diff --git a/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.down.sql b/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.down.sql new file mode 100644 index 000000000..236495047 --- /dev/null +++ b/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.down.sql @@ -0,0 +1 @@ +DROP TABLE keto_namespaces; diff --git a/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.up.sql b/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.up.sql new file mode 100644 index 000000000..ff4005e1f --- /dev/null +++ b/internal/persistence/sql/migrations/20201110175414_relationtuple.sqlite.up.sql @@ -0,0 +1,5 @@ +CREATE TABLE keto_namespace +( + id INTEGER PRIMARY KEY, + schema_version INTEGER NOT NULL +); diff --git a/internal/persistence/sql/namespace.go b/internal/persistence/sql/namespace.go new file mode 100644 index 000000000..900bf858a --- /dev/null +++ b/internal/persistence/sql/namespace.go @@ -0,0 +1,84 @@ +package sql + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + + "github.com/gobuffalo/pop/v5" + + "github.com/ory/keto/internal/namespace" +) + +type ( + namespaceRow struct { + ID int `db:"id"` + Version int `db:"schema_version"` + } +) + +const ( + namespaceCreateStatement = ` +CREATE TABLE %[1]s +( + shard_id varchar(64), + object varchar(64), + relation varchar(64), + subject varchar(256), /* can be or */ + commit_time timestamp, + + PRIMARY KEY (shard_id, object, relation, subject, commit_time) +); + +CREATE INDEX %[1]s_object_idx ON %[1]s (object); + +CREATE INDEX %[1]s_user_set_idx ON %[1]s (object, relation); +` + + mostRecentSchemaVersion = 1 +) + +func tableFromNamespace(n *namespace.Namespace) string { + return fmt.Sprintf("keto_%0.10d_relation_tuples", n.ID) +} + +func createStmt(n *namespace.Namespace) string { + return fmt.Sprintf(namespaceCreateStatement, tableFromNamespace(n)) +} + +func (p *Persister) MigrateNamespaceUp(ctx context.Context, n *namespace.Namespace) error { + return p.transaction(ctx, func(ctx context.Context, c *pop.Connection) error { + // TODO this is only creating new namespaces and not applying migrations + nr := namespaceRow{ + ID: n.ID, + Version: mostRecentSchemaVersion, + } + if err := c.Create(&nr); err != nil { + return errors.WithStack(err) + } + + return errors.WithStack( + c.RawQuery(createStmt(n)).Exec()) + }) +} + +func (p *Persister) NamespaceFromName(ctx context.Context, name string) (*namespace.Namespace, error) { + return p.namespaces.GetNamespace(ctx, name) +} + +func (p *Persister) NamespaceStatus(ctx context.Context, id int) (*namespace.Status, error) { + var n namespaceRow + if err := p.connection(ctx).Find(&n, id); err != nil { + return nil, err + } + + return &namespace.Status{ + CurrentVersion: n.Version, + NextVersion: mostRecentSchemaVersion, + }, nil +} + +func (n *namespaceRow) TableName() string { + return "keto_namespace" +} diff --git a/internal/persistence/sql/pagination_test.go b/internal/persistence/sql/pagination_test.go new file mode 100644 index 000000000..e5cded410 --- /dev/null +++ b/internal/persistence/sql/pagination_test.go @@ -0,0 +1,49 @@ +package sql + +import ( + "errors" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/ory/keto/internal/persistence" + "github.com/ory/keto/internal/x" +) + +func TestPaginationToken(t *testing.T) { + for i, tc := range []struct { + size uint + token string + expectedErr error + expectedOffset uint + expectedLimit uint + }{ + { + size: 10, + token: "10", + expectedOffset: 10, + expectedLimit: 10, + }, + { + size: 0, + token: "15", + expectedOffset: 15, + expectedLimit: defaultPageSize, + }, + { + size: 0, + token: "-15", + expectedErr: persistence.ErrMalformedPageToken, + expectedLimit: defaultPageSize, + }, + } { + t.Run(fmt.Sprintf("case=%d/size:%d token:%s", i, tc.size, tc.token), func(t *testing.T) { + pagination, err := internalPaginationFromOptions(x.WithSize(tc.size), x.WithToken(tc.token)) + + assert.True(t, errors.Is(err, tc.expectedErr)) + assert.Equal(t, tc.expectedLimit, pagination.Limit) + assert.Equal(t, tc.expectedOffset, pagination.Offset) + }) + } +} diff --git a/internal/persistence/sql/persister.go b/internal/persistence/sql/persister.go new file mode 100644 index 000000000..c67d659c9 --- /dev/null +++ b/internal/persistence/sql/persister.go @@ -0,0 +1,115 @@ +package sql + +import ( + "context" + "fmt" + "strconv" + + "github.com/ory/keto/internal/namespace" + + "github.com/markbates/pkger" + "github.com/ory/x/logrusx" + "github.com/ory/x/pkgerx" + + "github.com/gobuffalo/pop/v5" + "github.com/pkg/errors" + + "github.com/ory/keto/internal/persistence" + "github.com/ory/keto/internal/x" +) + +type ( + Persister struct { + conn *pop.Connection + mb *pkgerx.MigrationBox + namespaces namespace.Manager + } + internalPagination struct { + Offset uint + Limit uint + } + contextKeys string +) + +const ( + pageTokenEnd = "no other page" + transactionContextKey contextKeys = "ongoing transaction" + defaultPageSize uint = 100 +) + +var ( + migrations = pkger.Dir("/internal/persistence/sql/migrations") + + _ persistence.Persister = &Persister{} +) + +func NewPersister(c *pop.Connection, l *logrusx.Logger, namespaces namespace.Manager) (*Persister, error) { + mb, err := pkgerx.NewMigrationBox(migrations, c, l) + if err != nil { + return nil, err + } + return &Persister{ + mb: mb, + conn: c, + namespaces: namespaces, + }, nil +} + +func (p *Persister) MigrateUp(_ context.Context) error { + return p.mb.Up() +} + +func (p *Persister) connection(ctx context.Context) *pop.Connection { + tx := ctx.Value(transactionContextKey) + if tx == nil { + return p.conn + } + return tx.(*pop.Connection) +} + +func (p *Persister) transaction(ctx context.Context, f func(context.Context, *pop.Connection) error) error { + tx := ctx.Value(transactionContextKey) + if tx != nil { + return f(ctx, tx.(*pop.Connection)) + } + + return p.conn.Transaction(func(tx *pop.Connection) error { + return f(context.WithValue(ctx, transactionContextKey, tx), tx) + }) +} + +func internalPaginationFromOptions(opts ...x.PaginationOptionSetter) (*internalPagination, error) { + xp := x.GetPaginationOptions(opts...) + ip := &internalPagination{ + Limit: xp.Size, + } + if ip.Limit == 0 { + ip.Limit = defaultPageSize + } + return ip, ip.parsePageToken(xp.Token) +} + +func (p *internalPagination) parsePageToken(t string) error { + if t == pageTokenEnd { + p.Limit = 0 + p.Offset = 0 + return nil + } + + if t == "" { + p.Offset = 0 + return nil + } + + i, err := strconv.ParseUint(t, 10, 32) + if err != nil { + return errors.WithStack(persistence.ErrMalformedPageToken) + } + + p.Offset = uint(i) + return nil +} + +func (p *internalPagination) encodeNextPageToken() string { + return fmt.Sprintf("%d", p.Offset+p.Limit) +} diff --git a/internal/persistence/sql/relationtuples.go b/internal/persistence/sql/relationtuples.go new file mode 100644 index 000000000..bda6947a1 --- /dev/null +++ b/internal/persistence/sql/relationtuples.go @@ -0,0 +1,157 @@ +package sql + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/pkg/errors" + + "github.com/ory/keto/internal/namespace" + + "github.com/gobuffalo/pop/v5" + + "github.com/ory/keto/internal/relationtuple" + "github.com/ory/keto/internal/x" +) + +type ( + relationTuple struct { + ShardID string `db:"shard_id"` + Object string `db:"object"` + Relation string `db:"relation"` + Subject string `db:"subject"` + CommitTime time.Time `db:"commit_time"` + Namespace *namespace.Namespace `db:"-"` + } +) + +func (r *relationTuple) TableName() string { + return tableFromNamespace(r.Namespace) +} + +func (p *Persister) insertRelationTuple(ctx context.Context, rel *relationtuple.InternalRelationTuple) error { + commitTime := time.Now() + + n, err := p.namespaces.GetNamespace(ctx, rel.Namespace) + if err != nil { + return err + } + + // TODO sharding + shardID := "default" + + return p.connection(ctx).RawQuery(fmt.Sprintf( + "INSERT INTO %s (shard_id, object, relation, subject, commit_time) VALUES (?, ?, ?, ?, ?)", tableFromNamespace(n)), + shardID, rel.Object, rel.Relation, rel.Subject.String(), commitTime, + ).Exec() +} + +func (r *relationTuple) toInternal() (*relationtuple.InternalRelationTuple, error) { + if r == nil { + return nil, nil + } + + sub, err := relationtuple.SubjectFromString(r.Subject) + return &relationtuple.InternalRelationTuple{ + Relation: r.Relation, + Object: r.Object, + Namespace: r.Namespace.Name, + Subject: sub, + }, err +} + +func (p *Persister) GetRelationTuples(ctx context.Context, query *relationtuple.RelationQuery, options ...x.PaginationOptionSetter) ([]*relationtuple.InternalRelationTuple, string, error) { + pop.Debug = true + defer func() { + pop.Debug = false + }() + const ( + whereRelation = "relation = ?" + whereObject = "object = ?" + whereSubject = "subject = ?" + ) + + pagination, err := internalPaginationFromOptions(options...) + if err != nil { + return nil, pageTokenEnd, err + } + + var ( + where []string + args []interface{} + ) + + if query.Relation != "" { + where = append(where, whereRelation) + args = append(args, query.Relation) + } + + if query.Object != "" { + where = append(where, whereObject) + args = append(args, query.Object) + } + + if query.Subject != nil { + where = append(where, whereSubject) + args = append(args, query.Subject.String()) + } + + var res []*relationTuple + var rawQuery string + + n, err := p.namespaces.GetNamespace(ctx, query.Namespace) + if err != nil { + return nil, "-1", err + } + + if len(where) == 0 { + rawQuery = fmt.Sprintf("SELECT * FROM %s LIMIT %d OFFSET %d", + tableFromNamespace(n), + pagination.Limit, + pagination.Offset, + ) + } else { + rawQuery = fmt.Sprintf("SELECT * FROM %s WHERE %s LIMIT %d OFFSET %d", + tableFromNamespace(n), + strings.Join(where, " AND "), + pagination.Limit, + pagination.Offset, + ) + } + + if err := p.conn. + RawQuery(rawQuery, args...). + All(&res); err != nil { + return nil, pageTokenEnd, errors.WithStack(err) + } + + internalRes := make([]*relationtuple.InternalRelationTuple, len(res)) + for i, r := range res { + r.Namespace = n + + var err error + internalRes[i], err = r.toInternal() + if err != nil { + return nil, pageTokenEnd, err + } + } + + nextPageToken := pagination.encodeNextPageToken() + if len(internalRes) == 0 { + nextPageToken = pageTokenEnd + } + return internalRes, nextPageToken, nil +} + +func (p *Persister) WriteRelationTuples(ctx context.Context, rs ...*relationtuple.InternalRelationTuple) error { + return p.transaction(ctx, func(ctx context.Context, tx *pop.Connection) error { + for _, r := range rs { + if err := p.insertRelationTuple(ctx, r); err != nil { + return err + } + } + return nil + }) +} diff --git a/internal/relationtuple/definitions.go b/internal/relationtuple/definitions.go index 1a97b3ac8..5288f7340 100644 --- a/internal/relationtuple/definitions.go +++ b/internal/relationtuple/definitions.go @@ -2,11 +2,12 @@ package relationtuple import ( "context" - "errors" "fmt" "net/url" "strings" + "github.com/pkg/errors" + acl "github.com/ory/keto/api/keto/acl/v1alpha1" "github.com/ory/keto/internal/x" @@ -91,7 +92,7 @@ func (s *SubjectID) String() string { } func (s *SubjectSet) String() string { - return fmt.Sprintf("%s#%s", s.Object, s.Relation) + return fmt.Sprintf("%s:%s#%s", s.Namespace, s.Object, s.Relation) } func (s *SubjectID) FromString(str string) (Subject, error) { @@ -102,12 +103,12 @@ func (s *SubjectID) FromString(str string) (Subject, error) { func (s *SubjectSet) FromString(str string) (Subject, error) { parts := strings.Split(str, "#") if len(parts) != 2 { - return nil, ErrMalformedInput + return nil, errors.WithStack(ErrMalformedInput) } innerParts := strings.Split(parts[0], ":") if len(innerParts) != 2 { - return nil, ErrMalformedInput + return nil, errors.WithStack(ErrMalformedInput) } s.Namespace = innerParts[0] diff --git a/internal/relationtuple/read_server.go b/internal/relationtuple/read_server.go index 5b4ee2b6f..0eaf3e467 100644 --- a/internal/relationtuple/read_server.go +++ b/internal/relationtuple/read_server.go @@ -17,7 +17,7 @@ func (s GRPCServer) ListRelationTuples(ctx context.Context, req *acl.ListRelatio Relation: req.Query.Relation, Subject: SubjectFromGRPC(req.Query.Subject), }, - x.WithSize(int(req.PageSize)), + x.WithSize(uint(req.PageSize)), x.WithToken(req.PageToken), ) if err != nil { diff --git a/internal/x/pagination.go b/internal/x/pagination.go index 5db0d3f09..0aef0f325 100644 --- a/internal/x/pagination.go +++ b/internal/x/pagination.go @@ -3,7 +3,7 @@ package x type ( paginationOptions struct { Token string - Size int + Size uint } PaginationOptionSetter func(*paginationOptions) *paginationOptions ) @@ -15,7 +15,7 @@ func WithToken(t string) PaginationOptionSetter { } } -func WithSize(size int) PaginationOptionSetter { +func WithSize(size uint) PaginationOptionSetter { return func(opts *paginationOptions) *paginationOptions { opts.Size = size return opts