Skip to content

Commit

Permalink
fix: replace with faster JSON encoding
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkumar Chinchani <[email protected]>
  • Loading branch information
rchincha committed Sep 29, 2023
1 parent 75085dc commit 1791d51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/meta/boltdb/boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package boltdb

import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"

jsoniter "github.com/json-iterator/go"

Check failure on line 11 in pkg/meta/boltdb/boltdb.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard,default,prefix(zotregistry.io/zot) (gci)
godigest "github.com/opencontainers/go-digest"
ispec "github.com/opencontainers/image-spec/specs-go/v1"
"go.etcd.io/bbolt"
Expand All @@ -29,6 +30,8 @@ type BoltDB struct {
Log log.Logger
}

var json = jsoniter.ConfigCompatibleWithStandardLibrary

Check failure on line 33 in pkg/meta/boltdb/boltdb.go

View workflow job for this annotation

GitHub Actions / lint

json is a global variable (gochecknoglobals)

func New(boltDB *bbolt.DB, log log.Logger) (*BoltDB, error) {
err := boltDB.Update(func(transaction *bbolt.Tx) error {
versionBuck, err := transaction.CreateBucketIfNotExists([]byte(VersionBucket))
Expand Down
5 changes: 4 additions & 1 deletion pkg/meta/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package dynamodb

import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"

jsoniter "github.com/json-iterator/go"

Check failure on line 10 in pkg/meta/dynamodb/dynamodb.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard,default,prefix(zotregistry.io/zot) (gci)

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
Expand All @@ -25,6 +26,8 @@ import (
reqCtx "zotregistry.io/zot/pkg/requestcontext"
)

var json = jsoniter.ConfigCompatibleWithStandardLibrary

Check failure on line 29 in pkg/meta/dynamodb/dynamodb.go

View workflow job for this annotation

GitHub Actions / lint

json is a global variable (gochecknoglobals)

var errMetaDB = errors.New("metadb: error while constructing manifest meta")

type DynamoDB struct {
Expand Down

0 comments on commit 1791d51

Please sign in to comment.