Skip to content

Commit

Permalink
fix: drop dependency on protowire package
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <christian@aperture.us>
  • Loading branch information
paralin committed May 4, 2024
1 parent 30c2c6c commit a26a347
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/mr-tron/base58 v1.2.0
github.com/pkg/errors v0.9.1
github.com/urfave/cli/v2 v2.27.2
google.golang.org/protobuf v1.34.0
)

require (
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,5 @@ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 3 additions & 3 deletions kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io/fs"
"math"

protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
"github.com/pkg/errors"
"google.golang.org/protobuf/encoding/protowire"
)

// maxIndexEntrySize is the maximum index entry size in bytes
Expand Down Expand Up @@ -71,7 +71,7 @@ func BuildReader(rd io.ReaderAt, fileSize uint64) (*Reader, error) {
if err != nil {
return nil, err
}
indexEntrySize, indexEntrySizeLen := protowire.ConsumeVarint(buf)
indexEntrySize, indexEntrySizeLen := protobuf_go_lite.ConsumeVarint(buf)
if indexEntrySizeLen < 0 {
return nil, errors.Errorf("invalid index entry size varint at %v", firstIndexEntryLenPos)
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func (r *Reader) ReadIndexEntry(indexEntryIdx uint64) (*IndexEntry, error) {
if err != nil {
return nil, err
}
indexEntrySize, indexEntrySizeLen := protowire.ConsumeVarint(buf)
indexEntrySize, indexEntrySizeLen := protobuf_go_lite.ConsumeVarint(buf)
if indexEntrySizeLen < 0 {
return nil, errors.Errorf("invalid index entry size varint at %v", indexEntrySizePos)
}
Expand Down
4 changes: 2 additions & 2 deletions write.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"slices"
"sync"

protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
"github.com/pkg/errors"
"google.golang.org/protobuf/encoding/protowire"
)

// Writer allows progressively writing values to a kvfile.
Expand Down Expand Up @@ -167,7 +167,7 @@ func WriteIndex(writer io.Writer, index []*IndexEntry, pos uint64) (uint64, erro

// write the varint size of the entry
buf = buf[:0]
buf = protowire.AppendVarint(buf, uint64(nw))
buf = protobuf_go_lite.AppendVarint(buf, uint64(nw))
nw = 0
for nw < len(buf) {
n, err := writer.Write(buf[nw:])
Expand Down

0 comments on commit a26a347

Please sign in to comment.