shard

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MPL-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	V1 = 1

	Unmanaged = -1
)

Variables

View Source
var (
	PluginMap = map[string]plugin.Plugin{
		"provider": &Plugin{},
	}
	VersionPluginMap = map[int]plugin.PluginSet{
		V1: PluginMap,
	}
)

Functions

func ToPbDiagnostics

func ToPbDiagnostics(diagnostics *schema.Diagnostics) []*internal.Diagnostic

func ToPbGetProviderInitResponse

func ToPbGetProviderInitResponse(response *ProviderInitResponse) *internal.ProviderInit_Response

func ToPbProviderInitRequest

func ToPbProviderInitRequest(request *ProviderInitRequest) *internal.ProviderInit_Request

func ToPbPullTablesRequest

func ToPbPullTablesRequest(in *PullTablesRequest) *internal.PullTables_Request

func ToPbSchemaColumn

func ToPbSchemaColumn(column *schema.Column) *internal.Column

func ToPbSchemaColumns

func ToPbSchemaColumns(columns []*schema.Column) []*internal.Column

func ToPbSchemaTable

func ToPbSchemaTable(table *schema.Table) *internal.Table

func ToPbSchemaTablesByList

func ToPbSchemaTablesByList(tables []*schema.Table) []*internal.Table

func ToPbSchemaTablesByMap

func ToPbSchemaTablesByMap(tables map[string]*schema.Table) map[string]*internal.Table

func ToPbStorage

func ToPbStorage(storage *Storage) *internal.Storage

func ToSchemaColumn

func ToSchemaColumn(column *internal.Column) *schema.Column

func ToSchemaColumns

func ToSchemaColumns(columns []*internal.Column) []*schema.Column

func ToSchemaTable

func ToSchemaTable(table *internal.Table) *schema.Table

func ToSchemaTablesByList

func ToSchemaTablesByList(tables []*internal.Table) []*schema.Table

func ToSchemaTablesByMap

func ToSchemaTablesByMap(tables map[string]*internal.Table) map[string]*schema.Table

func ToShardDiagnostics

func ToShardDiagnostics(pbDiagnosticSlice []*internal.Diagnostic) *schema.Diagnostics

Types

type FakeProviderServerSender

type FakeProviderServerSender struct {
	ProviderServerSender
}

FakeProviderServerSender The Provider simulates RPC calls when doing integration tests

func NewFakeProviderServerSender

func NewFakeProviderServerSender() *FakeProviderServerSender

func (*FakeProviderServerSender) Send

type GRPCClient

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

func (*GRPCClient) GetProviderConfig

func (*GRPCClient) GetProviderInformation

func (*GRPCClient) Init

func (*GRPCClient) PullTables

func (*GRPCClient) SetProviderConfig

type GetProviderConfigRequest

type GetProviderConfigRequest struct{}

type GetProviderConfigResponse

type GetProviderConfigResponse struct {
	Name        string              `json:"name"`
	Version     string              `json:"version"`
	Config      string              `json:"config"`
	Diagnostics *schema.Diagnostics `json:"diagnostics"`
}

type GetProviderInformationRequest

type GetProviderInformationRequest struct{}

type GetProviderInformationResponse

type GetProviderInformationResponse struct {
	Name    string                   `json:"name"`
	Version string                   `json:"version"`
	Tables  map[string]*schema.Table `json:"tables"`

	DefaultConfigTemplate string `json:"default_config_template"`

	Diagnostics *schema.Diagnostics
}

type Plugin

type Plugin struct {
	// GRPCPlugin must still implement the Stub interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl ProviderServer
}

Plugin This is the implementation of plugin.GRPCServer so we can serve/consume this.

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error)

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type ProviderClient

type ProviderClient interface {
	Provider
	PullTables(ctx context.Context, in *PullTablesRequest) (ProviderServerStream, error)
}

type ProviderConfiguration

type ProviderConfiguration struct {
	Storage Storage `json:"storage"`

	NamespaceSuffix string `json:"namespace_suffix"`
}

ProviderConfiguration Provider General configuration

type ProviderCreateAllTablesRequest

type ProviderCreateAllTablesRequest struct{}

type ProviderCreateAllTablesResponse

type ProviderCreateAllTablesResponse struct {
	Diagnostics *schema.Diagnostics `json:"diagnostics"`
}

type ProviderDropTableAllRequest

type ProviderDropTableAllRequest struct{}

type ProviderDropTableAllResponse

type ProviderDropTableAllResponse struct {
	Diagnostics *schema.Diagnostics `json:"diagnostics"`
}

type ProviderInitRequest

type ProviderInitRequest struct {
	Storage        *Storage
	Workspace      *string
	ProviderConfig *string
	IsInstallInit  *bool
}

func ToShardProviderInitRequest

func ToShardProviderInitRequest(request *internal.ProviderInit_Request) *ProviderInitRequest

type ProviderInitResponse

type ProviderInitResponse struct {
	Diagnostics *schema.Diagnostics `json:"diagnostics"`
}

func ToShardProviderInitResponse

func ToShardProviderInitResponse(response *internal.ProviderInit_Response) *ProviderInitResponse

type ProviderServer

type ProviderServer interface {
	Provider
	PullTables(context.Context, *PullTablesRequest, ProviderServerSender) error
}

type ProviderServerSender

type ProviderServerSender interface {
	Send(*PullTablesResponse) error
}

type ProviderServerStream

type ProviderServerStream interface {
	Recv() (*PullTablesResponse, error)
}

type PullTablesRequest

type PullTablesRequest struct {

	// The table to be pulled, this later expands to support parameters
	Tables []string `json:"tables"`

	// Maximum number of threads used
	MaxGoroutines uint64 `json:"max_goroutines"`

	// Pull timeout period
	Timeout int64 `json:"timeout"`
}

func NewPullAllTablesRequest

func NewPullAllTablesRequest() *PullTablesRequest

NewPullAllTablesRequest The Provider integration test simulates the RPC environment

func ToShardPullTablesRequest

func ToShardPullTablesRequest(in *internal.PullTables_Request) *PullTablesRequest

type PullTablesResponse

type PullTablesResponse struct {
	FinishedTables map[string]bool     `json:"finished_tables"`
	TableCount     uint64              `json:"table_count"`
	Table          string              `json:"table"`
	Diagnostics    *schema.Diagnostics `json:"diagnostic"`
}

func ToShardPullTablesResponse

func ToShardPullTablesResponse(in *internal.PullTables_Response) *PullTablesResponse

type Recv

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

func (*Recv) Recv

func (t *Recv) Recv() (*PullTablesResponse, error)

type Send

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

func (*Send) Send

func (s *Send) Send(p *PullTablesResponse) error

type SetProviderConfigRequest

type SetProviderConfigRequest struct {
	Storage        *Storage `json:"storage"`
	ProviderConfig *string  `json:"provider_config"`
}

type SetProviderConfigResponse

type SetProviderConfigResponse struct {
	Diagnostics *schema.Diagnostics `json:"diagnostics"`
}

type Storage

type Storage struct {
	Type           StorageType `json:"type"`
	StorageOptions []byte      `json:"options"`
}

func ToShardStorage

func ToShardStorage(storage *internal.Storage) *Storage

func (*Storage) GetStorageOptions

func (x *Storage) GetStorageOptions() storage.CreateStorageOptions

func (*Storage) GetStorageType

func (x *Storage) GetStorageType() storage_factory.StorageType

type StorageType

type StorageType int
const (
	POSTGRESQL StorageType = iota
	MYSQL
)

Jump to

Keyboard shortcuts

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