build(deps): bump github.com/open-policy-agent/opa from 1.9.0 to 1.10.1
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.9.0 to 1.10.1. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v1.9.0...v1.10.1) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-version: 1.10.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
f02a23098a
commit
54684101f7
+1
-1
@@ -72,7 +72,7 @@ func LoadWasmResolversFromStore(ctx context.Context, store storage.Store, txn st
|
||||
var resolvers []*wasm.Resolver
|
||||
if len(resolversToLoad) > 0 {
|
||||
// Get a full snapshot of the current data (including any from "outside" the bundles)
|
||||
data, err := store.Read(ctx, txn, storage.Path{})
|
||||
data, err := store.Read(ctx, txn, storage.RootPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to initialize wasm runtime: %s", err)
|
||||
}
|
||||
|
||||
+1
-78
@@ -148,7 +148,6 @@ package edittree
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -203,89 +202,13 @@ func NewEditTree(term *ast.Term) *EditTree {
|
||||
// it was found in the table already.
|
||||
func (e *EditTree) getKeyHash(key *ast.Term) (int, bool) {
|
||||
hash := key.Hash()
|
||||
// This `equal` utility is duplicated and manually inlined a number of
|
||||
// time in this file. Inlining it avoids heap allocations, so it makes
|
||||
// a big performance difference: some operations like lookup become twice
|
||||
// as slow without it.
|
||||
var equal func(v ast.Value) bool
|
||||
|
||||
switch x := key.Value.(type) {
|
||||
case ast.Null, ast.Boolean, ast.String, ast.Var:
|
||||
equal = func(y ast.Value) bool { return x == y }
|
||||
case ast.Number:
|
||||
if xi, ok := x.Int64(); ok {
|
||||
equal = func(y ast.Value) bool {
|
||||
if y, ok := y.(ast.Number); ok {
|
||||
if yi, ok := y.Int64(); ok {
|
||||
return xi == yi
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// We use big.Rat for comparing big numbers.
|
||||
// It replaces big.Float due to following reason:
|
||||
// big.Float comes with a default precision of 64, and setting a
|
||||
// larger precision results in more memory being allocated
|
||||
// (regardless of the actual number we are parsing with SetString).
|
||||
//
|
||||
// Note: If we're so close to zero that big.Float says we are zero, do
|
||||
// *not* big.Rat).SetString on the original string it'll potentially
|
||||
// take very long.
|
||||
var a *big.Rat
|
||||
fa, ok := new(big.Float).SetString(string(x))
|
||||
if !ok {
|
||||
panic("illegal value")
|
||||
}
|
||||
if fa.IsInt() {
|
||||
if i, _ := fa.Int64(); i == 0 {
|
||||
a = new(big.Rat).SetInt64(0)
|
||||
}
|
||||
}
|
||||
if a == nil {
|
||||
a, ok = new(big.Rat).SetString(string(x))
|
||||
if !ok {
|
||||
panic("illegal value")
|
||||
}
|
||||
}
|
||||
|
||||
equal = func(b ast.Value) bool {
|
||||
if bNum, ok := b.(ast.Number); ok {
|
||||
var b *big.Rat
|
||||
fb, ok := new(big.Float).SetString(string(bNum))
|
||||
if !ok {
|
||||
panic("illegal value")
|
||||
}
|
||||
if fb.IsInt() {
|
||||
if i, _ := fb.Int64(); i == 0 {
|
||||
b = new(big.Rat).SetInt64(0)
|
||||
}
|
||||
}
|
||||
if b == nil {
|
||||
b, ok = new(big.Rat).SetString(string(bNum))
|
||||
if !ok {
|
||||
panic("illegal value")
|
||||
}
|
||||
}
|
||||
|
||||
return a.Cmp(b) == 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
default:
|
||||
equal = func(y ast.Value) bool { return ast.Compare(x, y) == 0 }
|
||||
}
|
||||
|
||||
// Look through childKeys, looking up the original hash
|
||||
// value first, and then use linear-probing to iter
|
||||
// through the keys until we either find the Term we're
|
||||
// after, or run out of candidates.
|
||||
for curr, ok := e.childKeys[hash]; ok; {
|
||||
if equal(curr.Value) {
|
||||
if ast.KeyHashEqual(curr.Value, key.Value) {
|
||||
return hash, true
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ type InsertAndCompileResult struct {
|
||||
// store contents.
|
||||
func InsertAndCompile(ctx context.Context, opts InsertAndCompileOptions) (*InsertAndCompileResult, error) {
|
||||
if len(opts.Files.Documents) > 0 {
|
||||
if err := opts.Store.Write(ctx, opts.Txn, storage.AddOp, storage.Path{}, opts.Files.Documents); err != nil {
|
||||
if err := opts.Store.Write(ctx, opts.Txn, storage.AddOp, storage.RootPath, opts.Files.Documents); err != nil {
|
||||
return nil, fmt.Errorf("storage error: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -233,3 +233,18 @@ func validateIdentifier(id string) error {
|
||||
// reIdentifier is a regular expression used to check that pre-release and metadata
|
||||
// identifiers satisfy the spec requirements
|
||||
var reIdentifier = regexp.MustCompile(`^[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$`)
|
||||
|
||||
// Compare compares two semver strings.
|
||||
func Compare(a, b string) int {
|
||||
aV, err := NewVersion(strings.TrimPrefix(a, "v"))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
|
||||
bV, err := NewVersion(strings.TrimPrefix(b, "v"))
|
||||
if err != nil {
|
||||
return 1
|
||||
}
|
||||
|
||||
return aV.Compare(*bV)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user