keyvalue

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package keyvalue is generated code used to make or handle TChannel calls using Thrift.

Index

Constants

This section is empty.

Variables

View Source
var GoUnusedProtection__ int
View Source
var KeyValueServiceGetAllResult_Success_DEFAULT []string
View Source
var KeyValueServiceGetResult_Success_DEFAULT string

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 KeyValueService

type KeyValueService interface {
	// Parameters:
	//  - Key
	//  - Value
	Set(key string, value string) (err error)
	// Parameters:
	//  - Key
	Get(key string) (r string, err error)
	// Parameters:
	//  - Keys
	GetAll(keys []string) (r []string, err error)
}

type KeyValueServiceClient

type KeyValueServiceClient struct {
	Transport       thrift.TTransport
	ProtocolFactory thrift.TProtocolFactory
	InputProtocol   thrift.TProtocol
	OutputProtocol  thrift.TProtocol
	SeqId           int32
}

func NewKeyValueServiceClientProtocol

func NewKeyValueServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *KeyValueServiceClient

func (*KeyValueServiceClient) Get

func (p *KeyValueServiceClient) Get(key string) (r string, err error)

Parameters:

  • Key

func (*KeyValueServiceClient) GetAll

func (p *KeyValueServiceClient) GetAll(keys []string) (r []string, err error)

Parameters:

  • Keys

func (*KeyValueServiceClient) Set

func (p *KeyValueServiceClient) Set(key string, value string) (err error)

Parameters:

  • Key
  • Value

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 KeyValueServiceGetAllArgs

type KeyValueServiceGetAllArgs struct {
	Keys []string `thrift:"keys,1" json:"keys"`
}

Attributes:

  • Keys

func NewKeyValueServiceGetAllArgs

func NewKeyValueServiceGetAllArgs() *KeyValueServiceGetAllArgs

func (*KeyValueServiceGetAllArgs) GetKeys

func (p *KeyValueServiceGetAllArgs) GetKeys() []string

func (*KeyValueServiceGetAllArgs) Read

func (*KeyValueServiceGetAllArgs) String

func (p *KeyValueServiceGetAllArgs) String() string

func (*KeyValueServiceGetAllArgs) Write

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 KeyValueServiceGetAllResult

type KeyValueServiceGetAllResult struct {
	Success []string `thrift:"success,0" json:"success,omitempty"`
}

Attributes:

  • Success

func NewKeyValueServiceGetAllResult

func NewKeyValueServiceGetAllResult() *KeyValueServiceGetAllResult

func (*KeyValueServiceGetAllResult) GetSuccess

func (p *KeyValueServiceGetAllResult) GetSuccess() []string

func (*KeyValueServiceGetAllResult) IsSetSuccess

func (p *KeyValueServiceGetAllResult) IsSetSuccess() bool

func (*KeyValueServiceGetAllResult) Read

func (*KeyValueServiceGetAllResult) String

func (p *KeyValueServiceGetAllResult) String() string

func (*KeyValueServiceGetAllResult) Write

type KeyValueServiceGetArgs

type KeyValueServiceGetArgs struct {
	Key string `thrift:"key,1" json:"key"`
}

Attributes:

  • Key

func NewKeyValueServiceGetArgs

func NewKeyValueServiceGetArgs() *KeyValueServiceGetArgs

func (*KeyValueServiceGetArgs) GetKey

func (p *KeyValueServiceGetArgs) GetKey() string

func (*KeyValueServiceGetArgs) Read

func (*KeyValueServiceGetArgs) String

func (p *KeyValueServiceGetArgs) String() string

func (*KeyValueServiceGetArgs) Write

func (p *KeyValueServiceGetArgs) Write(oprot thrift.TProtocol) error

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 KeyValueServiceGetResult

type KeyValueServiceGetResult struct {
	Success *string `thrift:"success,0" json:"success,omitempty"`
}

Attributes:

  • Success

func NewKeyValueServiceGetResult

func NewKeyValueServiceGetResult() *KeyValueServiceGetResult

func (*KeyValueServiceGetResult) GetSuccess

func (p *KeyValueServiceGetResult) GetSuccess() string

func (*KeyValueServiceGetResult) IsSetSuccess

func (p *KeyValueServiceGetResult) IsSetSuccess() bool

func (*KeyValueServiceGetResult) Read

func (*KeyValueServiceGetResult) String

func (p *KeyValueServiceGetResult) String() string

func (*KeyValueServiceGetResult) Write

type KeyValueServiceProcessor

type KeyValueServiceProcessor struct {
	// contains filtered or unexported fields
}

func NewKeyValueServiceProcessor

func NewKeyValueServiceProcessor(handler KeyValueService) *KeyValueServiceProcessor

func (*KeyValueServiceProcessor) AddToProcessorMap

func (p *KeyValueServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*KeyValueServiceProcessor) GetProcessorFunction

func (p *KeyValueServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*KeyValueServiceProcessor) Process

func (p *KeyValueServiceProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*KeyValueServiceProcessor) ProcessorMap

type KeyValueServiceSetArgs

type KeyValueServiceSetArgs struct {
	Key   string `thrift:"key,1" json:"key"`
	Value string `thrift:"value,2" json:"value"`
}

Attributes:

  • Key
  • Value

func NewKeyValueServiceSetArgs

func NewKeyValueServiceSetArgs() *KeyValueServiceSetArgs

func (*KeyValueServiceSetArgs) GetKey

func (p *KeyValueServiceSetArgs) GetKey() string

func (*KeyValueServiceSetArgs) GetValue

func (p *KeyValueServiceSetArgs) GetValue() string

func (*KeyValueServiceSetArgs) Read

func (*KeyValueServiceSetArgs) String

func (p *KeyValueServiceSetArgs) String() string

func (*KeyValueServiceSetArgs) Write

func (p *KeyValueServiceSetArgs) Write(oprot thrift.TProtocol) error

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 KeyValueServiceSetResult

type KeyValueServiceSetResult struct {
}

func NewKeyValueServiceSetResult

func NewKeyValueServiceSetResult() *KeyValueServiceSetResult

func (*KeyValueServiceSetResult) Read

func (*KeyValueServiceSetResult) String

func (p *KeyValueServiceSetResult) String() string

func (*KeyValueServiceSetResult) Write

type RingpopKeyValueServiceAdapter

type RingpopKeyValueServiceAdapter struct {
	// contains filtered or unexported fields
}

func (*RingpopKeyValueServiceAdapter) Get

func (a *RingpopKeyValueServiceAdapter) Get(ctx thrift.Context, key string) (r string, err error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL