Skip to content

Commit

Permalink
Remove redundant CBOR encoding in observer message dump (#726)
Browse files Browse the repository at this point in the history
Observer uses Parquet and ndjson to dump messages. CBOR encoding seems
to be unused.

While at it, also remove the unused `GMessageEnvelopeDeferred`.
  • Loading branch information
masih authored Oct 28, 2024
1 parent c9b7e12 commit 85a59d3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 273 deletions.
246 changes: 0 additions & 246 deletions cmd/f3/msgdump/cbor_gen.go

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/f3/msgdump/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@ package msgdump

import (
"github.com/filecoin-project/go-f3/gpbft"
cbg "github.com/whyrusleeping/cbor-gen"
)

type GMessageEnvelopeDeferred struct {
UnixMicroTime int64
NetworkName string
Message cbg.Deferred
}

type GMessageEnvelope struct {
UnixMicroTime int64
NetworkName string
Expand Down
13 changes: 0 additions & 13 deletions cmd/f3/msgdump/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@ package msgdump

import (
"fmt"
"io"
"path/filepath"
"strings"

"github.com/filecoin-project/go-f3/gpbft"
cbg "github.com/whyrusleeping/cbor-gen"
)

type Writer[T cbg.CBORMarshaler] struct {
underlying io.WriteSeeker
}

func (w *Writer[T]) Write(item T) error {
// optimize it:
// keep cbg.Writer around
// write in for example 1MiB padded chunks to be able to read it in parallel
return item.MarshalCBOR(w.underlying)
}

func DirForNetwork(dir string, nn gpbft.NetworkName) string {
basename := fmt.Sprintf("msgs-%s", strings.ReplaceAll(string(nn), "/", "-"))
return filepath.Join(dir, basename)
Expand Down
7 changes: 0 additions & 7 deletions gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/filecoin-project/go-f3/certexchange"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/cmd/f3/msgdump"
"github.com/filecoin-project/go-f3/gpbft"
gen "github.com/whyrusleeping/cbor-gen"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -40,12 +39,6 @@ func main() {
certexchange.ResponseHeader{},
)
})
eg.Go(func() error {
return gen.WriteTupleEncodersToFile("../cmd/f3/msgdump/cbor_gen.go", "msgdump",
msgdump.GMessageEnvelope{},
msgdump.GMessageEnvelopeDeferred{},
)
})
if err := eg.Wait(); err != nil {
fmt.Printf("Failed to complete cborg_gen: %v\n", err)
os.Exit(1)
Expand Down

0 comments on commit 85a59d3

Please sign in to comment.