Documentation ¶
Overview ¶
Package keyvalue is generated code used to make or handle TChannel calls using Thrift.
Index ¶
- func NewTChanKeyValueServiceInheritedClient(thriftService string, client thrift.TChanClient) *tchanKeyValueServiceClient
- func NewTChanKeyValueServiceServer(handler TChanKeyValueService) thrift.TChanServer
- type KeyValueServiceConfiguration
- type KeyValueServiceGetAllConfiguration
- type KeyValueServiceGetConfiguration
- type KeyValueServiceSetConfiguration
- type RingpopKeyValueServiceAdapter
- func (a *RingpopKeyValueServiceAdapter) Get(ctx thrift.Context, key string) (r string, err error)
- func (a *RingpopKeyValueServiceAdapter) GetAll(ctx thrift.Context, keys []string) (r []string, err error)
- func (a *RingpopKeyValueServiceAdapter) GetLocalClient() interface{}
- func (a *RingpopKeyValueServiceAdapter) MakeRemoteClient(client thrift.TChanClient) interface{}
- func (a *RingpopKeyValueServiceAdapter) Set(ctx thrift.Context, key string, value string) (err error)
- type TChanKeyValueService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTChanKeyValueServiceInheritedClient ¶
func NewTChanKeyValueServiceInheritedClient(thriftService string, client thrift.TChanClient) *tchanKeyValueServiceClient
func NewTChanKeyValueServiceServer ¶
func NewTChanKeyValueServiceServer(handler TChanKeyValueService) thrift.TChanServer
NewTChanKeyValueServiceServer wraps a handler for TChanKeyValueService so it can be registered with a thrift.Server.
Types ¶
type KeyValueServiceConfiguration ¶
type KeyValueServiceConfiguration struct { // Get holds the forwarding configuration for the Get endpoint defined in the service Get *KeyValueServiceGetConfiguration // GetAll holds the forwarding configuration for the GetAll endpoint defined in the service GetAll *KeyValueServiceGetAllConfiguration // Set holds the forwarding configuration for the Set endpoint defined in the service Set *KeyValueServiceSetConfiguration }
KeyValueServiceConfiguration contains the forwarding configuration for the KeyValueService service. It has a field for every endpoint defined in the service. In this field the endpoint specific forward configuration can be stored. Populating these fields is optional, default behaviour is to call the service implementation locally to the process where the call came in.
type KeyValueServiceGetAllConfiguration ¶
type KeyValueServiceGetAllConfiguration struct { // Key is a closure that generates a routable key based on the parameters of the incomming request. Key func(ctx thrift.Context, keys []string) (string, error) }
KeyValueServiceGetAllConfiguration contains the configuration on how to route calls to the thrift endpoint KeyValueService::GetAll.
type KeyValueServiceGetConfiguration ¶
type KeyValueServiceGetConfiguration struct { // Key is a closure that generates a routable key based on the parameters of the incomming request. Key func(ctx thrift.Context, key string) (string, error) }
KeyValueServiceGetConfiguration contains the configuration on how to route calls to the thrift endpoint KeyValueService::Get.
type KeyValueServiceSetConfiguration ¶
type KeyValueServiceSetConfiguration struct { // Key is a closure that generates a routable key based on the parameters of the incomming request. Key func(ctx thrift.Context, key string, value string) (string, error) }
KeyValueServiceSetConfiguration contains the configuration on how to route calls to the thrift endpoint KeyValueService::Set.
type RingpopKeyValueServiceAdapter ¶
type RingpopKeyValueServiceAdapter struct {
// contains filtered or unexported fields
}
func (*RingpopKeyValueServiceAdapter) Get ¶
Get satisfies the TChanKeyValueService interface. This function uses the configuration for Get to determine the host to execute the call on. When it decides the call needs to be executed in the current process it will forward the invocation to its local implementation.
func (*RingpopKeyValueServiceAdapter) GetAll ¶
func (a *RingpopKeyValueServiceAdapter) GetAll(ctx thrift.Context, keys []string) (r []string, err error)
GetAll satisfies the TChanKeyValueService interface. This function uses the configuration for GetAll to determine the host to execute the call on. When it decides the call needs to be executed in the current process it will forward the invocation to its local implementation.
func (*RingpopKeyValueServiceAdapter) GetLocalClient ¶
func (a *RingpopKeyValueServiceAdapter) GetLocalClient() interface{}
GetLocalClient satisfies the ClientFactory interface of ringpop-go/router
func (*RingpopKeyValueServiceAdapter) MakeRemoteClient ¶
func (a *RingpopKeyValueServiceAdapter) MakeRemoteClient(client thrift.TChanClient) interface{}
MakeRemoteClient satisfies the ClientFactory interface of ringpop-go/router
func (*RingpopKeyValueServiceAdapter) Set ¶
func (a *RingpopKeyValueServiceAdapter) Set(ctx thrift.Context, key string, value string) (err error)
Set satisfies the TChanKeyValueService interface. This function uses the configuration for Set to determine the host to execute the call on. When it decides the call needs to be executed in the current process it will forward the invocation to its local implementation.
type TChanKeyValueService ¶
type TChanKeyValueService interface { Get(ctx thrift.Context, key string) (string, error) GetAll(ctx thrift.Context, keys []string) ([]string, error) Set(ctx thrift.Context, key string, value string) error }
TChanKeyValueService is the interface that defines the server handler and client interface.
func NewRingpopKeyValueServiceAdapter ¶
func NewRingpopKeyValueServiceAdapter( impl TChanKeyValueService, rp ringpop.Interface, ch *tchannel.Channel, config KeyValueServiceConfiguration, ) (TChanKeyValueService, error)
Set: &KeyValueServiceSetConfiguration: { Key: func(ctx thrift.Context, key string, value string) (shardKey string, err error) { return "calculated-shard-key", nil }, }, },
) server.Register(NewTChanKeyValueServiceServer(adapter))
func NewTChanKeyValueServiceClient ¶
func NewTChanKeyValueServiceClient(client thrift.TChanClient) TChanKeyValueService
NewTChanKeyValueServiceClient creates a client that can be used to make remote calls.