Skip to content

Commit

Permalink
update go-directory & grpc deps
Browse files Browse the repository at this point in the history
  • Loading branch information
gertd committed Dec 10, 2024
1 parent 255bd23 commit 84a39f3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
9 changes: 9 additions & 0 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ type (
RelationName = model.RelationName
)

// nolint: gocritic // commentedOutCode
type Cache struct {
model *model.Model
// mtx sync.RWMutex
// relsPool *mempool.RelationsPool
}

// New, create new model cache instance.
// nolint: gocritic // commentedOutCode
func New(m *model.Model) *Cache {
return &Cache{
model: m,
Expand All @@ -30,20 +32,23 @@ func New(m *model.Model) *Cache {
}

// UpdateModel, swaps the cache model instance.
// nolint: gocritic // commentedOutCode
func (c *Cache) UpdateModel(m *model.Model) error {
// c.mtx.Lock()
// defer c.mtx.Unlock()
c.model = m
return nil
}

// nolint: gocritic // commentedOutCode
func (c *Cache) CanUpdate(other *model.Model, stats *stts.Stats) error {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
return diff.CanUpdateModel(c.model, other, stats)
}

// ObjectExists, checks if given object type name exists in the model cache.
// nolint: gocritic // commentedOutCode
func (c *Cache) ObjectExists(on ObjectName) bool {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
Expand All @@ -53,6 +58,7 @@ func (c *Cache) ObjectExists(on ObjectName) bool {
}

// RelationExists, checks if given relation type, for the given object type, exists in the model cache.
// nolint: gocritic // commentedOutCode
func (c *Cache) RelationExists(on ObjectName, rn RelationName) bool {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
Expand All @@ -65,6 +71,7 @@ func (c *Cache) RelationExists(on ObjectName, rn RelationName) bool {
}

// PermissionExists, checks if given permission, for the given object type, exists in the model cache.
// nolint: gocritic // commentedOutCode
func (c *Cache) PermissionExists(on ObjectName, pn RelationName) bool {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
Expand All @@ -76,12 +83,14 @@ func (c *Cache) PermissionExists(on ObjectName, pn RelationName) bool {
return false
}

// nolint: gocritic // commentedOutCode
func (c *Cache) Metadata() *model.Metadata {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
return c.model.Metadata
}

// nolint: gocritic // commentedOutCode
func (c *Cache) ValidateRelation(relation *dsc.RelationIdentifier) error {
// c.mtx.RLock()
// defer c.mtx.RUnlock()
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ module github.com/aserto-dev/azm

go 1.22.9

toolchain go1.23.3
toolchain go1.23.4

replace github.com/aserto-dev/go-directory => ../go-directory
// replace github.com/aserto-dev/go-directory => ../go-directory

require (
github.com/antlr4-go/antlr/v4 v4.13.1
github.com/aserto-dev/errors v0.0.11
github.com/aserto-dev/go-directory v0.33.2-0.20241209182914-962e2284a774
github.com/deckarep/golang-set/v2 v2.6.0
github.com/aserto-dev/go-directory v0.33.2-0.20241210055557-b7307c2abab3
github.com/deckarep/golang-set/v2 v2.7.0
github.com/hashicorp/go-multierror v1.1.1
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/samber/lo v1.47.0
github.com/stretchr/testify v1.10.0
google.golang.org/grpc v1.68.0
google.golang.org/grpc v1.68.1
google.golang.org/protobuf v1.35.2
gopkg.in/yaml.v3 v3.0.1
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20240920164238-5a7b106cbb87.1 // indirect
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20241127180247-a33202765966.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -36,6 +36,6 @@ require (
golang.org/x/net v0.31.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 // indirect
)
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20240920164238-5a7b106cbb87.1 h1:7QIeAuTdLp173vC/9JojRMDFcpmqtoYrxPmvdHAOynw=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20240920164238-5a7b106cbb87.1/go.mod h1:mnHCFccv4HwuIAOHNGdiIc5ZYbBCvbTWZcodLN5wITI=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20241127180247-a33202765966.1 h1:jLd96rDDNJ+zIJxvV/L855VEtrjR0G4aePVDlCpf6kw=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.2-20241127180247-a33202765966.1/go.mod h1:mnHCFccv4HwuIAOHNGdiIc5ZYbBCvbTWZcodLN5wITI=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY=
github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM=
github.com/aserto-dev/go-directory v0.33.2-0.20241210055557-b7307c2abab3 h1:vBLVIB+9S4CRqiqb5OPZP04YZ+6+RFOmaTGBI2UvVBE=
github.com/aserto-dev/go-directory v0.33.2-0.20241210055557-b7307c2abab3/go.mod h1:8mJoaMW2HeaNfixziRg7QOuQ7CF5Y9Pt+6wddOmNW60=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/deckarep/golang-set/v2 v2.7.0 h1:gIloKvD7yH2oip4VLhsv3JyLLFnC0Y2mlusgcvJYW5k=
github.com/deckarep/golang-set/v2 v2.7.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
Expand Down Expand Up @@ -61,12 +63,12 @@ golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 h1:pgr/4QbFyktUv9CtQ/Fq4gzEE6/Xs7iCXbktaGzLHbQ=
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697/go.mod h1:+D9ySVjN8nY8YCVjc5O7PZDIdZporIDY3KaGfJunh88=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q=
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 h1:IfdSdTcLFy4lqUQrQJLkLt1PB+AsqVz6lwkWPzWEz10=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
1 change: 1 addition & 0 deletions mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (p *CollectionPool[T]) PutSlice(s *[]T) {
p.slicePool.Put(s)
}

// nolint: gocritic // commentedOutCode
func (p *CollectionPool[T]) Get() T {
return p.msgPool.New().(T)
// return p.msgPool.Get()
Expand Down

0 comments on commit 84a39f3

Please sign in to comment.