types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: Apache-2.0 Imports: 16 Imported by: 12 modules, 22 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDataFromProto

func ConfigDataFromProto[T ConfigData](data *proto.ConfigData) (T, error)

Types

type ArtifactInfo

type ArtifactInfo struct {
	// this is the original name of the artifact
	Name string `json:"original_name"`

	// enrichment values passed from the source to the collection to include in the enrichment process
	SourceEnrichment *schema.SourceEnrichment `json:"-"`
	Timestamp        time.Time                `json:"timestamp"`
}

func ArtifactInfoFromProto

func ArtifactInfoFromProto(info *proto.ArtifactInfo) *ArtifactInfo

func NewArtifactInfo

func NewArtifactInfo(path string, sourceEnrichment *schema.SourceEnrichment, granularity time.Duration) (*ArtifactInfo, error)

func (*ArtifactInfo) GetTimestamp

func (a *ArtifactInfo) GetTimestamp() time.Time

func (*ArtifactInfo) Identifier

func (a *ArtifactInfo) Identifier() string

func (*ArtifactInfo) ToProto

func (a *ArtifactInfo) ToProto() *proto.ArtifactInfo

type CollectRequest

type CollectRequest struct {
	TableName     string
	PartitionName string

	// unique identifier for collection execution this will be used as base for the filename fo the resultiung JSONL files
	ExecutionId string
	// the parent folder for all collection related files (JSONL files, temp source files)
	CollectionTempDir string
	// the filepath for the collection state json file
	CollectionStatePath string
	// the source to use (with raw config)
	SourceData *SourceConfigData
	// the source format to use (with either raw hcl config, or the preset name)
	SourceFormat *FormatConfigData
	// the raw hcl of the connection
	ConnectionData *ConnectionConfigData
	// the collection start time
	From time.Time
	// the custom table definition, if specified
	CustomTableSchema *schema.TableSchema
	// the max space to take with temp files
	TempDirMaxMb int64
}

CollectRequest is an sdk type which is mapped from the proto.CollectRequest

func CollectRequestFromProto

func CollectRequestFromProto(pr *proto.CollectRequest) (*CollectRequest, error)

type Config

type Config interface {
	Validate() error
	Identifier() string
}

Config is an interface that all configuration structs must implement - this includes: - table config - source config - connection config

type ConfigData

type ConfigData interface {
	GetHcl() []byte
	GetRange() hcl.Range
	Identifier() string
	ToProto() *proto.ConfigData
	GetConfigType() string
}

ConfigData is a struct used to contain the config data used to configure a Collection or Source it contains the type of cource/collection, as well as the raw HCL config which the newly instantiated object must parse into the appropriate type

type ConfigDataImpl

type ConfigDataImpl struct {
	Hcl   []byte
	Range hcl.Range
	// ConfigType is the type of the config data, i.e. connection, source, partition, format
	ConfigType string
	// InstanceType represent the subtype type of the config instance:
	// - if this is a partition config, this will be the table name
	// - if this is a source config, this will be the source type
	// - if this is a connection config, this will be the connection type (i.e. plugin name)
	// - if this is a format config, this will be the format type
	InstanceType string
}

func (*ConfigDataImpl) GetConfigType

func (c *ConfigDataImpl) GetConfigType() string

GetConfigType returns the type of the config data

func (*ConfigDataImpl) GetHcl

func (c *ConfigDataImpl) GetHcl() []byte

GetHcl returns the HCL config data

func (*ConfigDataImpl) GetRange

func (c *ConfigDataImpl) GetRange() hcl.Range

GetRange returns the HCL range of the config data

func (*ConfigDataImpl) Identifier

func (c *ConfigDataImpl) Identifier() string

Identifier returns the identifier of the config data

func (*ConfigDataImpl) ToProto added in v0.2.0

func (c *ConfigDataImpl) ToProto() *proto.ConfigData

type ConnectionConfigData

type ConnectionConfigData struct {
	*ConfigDataImpl
}

func NewConnectionConfigData

func NewConnectionConfigData(hcl []byte, decRange hcl.Range, ty string) *ConnectionConfigData

type DescribeResponse added in v0.2.0

type DescribeResponse struct {
	// proto fields
	Schemas       schema.SchemaMap
	Sources       SourceMetadataMap
	FormatPresets FormatDescriptionMap
	CustomFormats FormatDescriptionMap
	FormatTypes   []string

	// non-proto fields - should be populated by PluginManager before returning
	PluginName string
}

func DescribeResponseFromProto added in v0.2.0

func DescribeResponseFromProto(resp *proto.DescribeResponse) *DescribeResponse

func (*DescribeResponse) AsMetadataMap added in v0.2.0

func (d *DescribeResponse) AsMetadataMap() map[string][]string

func (*DescribeResponse) ToProto added in v0.2.0

func (d *DescribeResponse) ToProto() *proto.DescribeResponse

type DownloadedArtifactInfo

type DownloadedArtifactInfo struct {
	ArtifactInfo
	// the path of the downloaded artifact
	LocalName string `json:"local_name"`

	Size int64 `json:"size"`
}

DownloadedArtifactInfo contains information about a downloaded artifact is the same as ArtifactInfo, but with a size field

func DownloadedArtifactInfoFromProto

func DownloadedArtifactInfoFromProto(info *proto.DownloadedArtifactInfo) *DownloadedArtifactInfo

func NewDownloadedArtifactInfo

func NewDownloadedArtifactInfo(artifactInfo *ArtifactInfo, localName string, size int64) *DownloadedArtifactInfo

func (*DownloadedArtifactInfo) ToProto

type DynamicRow added in v0.2.0

type DynamicRow struct {

	// the output columns, as a map of string to interface{} - the result of enrichment and type conversion
	OutputColumns map[string]interface{}
	// contains filtered or unexported fields
}

func (*DynamicRow) Enrich added in v0.2.0

func (l *DynamicRow) Enrich(tableSchema *schema.TableSchema, sourceEnrichmentFields schema.SourceEnrichment) error

Enrich uses the provided mappings to populate the common fields from mapped column values

func (*DynamicRow) GetSourceValue added in v0.2.0

func (l *DynamicRow) GetSourceValue(s string) (string, bool)

func (*DynamicRow) InitialiseFromMap added in v0.2.0

func (l *DynamicRow) InitialiseFromMap(m map[string]string) error

func (*DynamicRow) MarshalJSON added in v0.2.0

func (l *DynamicRow) MarshalJSON() ([]byte, error)

MarshalJSON overrides JSON serialization to include the dynamic columns

func (*DynamicRow) Validate added in v0.2.0

func (l *DynamicRow) Validate() error

TODO move all validation to the CLI https://github.com/turbot/tailpipe/issues/355 (one possible issue for this is that if a required field is missing and has not type, schema inference will fail - so maybe we also need to validate here)

type DynamicTableConfig

type DynamicTableConfig interface {
	GetSchema() (*schema.TableSchema, error)
}

DynamicTableConfig is an interface that all dynamic table configuration structs must implement

type ExtensionLookup

type ExtensionLookup map[string]struct{}

func NewExtensionLookup

func NewExtensionLookup(extensions []string) ExtensionLookup

func (ExtensionLookup) IsValid

func (l ExtensionLookup) IsValid(path string) bool

type FormatConfigData

type FormatConfigData struct {
	*ConfigDataImpl
	Name       string
	PresetName string
	Regex      string
}

FormatConfigData is an sdk type which is mapped from the proto.FormatData

func FormatConfigDataFromProto added in v0.2.0

func FormatConfigDataFromProto(fd *proto.FormatData) (*FormatConfigData, error)

func NewFormatConfigData

func NewFormatConfigData(hcl []byte, decRange hcl.Range, formatType string) *FormatConfigData

func (*FormatConfigData) FullName added in v0.2.0

func (d *FormatConfigData) FullName() string

type FormatDescription added in v0.2.0

type FormatDescription struct {
	Type        string
	Name        string
	Description string
	Regex       string
	Properties  map[string]string
}

FormatDescription is a struct which contains introspection data about a format - it is used in the Describe call to pas format information

func FormatDescriptionFromProto added in v0.2.0

func FormatDescriptionFromProto(pb *proto.FormatDescription) *FormatDescription

func (*FormatDescription) FullName added in v0.2.0

func (f *FormatDescription) FullName() string

func (*FormatDescription) ToProto added in v0.2.0

type FormatDescriptionMap added in v0.2.0

type FormatDescriptionMap map[string]*FormatDescription

func FormatMapFromProto added in v0.2.0

func FormatMapFromProto(pb map[string]*proto.FormatDescription) FormatDescriptionMap

func (FormatDescriptionMap) ToProto added in v0.2.0

type JSONString

type JSONString string

func (*JSONString) UnmarshalJSON

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

type PropertyMetadata added in v0.5.0

type PropertyMetadata struct {
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Default     string `json:"default,omitempty"`
}

func PropertyMetadataFromProto added in v0.5.0

func PropertyMetadataFromProto(v *proto.PropertyMetadata) *PropertyMetadata

func (*PropertyMetadata) ToProto added in v0.5.0

func (p *PropertyMetadata) ToProto() *proto.PropertyMetadata

type RowData

type RowData struct {
	Data             any
	SourceEnrichment *schema.SourceEnrichment
}

RowData is a container for the data and metadata of an row It is used to pass data the [Loader] The RowData returned by the loader is used as the payload of a [events.Row] which is sent to the [table.Table]

type RowStruct

type RowStruct interface {
	Validate() error
}

type SourceConfigData

type SourceConfigData struct {
	*ConfigDataImpl
	ReattachConfig *SourcePluginReattach
}

func NewSourceConfigData

func NewSourceConfigData(hcl []byte, decRange hcl.Range, sourceType string) *SourceConfigData

func (*SourceConfigData) SetReattach

func (d *SourceConfigData) SetReattach(pr *proto.SourcePluginReattach)

type SourceMetadata added in v0.2.0

type SourceMetadata struct {
	Name        string                       `json:"name"`
	Description string                       `json:"description,omitempty"`
	Properties  map[string]*PropertyMetadata `json:"properties,omitempty"`
}

SourceMetadata is used to describe a source

func SourceMetadataFromProto added in v0.2.0

func SourceMetadataFromProto(v *proto.SourceMetadata) *SourceMetadata

func (*SourceMetadata) ToProto added in v0.2.0

func (s *SourceMetadata) ToProto() *proto.SourceMetadata

type SourceMetadataMap added in v0.2.0

type SourceMetadataMap map[string]*SourceMetadata

SourceMetadataMap is a map of source metadata - this is returned from the DescribeSources call

func SourceMetadataMapFromProto added in v0.2.0

func SourceMetadataMapFromProto(p map[string]*proto.SourceMetadata) SourceMetadataMap

func (SourceMetadataMap) ToProto added in v0.2.0

func (s SourceMetadataMap) ToProto() map[string]*proto.SourceMetadata

type SourcePluginReattach

type SourcePluginReattach struct {
	Reattach *plugin.ReattachConfig

	Plugin     string
	SourceType string
}

type TimeMillis

type TimeMillis int64

func (*TimeMillis) UnmarshalJSON

func (t *TimeMillis) UnmarshalJSON(b []byte) error

type UnixMillis

type UnixMillis int64

func (*UnixMillis) UnmarshalJSON

func (u *UnixMillis) UnmarshalJSON(data []byte) error

UnmarshalJSON converts an ISO 8601 formatted time string to Unix milliseconds.

type UpdateCollectionStateRequest

type UpdateCollectionStateRequest struct {
	// the folder containing collection state files (e.g. last collection time)
	CollectionStatePath string
	// the source to use (with raw config)
	SourceData *SourceConfigData
	// the start time - this will be the new state end time
	From time.Time
}

UpdateCollectionStateRequest is an sdk type which is mapped from the proto.UpdateCollectionStateRequest

Jump to

Keyboard shortcuts

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