aboutsummaryrefslogtreecommitdiff
path: root/internal/format
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-14 13:31:08 +0000
committerGravatar Runxi Yu2026-06-14 13:31:08 +0000
commit4bd2e40d3fa131cb6ccc566c06dd0ca74ae86111 (patch)
tree555bea779e9473fe666e2ddbf59105a3953b1934 /internal/format
parentobject/store/packed/internal/ingest: Test that the bloom filter contains (diff)
object/store/packed/internal/ingest: Don't use WriteTo
Diffstat (limited to 'internal/format')
-rw-r--r--internal/format/packidx/bloom/write.go11
-rw-r--r--internal/format/packidx/bloom/write_test.go25
2 files changed, 0 insertions, 36 deletions
diff --git a/internal/format/packidx/bloom/write.go b/internal/format/packidx/bloom/write.go
index a9efbaae..a76897ac 100644
--- a/internal/format/packidx/bloom/write.go
+++ b/internal/format/packidx/bloom/write.go
@@ -4,7 +4,6 @@ import (
"encoding/binary"
"errors"
"fmt"
- "io"
"math/bits"
"lindenii.org/go/furgit/object/id"
@@ -108,16 +107,6 @@ func (b *Builder) Bytes() []byte {
return b.data
}
-// WriteTo writes the serialized filter to w.
-func (b *Builder) WriteTo(w io.Writer) (int64, error) {
- n, err := w.Write(b.data)
- if err != nil {
- return int64(n), fmt.Errorf("internal/format/packidx/bloom: %w", err)
- }
-
- return int64(n), nil
-}
-
// RecommendParams returns filter parameters for an index of n objects,
// targeting a false positive rate near one percent.
func RecommendParams(objectFormat id.ObjectFormat, n int) (bucketCount uint32, k uint16, err error) {
diff --git a/internal/format/packidx/bloom/write_test.go b/internal/format/packidx/bloom/write_test.go
index 18532a33..40c42e37 100644
--- a/internal/format/packidx/bloom/write_test.go
+++ b/internal/format/packidx/bloom/write_test.go
@@ -1,7 +1,6 @@
package bloom_test
import (
- "bytes"
"errors"
"testing"
@@ -82,27 +81,3 @@ func TestAddBadLength(t *testing.T) {
builder.Add(make([]byte, id.ObjectFormatSHA256.Size()-1))
}
-
-func TestWriteTo(t *testing.T) {
- t.Parallel()
-
- builder, err := bloom.NewBuilder(id.ObjectFormatSHA256, 4, 2)
- if err != nil {
- t.Fatal(err)
- }
-
- var buf bytes.Buffer
-
- n, err := builder.WriteTo(&buf)
- if err != nil {
- t.Fatal(err)
- }
-
- if int(n) != len(builder.Bytes()) {
- t.Fatalf("WriteTo wrote %d bytes, want %d", n, len(builder.Bytes()))
- }
-
- if !bytes.Equal(buf.Bytes(), builder.Bytes()) {
- t.Fatal("WriteTo output differs from Bytes")
- }
-}