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

Unified Diff: logdog/client/butlerlib/streamclient/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
« no previous file with comments | « logdog/client/butlerlib/streamclient/client_test.go ('k') | logdog/client/butlerlib/streamclient/stream.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/butlerlib/streamclient/local.go
diff --git a/logdog/client/butlerlib/streamclient/local.go b/logdog/client/butlerlib/streamclient/local.go
deleted file mode 100644
index cbfda96251f90de577c8fcbde44b460390bb2b5f..0000000000000000000000000000000000000000
--- a/logdog/client/butlerlib/streamclient/local.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The LUCI Authors. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package streamclient
-
-import (
- "io"
-
- "github.com/luci/luci-go/logdog/client/butler"
- "github.com/luci/luci-go/logdog/client/butlerlib/streamproto"
-)
-
-// localClient is a Client implementation that is directly bound to a Butler
-// instance.
-type localClient struct {
- *butler.Butler
-}
-
-// NewLocal 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 {
- return &localClient{b}
-}
-
-func (c *localClient) NewStream(f streamproto.Flags) (s Stream, err error) {
- pr, pw := io.Pipe()
- defer func() {
- if err != nil {
- pr.Close()
- pw.Close()
- }
- }()
-
- props := f.Properties()
- stream := streamImpl{
- WriteCloser: pw,
- props: props,
- }
-
- // Add the Stream to the Butler.
- if err = c.AddStream(pr, props); err != nil {
- return
- }
- return &stream, nil
-}
« no previous file with comments | « logdog/client/butlerlib/streamclient/client_test.go ('k') | logdog/client/butlerlib/streamclient/stream.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698