Skip to content

Commit

Permalink
Merge pull request #55 from h0n9/feature/enable-gzip-compression
Browse files Browse the repository at this point in the history
Support Gzip compression
  • Loading branch information
h0n9 authored Jul 8, 2024
2 parents e3504fd + 2e143e6 commit 0096b35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions cli/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/rs/zerolog"
"github.com/spf13/cobra"
"google.golang.org/grpc"
_ "google.golang.org/grpc/encoding/gzip"

"github.com/h0n9/msg-lake/lake"
pb "github.com/h0n9/msg-lake/proto"
Expand Down
21 changes: 13 additions & 8 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding/gzip"

pb "github.com/h0n9/msg-lake/proto"
"github.com/postie-labs/go-postie-lib/crypto"
Expand Down Expand Up @@ -139,16 +140,20 @@ func (c *Client) Publish(ctx context.Context, topicID, message string) error {
}

// publish the message
pubRes, err := c.msgLakeClient.Publish(ctx, &pb.PublishReq{
TopicId: topicID,
MsgCapsule: &pb.MsgCapsule{
Data: data,
Signature: &pb.Signature{
PubKey: c.privKey.PubKey().Bytes(),
Data: sigDataBytes,
pubRes, err := c.msgLakeClient.Publish(
ctx,
&pb.PublishReq{
TopicId: topicID,
MsgCapsule: &pb.MsgCapsule{
Data: data,
Signature: &pb.Signature{
PubKey: c.privKey.PubKey().Bytes(),
Data: sigDataBytes,
},
},
},
})
grpc.UseCompressor(gzip.Name),
)
if err != nil {
return err
}
Expand Down

0 comments on commit 0096b35

Please sign in to comment.