specs

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MPL-2.0 Imports: 6 Imported by: 17

README

Deprecation Notice

This is deprecated and used in old versions of plugins SDK (protocol version V1/V2)

Documentation

Overview

Package specs specs for source and destination plugins including parsers and readers.

Index

Constants

This section is empty.

Variables

View Source
var AllBackendNames = [...]string{
	BackendNone:  "none",
	BackendLocal: "local",
}
View Source
var AllSchedulerNames = [...]string{
	SchedulerDFS:        "dfs",
	SchedulerRoundRobin: "round-robin",
}

Functions

func SpecUnmarshalYamlStrict

func SpecUnmarshalYamlStrict(b []byte, spec *Spec) error

func UnmarshalJSONStrict

func UnmarshalJSONStrict(b []byte, out any) error

Types

type Backend

type Backend int
const (
	BackendNone Backend = iota
	BackendLocal
)

func BackendFromString

func BackendFromString(s string) (Backend, error)

func (Backend) MarshalJSON

func (s Backend) MarshalJSON() ([]byte, error)

func (Backend) String

func (s Backend) String() string

func (*Backend) UnmarshalJSON

func (s *Backend) UnmarshalJSON(data []byte) (err error)

type Backends

type Backends []Backend

func (Backends) String

func (s Backends) String() string

type Destination

type Destination struct {
	Name           string      `json:"name,omitempty"`
	Version        string      `json:"version,omitempty"`
	Path           string      `json:"path,omitempty"`
	Registry       Registry    `json:"registry,omitempty"`
	WriteMode      WriteMode   `json:"write_mode,omitempty"`
	MigrateMode    MigrateMode `json:"migrate_mode,omitempty"`
	BatchSize      int         `json:"batch_size,omitempty"`
	BatchSizeBytes int         `json:"batch_size_bytes,omitempty"`
	Spec           any         `json:"spec,omitempty"`
	PKMode         PKMode      `json:"pk_mode,omitempty"`
}

func (*Destination) SetDefaults

func (d *Destination) SetDefaults(defaultBatchSize, defaultBatchSizeBytes int)

func (*Destination) UnmarshalSpec

func (d *Destination) UnmarshalSpec(out any) error

func (*Destination) Validate

func (d *Destination) Validate() error

func (Destination) VersionString

func (d Destination) VersionString() string

type Kind

type Kind int
const (
	KindSource Kind = iota
	KindDestination
)

func KindFromString

func KindFromString(s string) (Kind, error)

func (Kind) MarshalJSON

func (k Kind) MarshalJSON() ([]byte, error)

func (Kind) String

func (k Kind) String() string

func (*Kind) UnmarshalJSON

func (k *Kind) UnmarshalJSON(data []byte) (err error)

type MigrateMode

type MigrateMode int
const (
	MigrateModeSafe MigrateMode = iota
	MigrateModeForced
)

func MigrateModeFromString

func MigrateModeFromString(s string) (MigrateMode, error)

func (MigrateMode) MarshalJSON

func (m MigrateMode) MarshalJSON() ([]byte, error)

func (MigrateMode) String

func (m MigrateMode) String() string

func (*MigrateMode) UnmarshalJSON

func (m *MigrateMode) UnmarshalJSON(data []byte) (err error)

type PKMode

type PKMode int
const (
	PKModeDefaultKeys PKMode = iota
	PKModeCQID
)

func PKModeFromString

func PKModeFromString(s string) (PKMode, error)

func (PKMode) MarshalJSON

func (m PKMode) MarshalJSON() ([]byte, error)

func (PKMode) String

func (m PKMode) String() string

func (*PKMode) UnmarshalJSON

func (m *PKMode) UnmarshalJSON(data []byte) (err error)

type Registry

type Registry int
const (
	RegistryGithub Registry = iota
	RegistryLocal
	RegistryGrpc
)

func RegistryFromString

func RegistryFromString(s string) (Registry, error)

func (Registry) MarshalJSON

func (r Registry) MarshalJSON() ([]byte, error)

func (Registry) String

func (r Registry) String() string

func (*Registry) UnmarshalJSON

func (r *Registry) UnmarshalJSON(data []byte) (err error)

type Scheduler

type Scheduler int
const (
	SchedulerDFS Scheduler = iota
	SchedulerRoundRobin
)

func SchedulerFromString

func SchedulerFromString(s string) (Scheduler, error)

func (Scheduler) MarshalJSON

func (s Scheduler) MarshalJSON() ([]byte, error)

func (Scheduler) String

func (s Scheduler) String() string

func (*Scheduler) UnmarshalJSON

func (s *Scheduler) UnmarshalJSON(data []byte) (err error)

type Schedulers

type Schedulers []Scheduler

func (Schedulers) String

func (s Schedulers) String() string

type Source

type Source struct {
	// Name of the source plugin to use
	Name string `json:"name,omitempty"`
	// Version of the source plugin to use
	Version string `json:"version,omitempty"`
	// Path is the canonical path to the source plugin in a given registry
	// For example:
	// in github the path will be: org/repo
	// For the local registry the path will be the path to the binary: ./path/to/binary
	// For the gRPC registry the path will be the address of the gRPC server: host:port
	Path string `json:"path,omitempty"`
	// Registry can be github,local,grpc.
	Registry            Registry `json:"registry,omitempty"`
	Concurrency         uint64   `json:"concurrency,omitempty"`
	TableConcurrency    uint64   `json:"table_concurrency,omitempty"`    // deprecated: use Concurrency instead
	ResourceConcurrency uint64   `json:"resource_concurrency,omitempty"` // deprecated: use Concurrency instead
	// Tables to sync from the source plugin
	Tables []string `json:"tables,omitempty"`
	// SkipTables defines tables to skip when syncing data. Useful if a glob pattern is used in Tables
	SkipTables []string `json:"skip_tables,omitempty"`
	// SkipDependentTables changes the matching behavior with regard to dependent tables. If set to true, dependent tables will not be synced unless they are explicitly matched by Tables.
	SkipDependentTables bool `json:"skip_dependent_tables,omitempty"`
	// Destinations are the names of destination plugins to send sync data to
	Destinations []string `json:"destinations,omitempty"`

	// Backend is the name of the state backend to use
	Backend Backend `json:"backend,omitempty"`
	// BackendSpec contains any backend-specific configuration
	BackendSpec any `json:"backend_spec,omitempty"`
	// Scheduler defines the scheduling algorithm that should be used to sync data
	Scheduler Scheduler `json:"scheduler,omitempty"`
	// Spec defines plugin specific configuration
	// This is different in every source plugin.
	Spec any `json:"spec,omitempty"`

	// DeterministicCQID is a flag that indicates whether the source plugin should generate a random UUID as the value of _cq_id
	// or whether it should calculate a UUID that is a hash of the primary keys (if they exist) or the entire resource.
	DeterministicCQID bool `json:"deterministic_cq_id,omitempty"`
}

Source is the spec for a source plugin

func (*Source) SetDefaults

func (s *Source) SetDefaults()

func (*Source) UnmarshalBackendSpec

func (s *Source) UnmarshalBackendSpec(out any) error

UnmarshalBackendSpec unmarshals the backend spec into the given interface

func (*Source) UnmarshalSpec

func (s *Source) UnmarshalSpec(out any) error

UnmarshalSpec unmarshals the internal spec into the given interface

func (*Source) Validate

func (s *Source) Validate() error

func (Source) VersionString

func (s Source) VersionString() string

type Spec

type Spec struct {
	Kind Kind `json:"kind"`
	Spec any  `json:"spec"`
}

func (*Spec) UnmarshalJSON

func (s *Spec) UnmarshalJSON(data []byte) error

type WriteMode

type WriteMode int
const (
	WriteModeOverwriteDeleteStale WriteMode = iota
	WriteModeOverwrite
	WriteModeAppend
)

func WriteModeFromString

func WriteModeFromString(s string) (WriteMode, error)

func (WriteMode) MarshalJSON

func (m WriteMode) MarshalJSON() ([]byte, error)

func (WriteMode) String

func (m WriteMode) String() string

func (*WriteMode) UnmarshalJSON

func (m *WriteMode) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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