yarpc

package
v3.4.30+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETLStateToThrift

func ETLStateToThrift(etl dosa.ETLState) dosarpc.ETLState

ETLStateToThrift convert the dosa ETLState to the thrift ETLState enum type

func EntityDefsToThrift

func EntityDefsToThrift(eds []*dosa.EntityDefinition) []*dosarpc.EntityDefinition

EntityDefsToThrift coverts a set of client EntityDefinition to the corresponding RPC EntityDefinitions

func ErrorIsConnectionRefused

func ErrorIsConnectionRefused(err error) bool

ErrorIsConnectionRefused check if the error is "ErrConnectionRefused"

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 RPCTagsFromClientTags

func RPCTagsFromClientTags(tags map[string]string) []*dosarpc.FieldTag

RPCTagsFromClientTags converts tags to the RPC version.

func RPCTagsToClientTags

func RPCTagsToClientTags(rpcTags []*dosarpc.FieldTag) map[string]string

RPCTagsToClientTags converts thrift tags to a map.

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

Types

type ClientConfig

type ClientConfig struct {
	Scope      string `yaml:"scope"`
	NamePrefix string `yaml:"namePrefix"`
	Yarpc      Config `yaml:"yarpc"`
}

ClientConfig represents the settings for the dosa client based on a yarpc connector.

func (ClientConfig) NewClient

func (c ClientConfig) NewClient(entities ...dosa.DomainObject) (dosa.Client, error)

NewClient creates a DOSA client based on a ClientConfig

type Config

type Config struct {
	Host         string `yaml:"host"`
	Port         string `yaml:"port"`
	CallerName   string `yaml:"callerName"`
	ServiceName  string `yaml:"serviceName"`
	Transport    string `yaml:"transport"`
	ExtraHeaders map[string]string
}

Config contains the YARPC connector parameters.

type Connector

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

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

func NewConnector

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

NewConnector creates a new instance with user provided transport

func (*Connector) CanUpsertSchema

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

CanUpsertSchema checks whether the provided entities are compatible with the latest applied schema. A non-nil error indicates the entities are not backward-compatible with the latest schema, thus will fail if they were to be upserted.

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, md *dosa.ScopeMetadata) 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) GetEntitySchema

func (c *Connector) GetEntitySchema(ctx context.Context, scope, namePrefix, entityName string, version int32) (*dosa.EntityDefinition, error)

GetEntitySchema gets the schema for the specified entity.

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 upserts multiple entities at one time

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) 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

Jump to

Keyboard shortcuts

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