Skip to content

Commit 7938782

Browse files
authored
Merge pull request #577 from uber/dev
Version 1.3.0
2 parents aeda483 + 1fc4d99 commit 7938782

File tree

18 files changed

+67
-44
lines changed

18 files changed

+67
-44
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
# v1.3.0
5+
6+
* Exposes the channel's RootPeerList with `channel.RootPeers()`.
7+
* Support Thrift namespaces for thrift-gen.
8+
49
# v1.2.3
510

611
* Improve error messages when an argument reader is closed without
@@ -9,7 +14,7 @@ Changelog
914
but none was found (e.g., exception is from the future). (#566)
1015
* Fix ListenIP selecting docker interfaces over physical networks. (#565)
1116
* Fix for error when a Thrift payload has completed decoding and attempts
12-
to close the argument reader without waiting till EOF. (#564)
17+
to close the argument reader without waiting until EOF. (#564)
1318
* thrift-gen: Fix "namespace go" being ignored even though the Apache thrift
1419
generated code was respecting it. (#559)
1520

CONTRIBUTING.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ We'd love your help making tchannel-go great!
55

66
## Getting Started
77

8-
TChannel uses [godep](https://github.com/tools/godep) to manage dependencies.
8+
TChannel uses [glide](https://github.com/Masterminds/glide) to manage
9+
dependencies.
910
To get started:
1011

1112
```bash
1213
go get github.com/uber/tchannel-go
13-
go get github.com/tools/godep
14-
cd $GOPATH/src/github.com/uber/tchannel-go
15-
godep restore
14+
make install_glide
1615
make # tests should pass
1716
```
1817

@@ -32,3 +31,14 @@ pull request is most likely to be accepted if it:
3231
review comments](https://github.com/golang/go/wiki/CodeReviewComments).
3332
* Has a [good commit
3433
message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
34+
35+
## Cutting a Release
36+
37+
* Send a pull request against dev including:
38+
* update CHANGELOG.md (`scripts/changelog_halp.sh`)
39+
* update version.go
40+
* Send a pull request for dev into master
41+
* `git tag -m v0.0.0 -a v0.0.0`
42+
* `git push origin --tags`
43+
* Copy CHANGELOG.md fragment into release notes on
44+
https://github.com/uber/tchannel-go/releases

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ else
6666
endif
6767

6868
install_glide:
69-
GOPATH=$(OLD_GOPATH) go get -u github.com/Masterminds/glide
69+
# all we want is: GOPATH=$(OLD_GOPATH) go get -u github.com/Masterminds/glide
70+
# but have to pin to 0.12.3 due to https://github.com/Masterminds/glide/issues/745
71+
GOPATH=$(OLD_GOPATH) go get -u github.com/Masterminds/glide && cd $(OLD_GOPATH)/src/github.com/Masterminds/glide && git checkout v0.12.3 && go install
7072

7173
install_ci: install_glide install_lint get_thrift install
7274
GOPATH=$(OLD_GOPATH) go get -u github.com/mattn/goveralls

channel.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ type ChannelOptions struct {
5555
// The name of the process, for logging and reporting to peers
5656
ProcessName string
5757

58+
// OnPeerStatusChanged
59+
OnPeerStatusChanged func(*Peer)
60+
5861
// The logger to use for this channel
5962
Logger Logger
6063

@@ -363,18 +366,18 @@ func (ch *Channel) Peers() *PeerList {
363366
return ch.peers
364367
}
365368

366-
// rootPeers returns the root PeerList for the channel, which is the sole place
369+
// RootPeers returns the root PeerList for the channel, which is the sole place
367370
// new Peers are created. All children of the root list (including ch.Peers())
368371
// automatically re-use peers from the root list and create new peers in the
369372
// root list.
370-
func (ch *Channel) rootPeers() *RootPeerList {
373+
func (ch *Channel) RootPeers() *RootPeerList {
371374
return ch.peers.parent
372375
}
373376

374377
// BeginCall starts a new call to a remote peer, returning an OutboundCall that can
375378
// be used to write the arguments of the call.
376379
func (ch *Channel) BeginCall(ctx context.Context, hostPort, serviceName, methodName string, callOptions *CallOptions) (*OutboundCall, error) {
377-
p := ch.rootPeers().GetOrAdd(hostPort)
380+
p := ch.RootPeers().GetOrAdd(hostPort)
378381
return p.BeginCall(ctx, serviceName, methodName, callOptions)
379382
}
380383

@@ -431,7 +434,7 @@ func (ch *Channel) serve() {
431434

432435
// Ping sends a ping message to the given hostPort and waits for a response.
433436
func (ch *Channel) Ping(ctx context.Context, hostPort string) error {
434-
peer := ch.rootPeers().GetOrAdd(hostPort)
437+
peer := ch.RootPeers().GetOrAdd(hostPort)
435438
conn, err := peer.GetConnection(ctx)
436439
if err != nil {
437440
return err
@@ -524,7 +527,7 @@ func (ch *Channel) exchangeUpdated(c *Connection) {
524527
return
525528
}
526529

527-
p, ok := ch.rootPeers().Get(c.remotePeerInfo.HostPort)
530+
p, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort)
528531
if !ok {
529532
return
530533
}
@@ -575,7 +578,7 @@ func (ch *Channel) connectionActive(c *Connection, direction connectionDirection
575578
}
576579

577580
func (ch *Channel) addConnectionToPeer(hostPort string, c *Connection, direction connectionDirection) {
578-
p := ch.rootPeers().GetOrAdd(hostPort)
581+
p := ch.RootPeers().GetOrAdd(hostPort)
579582
if err := p.addConnection(c, direction); err != nil {
580583
c.log.WithFields(
581584
LogField{"remoteHostPort", c.remotePeerInfo.HostPort},
@@ -620,13 +623,13 @@ func (ch *Channel) getMinConnectionState() connectionState {
620623
// connectionCloseStateChange is called when a connection's close state changes.
621624
func (ch *Channel) connectionCloseStateChange(c *Connection) {
622625
ch.removeClosedConn(c)
623-
if peer, ok := ch.rootPeers().Get(c.remotePeerInfo.HostPort); ok {
626+
if peer, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort); ok {
624627
peer.connectionCloseStateChange(c)
625628
ch.updatePeer(peer)
626629
}
627630
if c.outboundHP != "" && c.outboundHP != c.remotePeerInfo.HostPort {
628631
// Outbound connections may be in multiple peers.
629-
if peer, ok := ch.rootPeers().Get(c.outboundHP); ok {
632+
if peer, ok := ch.RootPeers().Get(c.outboundHP); ok {
630633
peer.connectionCloseStateChange(c)
631634
ch.updatePeer(peer)
632635
}

introspection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (ch *Channel) IntrospectState(opts *IntrospectionOptions) *RuntimeState {
216216
CreatedStack: ch.createdStack,
217217
LocalPeer: ch.PeerInfo(),
218218
SubChannels: ch.subChannels.IntrospectState(opts),
219-
RootPeers: ch.rootPeers().IntrospectState(opts),
219+
RootPeers: ch.RootPeers().IntrospectState(opts),
220220
Peers: ch.Peers().IntrospectList(opts),
221221
NumConnections: numConns,
222222
Connections: connIDs,

relay.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func NewRelayer(ch *Channel, conn *Connection) *Relayer {
196196
localHandler: ch.relayLocal,
197197
outbound: newRelayItems(ch.Logger().WithFields(LogField{"relay", "outbound"})),
198198
inbound: newRelayItems(ch.Logger().WithFields(LogField{"relay", "inbound"})),
199-
peers: ch.rootPeers(),
199+
peers: ch.RootPeers(),
200200
conn: conn,
201201
logger: conn.log,
202202
}

testutils/data.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ var (
3737

3838
func checkCacheSize(n int) {
3939
// Start with a reasonably large cache.
40-
if n < 8 {
41-
n = 8
40+
if n < 1024 {
41+
n = 1024
4242
}
4343

4444
randMut.RLock()

thrift/thrift-gen/compile_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ var (
5050
func TestMain(m *testing.M) {
5151
exitCode := m.Run()
5252

53-
// If we created a fake GOPATH, we should clean it up.
54-
if _testGoPath != "" {
53+
// If we created a fake GOPATH, we should clean it up on success.
54+
if _testGoPath != "" && exitCode == 0 {
5555
os.RemoveAll(_testGoPath)
5656
}
5757

@@ -193,7 +193,7 @@ func TestExternalTemplate(t *testing.T) {
193193
}
194194

195195
// Verify the contents of the extra file.
196-
outFile := filepath.Join(dir, packageName(templateFile)+"-service_extend.go")
196+
outFile := filepath.Join(dir, defaultPackageName(templateFile)+"-service_extend.go")
197197
return verifyFileContents(outFile, expected)
198198
}
199199
if err := runTest(t, opts, checks); err != nil {
@@ -301,7 +301,7 @@ func checkDirectoryFiles(dir string, n int) error {
301301

302302
func runBuildTest(t *testing.T, thriftFile string) error {
303303
extraChecks := func(dir string) error {
304-
return checkDirectoryFiles(filepath.Join(dir, packageName(thriftFile)), 4)
304+
return checkDirectoryFiles(filepath.Join(dir, defaultPackageName(thriftFile)), 4)
305305
}
306306

307307
opts := processOptions{InputFile: thriftFile}

thrift/thrift-gen/extends.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func setExtends(state map[string]parseState) error {
4545
searchFor = s.Extends
4646
} else {
4747
include := v.global.includes[parts[0]]
48+
s.ExtendsPrefix = include.pkg + "."
4849
searchServices = state[include.file].services
4950
searchFor = parts[1]
5051
}

thrift/thrift-gen/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func runThrift(inFile string, outDir string) error {
7171
}
7272

7373
// Delete any existing generated code for this Thrift file.
74-
genDir := filepath.Join(outDir, packageName(inFile))
74+
genDir := filepath.Join(outDir, defaultPackageName(inFile))
7575
if err := execCmd("rm", "-rf", genDir); err != nil {
7676
return fmt.Errorf("failed to delete directory %s: %v", genDir, err)
7777
}

0 commit comments

Comments
 (0)