Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant CBOR encoding in observer message dump #726

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading