| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package streamserver | 5 package streamserver |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "io" | 8 "io" |
| 9 | 9 |
| 10 "github.com/luci/luci-go/logdog/client/butlerlib/streamproto" | 10 "github.com/luci/luci-go/logdog/client/butlerlib/streamproto" |
| 11 ) | 11 ) |
| 12 | 12 |
| 13 // StreamServer is an interface to a backgound service that allows external | 13 // StreamServer is an interface to a backgound service that allows external |
| 14 // processes to establish Butler streams. | 14 // processes to establish Butler streams. |
| 15 type StreamServer interface { | 15 type StreamServer interface { |
| 16 // Performs initial connection and setup, entering a listening state. | 16 // Performs initial connection and setup, entering a listening state. |
| 17 Listen() error | 17 Listen() error |
| 18 |
| 19 // Address returns a string that can be used by the "streamclient" packa
ge to |
| 20 // return a client for this StreamServer. |
| 21 // |
| 22 // Full package is: |
| 23 // github.com/luci/luci-go/logdog/butlerlib/streamclient |
| 24 // |
| 25 // Address may only be called while the StreamServer is actively listeni
ng. |
| 26 Address() string |
| 27 |
| 18 // Blocks, returning a new Stream when one is available. If the stream s
erver | 28 // Blocks, returning a new Stream when one is available. If the stream s
erver |
| 19 // has closed, this will return nil. | 29 // has closed, this will return nil. |
| 20 Next() (io.ReadCloser, *streamproto.Properties) | 30 Next() (io.ReadCloser, *streamproto.Properties) |
| 31 |
| 21 // Closes the stream server, cleaning up resources. | 32 // Closes the stream server, cleaning up resources. |
| 22 Close() | 33 Close() |
| 23 } | 34 } |
| OLD | NEW |