Releases: yarpc/yarpc-go
v1.4.0
v1.3.0
- Added a
tchannel.NewTransport
. The new transport, a replacement for the
temporarytchannel.NewChannelTransport
, supports YARPC peer choosers.
transport, err := tchannel.NewTransport(tchannel.ServiceName("keyvalue"))
chooser := peerheap.New(transport)
outbound := transport.NewOutbound(chooser)
The new transport hides the implementation of TChannel entirely to give us
flexibility going forward to relieve TChannel of all RPC-related
responsibilities, leaving only the wire protocol at its core.
As a consequence, you cannot thread an existing Channel through this
transport.
- All outbounds now support
Call
beforeStart
and all peer choosers now
supportChoose
beforeStart
, within the context deadline.
These would previously return an error indicating that the component was
not yet started. They now wait for the component to start, or for their
deadline to expire.
v1.2.0
- Added heap based PeerList under
peer/x/peerheap
. - Added
RouterMiddleware
parameter toyarpc.Config
, which, if provided,
will allow customizing routing to handlers. - Added experimental
transports/x/cherami
for transporting RPCs through
Cherami. - Added ability to specify a ServiceName for outbounds on the
transport.Outbounds object. This will allow defining outbounds with a
key
that is different from the service name they will use for requests.
If no ServiceName is specified, the ServiceName will fallback to the
config.Outbounds mapkey
.
Before:
config.Outbounds['service'] := transport.Outbounds{
Unary: httpTransport.NewSingleOutbound(...)
}
...
cc := dispatcher.ClientConfig('service')
cc.Service() // returns 'service'
After (optional):
config.Outbounds['service-key'] := transport.Outbounds{
ServiceName: 'service'
Unary: httpTransport.NewSingleOutbound(...)
}
...
cc := dispatcher.ClientConfig('service-key')
cc.Service() // returns 'service'
v1.1.0
v1.0.1
v1.0.0
v1.0.0-rc5
- Breaking: The ThriftRW plugin now generates code under the subpackages
${service}server
and$[service}client
rather than
yarpc/${service}server
andyarpc/${service}client
.
Given a kv.thrift
that defines a KeyValue
service, previously the
imports would be,
import ".../kv/yarpc/keyvalueserver"
import ".../kv/yarpc/keyvalueclient"
The same packages will now be available at,
import ".../kv/keyvalueserver"
import ".../kv/keyvalueclient"
- Breaking:
NewChannelTransport
can now return an error upon
construction. - Breaking:
http.URLTemplate
has no effect onhttp.NewSingleOutbound
. http.Transport.NewOutbound
now acceptshttp.OutboundOption
s.
v1.0.0-rc4
- Breaking: Removed the
yarpc.ReqMeta
andyarpc.ResMeta
types. To
migrate your handlers, simply drop the argument and the return value from
your handler definition.
Before:
func (h *myHandler) Handle(ctx context.Context, reqMeta yarpc.ReqMeta, ...) (..., yarpc.ResMeta, error) {
// ...
}
After:
func (h *myHandler) Handle(ctx context.Context, ...) (..., error) {
// ...
}
To access information previously available in the yarpc.ReqMeta
or to
write response headers, use the yarpc.CallFromContext
function.
- Breaking: Removed the
yarpc.CallReqMeta
andyarpc.CallResMeta
types. To migrate your call sites, drop the argument and remove the return
value.
Before:
res, resMeta, err := client.Call(ctx, reqMeta, ...)
After:
res, err := client.Call(ctx, ...)
Use yarpc.CallOption
s to specify per-request options and
yarpc.ResponseHeaders
to receive response headers for the call.
- Breaking: Removed
yarpc.Headers
in favor ofmap[string]string
. - Breaking:
yarpc.Dispatcher
no longer implements the
transport.Router
interface. - Breaking: Start and Stop for Inbound and Outbound are now expected to
be idempotent. - Breaking: Combine
ServiceProcedure
andRegistrant
intoProcedure
. - Breaking: Rename
Registrar
toRouteTable
. - Breaking: Rename
Registry
toRouter
. - Breaking: Rename
middleware.{Oneway,Unary}{Inbound,Outbound}Middleware
tomiddleware.{Oneway,Unary}{Inbound,Outbound}
- Breaking: Changed
peer.List.Update
to accept apeer.ListUpdates
struct instead of a list of additions and removals - Breaking: yarpc.NewDispatcher now returns a pointer to a
yarpc.Dispatcher. Previously, yarpc.Dispatcher was an interface, now a
concrete struct.
This change will allow us to extend the Dispatcher after the 1.0.0 release
without breaking tests depending on the rigidity of the Dispatcher
interface.
- Breaking:
Peer.StartRequest
andPeer.EndRequest
no longer accept a
dontNotify
argument. - Added
yarpc.IsBadRequestError
,yarpc.IsUnexpectedError
and
yarpc.IsTimeoutError
functions. - Added a
transport.InboundBadRequestError
function to build errors which
satisfytransport.IsBadRequestError
. - Added a
transport.ValidateRequest
function to validate
transport.Request
s.
v1.0.0-rc3
- Moved the
yarpc/internal/crossdock/
andyarpc/internal/examples
folders toyarpc/crossdock/
andyarpc/examples
respectively. - Breaking: Relocated the
go.uber.org/yarpc/transport
package to
go.uber.org/yarpc/api/transport
. In the process themiddleware
logic from transport has been moved togo.uber.org/yarpc/api/middleware
and the concrete implementation of the Registry has been moved from
transport.MapRegistry
toyarpc.MapRegistry
. This did not move the
concrete implementations of http/tchannel from theyarpc/transport/
directory. - Breaking: Relocated the
go.uber.org/yarpc/peer
package to
go.uber.org/yarpc/api/peer
. This does not include the concrete
implementations still in the/yarpc/peer/
directory. - Breaking: This version overhauls the code required for constructing
inbounds and outbounds.
Inbounds and Outbounds now share an underlying Transport, of which there
should be one for each transport protocol, so one HTTP Transport for all
HTTP inbounds and outbounds, and a TChannel transport for all TChannel
inbounds and outbounds.
Before:
ch, err := tchannelProper.NewChannel("example-service", nil)
if err != nil {
log.Fatalln(err)
}
yarpc.NewDispatcher(yarpc.Config{
Name: "example-service",
yarpc.Inbounds{
http.NewInbound(":80"),
tchannel.NewInbound(ch, tchannel.ListenAddr(":4040")),
},
yarpc.Outbounds{
http.NewOutbound("http://example-service/rpc/v1"),
tchannel.NewOutbound(ch, tchannel.HostPort("127.0.0.1:4040")),
},
})
After:
httpTransport := http.NewTransport()
tchannelTransport := tchannel.NewChannelTransport(
tchannel.ServiceName("example-service"),
tchannel.ListenAddr(":4040"),
)
yarpc.NewDispatcher(yarpc.Config{
Name: "example-service",
yarpc.Inbounds{
httpTransport.NewInbound(":80"),
tchannelTransport.NewInbound(),
},
yarpc.Outbounds{
httpTransport.NewSingleOutbound("http://example-service/rpc/v1"),
tchannelTransport.NewSingleOutbound("127.0.0.1:4040"),
},
})
The dispatcher now collects all of the unique transport instances from
inbounds and outbounds and manages their lifecycle independently.
This version repurposed the name NewOutbound
for outbounds with a peer
chooser, whereas NewSingleOutbound
is a convenience for creating an
outbound addressing a specific single peer.
You may need to rename existing usage. The compiler will complain that
strings are not peer.Chooser
instances.
This version introduces support for peer choosers, peer lists, and peer
providers for HTTP outbounds. This is made possible by the above
change that introduces a concrete instance of a Transport for each
protocol, which deduplicates peer instances across all inbounds and
outbounds, making connection sharing and load balancing possible,
eventually for all transport protocols.
Note that we use NewChannelTransport
, as opposed to NewTransport
.
We reserve this name for a future minor release that will provide
parity with HTTP for outbounds with peer choosers.
The new ChannelTransport constructor can still use a shared TChannel
Channel instance, if that is required.
ch, err := tchannelProper.NewChannel("example-service", nil)
if err != nil {
log.Fatalln(err)
}
tchannelTransport := tchannel.NewChannelTransport(
tchannel.WithChannel(ch),
tchannel.ServiceName("example-service"),
tchannel.ListenAddr(":4040"),
)
yarpc.NewDispatcher(yarpc.Config{
Name: "example-service",
yarpc.Inbounds{
tchannelTransport.NewInbound(),
},
})
- Breaking: the
transport.Inbound
andtransport.Outbound
interfaces
now implementStart()
without any arguments.
The dispatcher no longer threads a dependencies object through the start
method of every configured transport. The only existing dependency was an
opentracing Tracer, which you can now thread through Transport constructor
options instead.
Before:
yarpc.NewDispatcher(yarpc.Config{
yarpc.Inbounds{
http.NewInbound(...),
},
yarpc.Outbounds{
"callee": http.NewOutbound(...)
},
Tracer: opentracing.GlobalTracer(),
})
Now:
tracer := opentracing.GlobalTracer()
httpTransport := http.NewTransport(
http.Tracer(tracer),
)
tchannelTransport := tchannel.NewChannelTransport(
tchannel.Tracer(tracer),
)
yarpc.NewDispatcher(yarpc.Config{
Name: "example-service",
yarpc.Inbounds{
httpTransport.NewInbound(":80"),
tchannelTransport.NewInbound(),
},
yarpc.Outbounds{
httpTransport.NewSingleOutbound("http://example-service/rpc/v1"),
tchannelTransport.NewSingleOutbound("127.0.0.1:4040"),
},
})
The yarpc.Config
Tracer
property is still accepted, but unused and
deprecated.
The dispatcher no longer provides a transport.ServiceDetail
as an
argument to Start
on inbound transports. The transport.ServiceDetail
no longer exists. You no longer need to provide the service name to start
an inbound, only a registry. Instead of passing the service detail to start,
the dispatcher now calls inbound.SetRegistry(transport.Registry)
before
calling Start()
.
Custom transport protocols must change their interface accordingly to
satisfy the transport.Inbound
interface. Uses that construct inbounds
manually must either call SetRegistry
or use the WithRegistry
chained
configuration method before calling Start
without a ServiceDetail
.
Before:
inbound := tchannel.NewInbound(...)
err := inbound.Start(
transport.ServiceDetail{
Name: "service",
Registry: registry,
},
transport.NoDeps,
)
Now:
transport := tchannel.NewTransport()
inbound := transport.NewInbound()
inbound.SetRegistry(registry)
err := inbound.Start()
The transport.Deps
struct and transport.NoDeps
instance no longer exist.
- Breaking: TChannel inbound and outbound constructors now return
pointers to Inbound and Outbound structs with private state satisfying the
transport.Inbound
andtransport.Outbound
interfaces. These were
previously transport specific Inbound and Outbound interfaces.
This eliminates unnecessary polymorphism in some cases. - Introduced OpenTracing helpers for transport authors.
- Created the
yarpc.Serialize
package for marshalling RPC messages at rest.
Useful for transports that persist RPC messages. - Tranports have access to
DispatchOnewayHandler
andDispatchUnaryHandler
.
These should be called by alltransport.Inbounds
instead of directly
calling handlers.
v1.0.0-rc2
- Breaking Renamed
Agent
toTransport
. - Breaking Renamed
hostport.Peer
'sAddSubscriber/RemoveSubscriber
toSubscribe/Unsubscribe
. - Breaking Updated
Peer.StartRequest
to take adontNotify
peer.Subscriber
to exempt
from updates. Also addedPeer.EndRequest
function to replace thefinish
callback
fromPeer.StartRequest
. - Breaking Renamed
peer.List
topeer.Chooser
,peer.ChangeListener
topeer.List
andpeer.Chooser.ChoosePeer
topeer.Chooser.Choose
. - Reduced complexity of
single
peer.Chooser
to retain the passed in peer immediately. - Breaking Moved
/peer/list/single.go
to/peer/single/list.go
. - Breaking Moved
/peer/x/list/roundrobin.go
to/peer/x/roundrobin/list.go
. - HTTP Oneway requests will now process http status codes and returns appropriate errors.
- Breaking Update
roundrobin.New
function to stop accepting an initial peer list.
Uselist.Update
to initialize the peers in the list instead. - Breaking: Rename
Channel
toClientConfig
for both the dispatcher
method and the interface.mydispatcher.Channel("myservice")
becomes
mydispatcher.ClientConfig("myservice")
. TheClientConfig
object can
then used to build a new Client as before:
NewMyThriftClient(mydispatcher.ClientConfig("myservice"))
. - A comment is added atop YAML files generated by the recorder to help
understanding where they come from.