Documentation ¶
Index ¶
- func ETLStateToThrift(etl dosa.ETLState) dosarpc.ETLState
- func EntityDefsToThrift(eds []*dosa.EntityDefinition) []*dosarpc.EntityDefinition
- func ErrorIsConnectionRefused(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 RPCTagsFromClientTags(tags map[string]string) []*dosarpc.FieldTag
- func RPCTagsToClientTags(rpcTags []*dosarpc.FieldTag) map[string]string
- 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)
- type ClientConfig
- type Config
- type Connector
- func (c *Connector) CanUpsertSchema(ctx context.Context, scope, namePrefix string, eds []*dosa.EntityDefinition) (int32, error)
- 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, md *dosa.ScopeMetadata) error
- func (c *Connector) DropScope(ctx context.Context, scope string) error
- func (c *Connector) GetEntitySchema(ctx context.Context, scope, namePrefix, entityName string, version int32) (*dosa.EntityDefinition, 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) 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ETLStateToThrift ¶
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 ¶
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 ¶
RPCTagsFromClientTags converts tags to the RPC version.
func RPCTagsToClientTags ¶
RPCTagsToClientTags converts thrift tags to a map.
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
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 ¶
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 ¶
CreateScope creates 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 ¶
ScopeExists is not implemented yet
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