Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: logdog/client/butler/streamserver/localclient/local.go

Issue 2737603003: Butler stream servers can generate client address. (Closed)
Patch Set: better comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: logdog/client/butler/streamserver/localclient/local.go
diff --git a/logdog/client/butlerlib/streamclient/local.go b/logdog/client/butler/streamserver/localclient/local.go
similarity index 70%
rename from logdog/client/butlerlib/streamclient/local.go
rename to logdog/client/butler/streamserver/localclient/local.go
index cbfda96251f90de577c8fcbde44b460390bb2b5f..481e2bafd736db8ac9d0c88be3dc4d4d00cd17c6 100644
--- a/logdog/client/butlerlib/streamclient/local.go
+++ b/logdog/client/butler/streamserver/localclient/local.go
@@ -2,12 +2,13 @@
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
-package streamclient
+package localclient
import (
"io"
"github.com/luci/luci-go/logdog/client/butler"
+ "github.com/luci/luci-go/logdog/client/butlerlib/streamclient"
"github.com/luci/luci-go/logdog/client/butlerlib/streamproto"
)
@@ -17,17 +18,19 @@ type localClient struct {
*butler.Butler
}
-// NewLocal creates a new Client instance bound to a local Butler instance. This
+var _ streamclient.Client = (*localClient)(nil)
+
+// New creates a new Client instance bound to a local Butler instance. This
// sidesteps the need for an actual server socket and negotiation protocol and
// directly registers streams via Butler API calls.
//
// Internally, the Stream uses an io.PipeWriter and io.PipeReader to ferry
// data from the Stream's owner to the Butler.
-func NewLocal(b *butler.Butler) Client {
+func New(b *butler.Butler) streamclient.Client {
return &localClient{b}
}
-func (c *localClient) NewStream(f streamproto.Flags) (s Stream, err error) {
+func (c *localClient) NewStream(f streamproto.Flags) (s streamclient.Stream, err error) {
pr, pw := io.Pipe()
defer func() {
if err != nil {
@@ -37,9 +40,9 @@ func (c *localClient) NewStream(f streamproto.Flags) (s Stream, err error) {
}()
props := f.Properties()
- stream := streamImpl{
+ stream := streamclient.BaseStream{
WriteCloser: pw,
- props: props,
+ P: props,
}
// Add the Stream to the Butler.
« no previous file with comments | « logdog/client/butler/streamserver/base_test.go ('k') | logdog/client/butler/streamserver/namedPipe_posix.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698