Skip to content

Commit

Permalink
feat: Enable GZIP compression (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrongmeal authored Feb 6, 2025
1 parent 6fa304e commit a8568d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/pb/s2.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions s2/stream_service_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"

"github.com/s2-streamstore/s2-sdk-go/internal/pb"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding/gzip"
)

type checkTailServiceRequest struct {
Expand Down Expand Up @@ -44,7 +46,7 @@ func (r *appendServiceRequest) Send(ctx context.Context) (*AppendOutput, error)
Input: pbInput,
}

pbResp, err := r.Client.Append(ctx, req)
pbResp, err := r.Client.Append(ctx, req, grpc.UseCompressor(gzip.Name))
if err != nil {
return nil, err
}
Expand All @@ -67,7 +69,7 @@ func (r *appendSessionServiceRequest) IdempotencyLevel() idempotencyLevel {
}

func (r *appendSessionServiceRequest) Send(ctx context.Context) (*channel[*AppendInput, *AppendOutput], error) {
pbResp, err := r.Client.AppendSession(ctx)
pbResp, err := r.Client.AppendSession(ctx, grpc.UseCompressor(gzip.Name))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -116,7 +118,7 @@ func (r *readServiceRequest) Send(ctx context.Context) (ReadOutput, error) {
Limit: limit,
}

pbResp, err := r.Client.Read(ctx, req)
pbResp, err := r.Client.Read(ctx, req, grpc.UseCompressor(gzip.Name))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -146,7 +148,7 @@ func (r *readSessionServiceRequest) Send(ctx context.Context) (Receiver[ReadOutp
Limit: limit,
}

pbResp, err := r.Client.ReadSession(ctx, req)
pbResp, err := r.Client.ReadSession(ctx, req, grpc.UseCompressor(gzip.Name))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a8568d4

Please sign in to comment.