Documentation ¶
Index ¶
- func EntityDefinitionToThrift(ed *dosa.EntityDefinition) *dosarpc.EntityDefinition
- func ErrorIsConnectionRefused(err error) bool
- func ErrorIsInvalidHandler(err error) bool
- func FromThriftToEntityDefinition(ed *dosarpc.EntityDefinition) *dosa.EntityDefinition
- func FromThriftToPrimaryKey(key *dosarpc.PrimaryKey) *dosa.PrimaryKey
- func PrimaryKeyToThrift(key *dosa.PrimaryKey) *dosarpc.PrimaryKey
- func RPCTypeFromClientType(t dosa.Type) dosarpc.ElemType
- func RPCTypeToClientType(t dosarpc.ElemType) dosa.Type
- func RawValueAsInterface(val dosarpc.RawValue, typ dosa.Type) interface{}
- func RawValueFromInterface(i interface{}) (*dosarpc.RawValue, error)
- func VersionHeader() rpc.CallOption
- type Config
- type Connector
- func (c *Connector) CheckSchema(ctx context.Context, scope, namePrefix string, eds []*dosa.EntityDefinition) (int32, error)
- func (c *Connector) CheckSchemaStatus(ctx context.Context, scope, namePrefix string, version int32) (*dosa.SchemaStatus, error)
- func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error
- func (c *Connector) CreateScope(ctx context.Context, scope string) error
- func (c *Connector) DropScope(ctx context.Context, scope string) error
- func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, ...) ([]*dosa.FieldValuesOrError, error)
- func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, ...) ([]error, error)
- func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, ...) ([]error, error)
- func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, ...) ([]map[string]dosa.FieldValue, string, error)
- func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, ...) (map[string]dosa.FieldValue, error)
- func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error
- func (c *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, ...) error
- func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, ...) ([]map[string]dosa.FieldValue, string, error)
- func (c *Connector) ScopeExists(ctx context.Context, scope string) (bool, error)
- func (c *Connector) Search(ctx context.Context, ei *dosa.EntityInfo, fieldPairs dosa.FieldNameValuePair, ...) ([]map[string]dosa.FieldValue, string, error)
- func (c *Connector) Shutdown() error
- func (c *Connector) TruncateScope(ctx context.Context, scope string) error
- func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error
- func (c *Connector) UpsertSchema(ctx context.Context, scope, namePrefix string, eds []*dosa.EntityDefinition) (*dosa.SchemaStatus, error)
- type ErrConnectionRefused
- type ErrInvalidHandler
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 ¶
ErrorIsConnectionRefused check if the error is "ErrConnectionRefused"
func ErrorIsInvalidHandler ¶
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 ¶
RPCTypeFromClientType returns the RPC ElemType from a DOSA Type
func RPCTypeToClientType ¶
RPCTypeToClientType returns the DOSA Type from RPC ElemType
func RawValueAsInterface ¶
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 ¶
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 ¶
NewConnector returns a new YARPC connector with the given configuration.
func NewConnectorWithChannel ¶
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 ¶
CreateScope creates 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 ¶
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) TruncateScope ¶
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