Skip to content

Commit

Permalink
feat(client): expose a requester interface
Browse files Browse the repository at this point in the history
The patch adds a public Requester interfaces which will allow derived
projects to use the Pebble client to extend the available commands. The
interfaces is designed to also allow completely replacing the default
implementation provided by the Pebble client.

The changes made in the patch has been done in a way to produce as small
as possible diffs (we keep doSync/doAsyc wrappers). The default interface
has been implemented in the client.go file to allow reviewers to easily
identify which code was added, and which is existing code.

The following changes are made:

1. The ResultInfo type previously returned by doSync and doAsync private
function are removed. Although this is a publicly exposed type, the return
value as of today has always been discarded, and the struct is currently
empty.

2. ResultInfo has been replaced by RequestResponse.

3. The logs client request now uses the same retry logic on GET failure,
as any other GET request. This is previously not possible because the
retry logic and response unmarshall code was bundled, not allow raw access
to the HTTP body.

4. The CloseIdleConnections() call has been removed as the final Daemon
termination step (now in line with Snapd daemon termination). The garbage
collector does the job just fine here.
  • Loading branch information
flotter committed Sep 27, 2023
1 parent cb90b54 commit 254d0fb
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 169 deletions.
Loading

0 comments on commit 254d0fb

Please sign in to comment.