-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch, similar in spirit to #238, introduces a new public API for extending the Pebble client. The basic idea behind this patch is the client mixin struct embedded in commands' structs no longer holds an instance of the Pebble-specific `client.Client` struct, but instead take a `ClientGetter` interface that implements a `Client()` method. `ClientGetter.Client()` always returns a Pebble-specific `client.Client` struct. For applications that indent to extend Pebble, this means that either the Pebble client or a new, application-specific client can be used. In the latter case, the application-specific client must implement the `ClientGetter` interface so that a Pebble-specific `client.Client` struct can always be derived by the facilities consuming the `ClientGetter` interface. The easiest way to implement this is to embed the Pebble client: type PebbleClient = client.Client type MyClient struct { *PebbleClient } Since the Pebble-specific `client.Client` is embedded, and the `ClientGetter` interface requires `Client()` to be implemented with a pointer receiver, the snippet above suffices to implement a client based off the Pebble-supplied one without much hassle, and that provides lower-level facilities for communicating with the daemon, such as `DoSync()`, `DoAsync()` and `DoAsyncFull()`.
- Loading branch information
Showing
33 changed files
with
222 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.