Skip to content

Commit

Permalink
feat: add sql persister (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Dec 2, 2020
1 parent b94f50d commit d595d52
Show file tree
Hide file tree
Showing 29 changed files with 737 additions and 479 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
-
Expand Down
6 changes: 3 additions & 3 deletions api/keto/acl/v1alpha1/read_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/keto/acl/v1alpha1/read_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions cmd/namespace/migrate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package namespace

import (
"context"
"errors"
"fmt"

Expand All @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit d595d52

Please sign in to comment.