Skip to content
Closed
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
13 changes: 12 additions & 1 deletion pkg/client/v1/storageclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ import (
)

// sbomStreamChunkSize is the per-chunk byte budget used by PutSBOMStream
// and GetSBOMStream. Set well below the default 4 MiB gRPC message limit
// and GetSBOMStream. Set well below the configured gRPC message limit
// to leave headroom for framing overhead.
const sbomStreamChunkSize = 1 << 20 // 1 MiB

// maxGRPCMessageSize is the per-message cap configured on this client for
// both send and receive. grpc-go defaults receive to 4 MiB; we raise it
// so unary RPCs (e.g. GetProfile, SendContainerProfile) can carry larger
// payloads. The server must be configured with at least the same limit.
const maxGRPCMessageSize = 128 << 20 // 128 MiB

// Default gRPC ports
const (
DefaultGRPCPort = 50051 // Non-secure gRPC
Expand Down Expand Up @@ -216,6 +222,11 @@ func (c *StorageClient) Connect() error {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
}

dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(maxGRPCMessageSize),
grpc.MaxCallSendMsgSize(maxGRPCMessageSize),
))

conn, err := grpc.NewClient(c.address, dialOpts...)
if err != nil {
return fmt.Errorf("failed to connect to storage server: %w", err)
Expand Down
Loading