Skip to content

Export Client interface for extensibility #7

Description

@FumingPower3925

Problem

The internal rawClient interface is unexported:

type rawClient interface {
    doRequest(ctx context.Context, workerID int) (int, error)
    close()
}

Users cannot implement custom protocol handlers (gRPC, QUIC, WebSocket) to use with the benchmarker.

Solution

Export the interface as Client:

// Client is the interface for protocol-specific benchmark clients.
// Implement this interface to add support for custom protocols.
type Client interface {
    // DoRequest sends a single request and returns the response status code.
    DoRequest(ctx context.Context, workerID int) (int, error)
    // Close releases all resources held by the client.
    Close()
}
  • Rename internal usages from rawClient to Client
  • Add Config.Client Client field for user-provided implementations
  • When Config.Client is set, skip built-in H1/H2 client creation

Acceptance Criteria

  • Client interface is exported
  • Config.Client field allows custom implementations
  • Built-in H1/H2 clients implement Client
  • Example in godoc showing custom client usage

Breaking Change

Renames internal interface. No external breakage since interface was unexported, but the new Config.Client field is additive.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiPublic API designbreakingAPI-breaking changes

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions