yarpc

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntityDefinitionToThrift

func EntityDefinitionToThrift(ed *dosa.EntityDefinition) *dosarpc.EntityDefinition

EntityDefinitionToThrift converts the client EntityDefinition to the RPC EntityDefinition

func ErrorIsConnectionRefused

func ErrorIsConnectionRefused(err error) bool

ErrorIsConnectionRefused check if the error is "ErrConnectionRefused"

func ErrorIsInvalidHandler

func ErrorIsInvalidHandler(err error) bool

ErrorIsInvalidHandler check if the error is "ErrInvalidHandler"

func FromThriftToEntityDefinition

func FromThriftToEntityDefinition(ed *dosarpc.EntityDefinition) *dosa.EntityDefinition

FromThriftToEntityDefinition converts the RPC EntityDefinition to client EntityDefinition

func FromThriftToPrimaryKey

func FromThriftToPrimaryKey(key *dosarpc.PrimaryKey) *dosa.PrimaryKey

FromThriftToPrimaryKey converts thrift primary key type to dosa primary key type

func PrimaryKeyToThrift

func PrimaryKeyToThrift(key *dosa.PrimaryKey) *dosarpc.PrimaryKey

PrimaryKeyToThrift converts the dosa primary key to the thrift primary key type

func RPCTypeFromClientType

func RPCTypeFromClientType(t dosa.Type) dosarpc.ElemType

RPCTypeFromClientType returns the RPC ElemType from a DOSA Type

func RPCTypeToClientType

func RPCTypeToClientType(t dosarpc.ElemType) dosa.Type

RPCTypeToClientType returns the DOSA Type from RPC ElemType

func RawValueAsInterface

func RawValueAsInterface(val dosarpc.RawValue, typ dosa.Type) interface{}

RawValueAsInterface converts a value from the wire to an object implementing the interface based on the dosa type. For example, a TUUID type will get a dosa.UUID object

func RawValueFromInterface

func RawValueFromInterface(i interface{}) (*dosarpc.RawValue, error)

RawValueFromInterface takes an interface, introspects the type, and then returns a RawValue object that represents this. It panics if the type is not in the list, which should be a dosa bug

func VersionHeader

func VersionHeader() rpc.CallOption

VersionHeader returns the rpc style version header

Types

type Config

type Config struct {
	Transport    string                  `yaml:"transport"`
	Host         string                  `yaml:"host"`
	Port         string                  `yaml:"port"`
	CallerName   string                  `yaml:"callerName"`
	ServiceName  string                  `yaml:"serviceName"`
	ClientConfig *transport.ClientConfig `yaml:"clientConfig"`
}

Config contains the YARPC client parameters

type Connector

type Connector struct {
	base.Connector
	Client dosaclient.Interface
	Config *Config
	// contains filtered or unexported fields
}

Connector holds the client-side RPC interface and some schema information

func NewConnector

func NewConnector(cfg *Config) (*Connector, error)

NewConnector returns a new YARPC connector with the given configuration.

func NewConnectorWithChannel

func NewConnectorWithChannel(ch tchannel.Channel) (*Connector, error)

NewConnectorWithChannel creates a new instance using the given tchannel. Note that the method refers to the YARPC tchannel interface which should be satisfied in order to be used with this connector (and YARPC). Use this if you are using a raw TChannel configuration instead of YARPC directly.

func NewConnectorWithTransport

func NewConnectorWithTransport(cc transport.ClientConfig) *Connector

NewConnectorWithTransport creates a new instance with user provided transport

func (*Connector) CheckSchema

func (c *Connector) CheckSchema(ctx context.Context, scope, namePrefix string, eds []*dosa.EntityDefinition) (int32, error)

CheckSchema is one way to register a set of entities. This can be further validated by a schema service downstream.

func (*Connector) CheckSchemaStatus

func (c *Connector) CheckSchemaStatus(ctx context.Context, scope, namePrefix string, version int32) (*dosa.SchemaStatus, error)

CheckSchemaStatus checks the status of specific version of schema

func (*Connector) CreateIfNotExists

func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error

CreateIfNotExists ...

func (*Connector) CreateScope

func (c *Connector) CreateScope(ctx context.Context, scope string) error

CreateScope creates the scope specified

func (*Connector) DropScope

func (c *Connector) DropScope(ctx context.Context, scope string) error

DropScope removes the scope specified

func (*Connector) MultiRead

func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, minimumFields []string) ([]*dosa.FieldValuesOrError, error)

MultiRead reads multiple entities at one time

func (*Connector) MultiRemove

func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiKeys []map[string]dosa.FieldValue) ([]error, error)

MultiRemove is not yet implemented

func (*Connector) MultiUpsert

func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) ([]error, error)

MultiUpsert is not yet implemented

func (*Connector) Range

func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Range does a scan across a range

func (*Connector) Read

func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, minimumFields []string) (map[string]dosa.FieldValue, error)

Read reads a single entity

func (*Connector) Remove

func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error

Remove marshals a request to the YaRPC remove call

func (*Connector) RemoveRange

func (c *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error

RemoveRange removes all entities within the range specified by the columnConditions.

func (*Connector) Scan

func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Scan marshals a scan request into YaRPC

func (*Connector) ScopeExists

func (c *Connector) ScopeExists(ctx context.Context, scope string) (bool, error)

ScopeExists is not implemented yet

func (*Connector) Search

func (c *Connector) Search(ctx context.Context, ei *dosa.EntityInfo, fieldPairs dosa.FieldNameValuePair, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)

Search is not yet implemented

func (*Connector) Shutdown

func (c *Connector) Shutdown() error

Shutdown stops the dispatcher and drains client

func (*Connector) TruncateScope

func (c *Connector) TruncateScope(ctx context.Context, scope string) error

TruncateScope truncates all data in the scope specified

func (*Connector) Upsert

func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error

Upsert inserts or updates your data

func (*Connector) UpsertSchema

func (c *Connector) UpsertSchema(ctx context.Context, scope, namePrefix string, eds []*dosa.EntityDefinition) (*dosa.SchemaStatus, error)

UpsertSchema upserts the schema through RPC

type ErrConnectionRefused

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

ErrConnectionRefused is used to help deliver a better error message when users have misconfigured the yarpc connector

func (*ErrConnectionRefused) Error

func (e *ErrConnectionRefused) Error() string

Error implements the error interface

type ErrInvalidHandler

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

ErrInvalidHandler is used to help deliver a better error message when users have misconfigured the yarpc connector

func (*ErrInvalidHandler) Error

func (e *ErrInvalidHandler) Error() string

Error implements the error interface

Jump to

Keyboard shortcuts

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