file

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend string

Backend enumerates supported storage backends for files.

const (
	BackendLocal Backend = "local"
	BackendHTTP  Backend = "http"
	BackendS3    Backend = "s3" // handled by CSV-specific path or raw via presigned URL/HTTP
	BackendFTP   Backend = "ftp"
	BackendSFTP  Backend = "sftp"
)

type CSVSource

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

CSVSource implements the hermod.Source interface for CSV files.

func NewCSVSource

func NewCSVSource(filePath string, delimiter rune, hasHeader bool) *CSVSource

NewCSVSource creates a new CSVSource.

func NewCSVSourceFromReadCloser

func NewCSVSourceFromReadCloser(rc io.ReadCloser, delimiter rune, hasHeader bool) *CSVSource

NewCSVSourceFromReadCloser creates a CSVSource backed by a provided reader (e.g., SFTP file stream).

func NewHTTPCSVSource

func NewHTTPCSVSource(url string, delimiter rune, hasHeader bool, headers map[string]string) *CSVSource

NewHTTPCSVSource creates a new CSVSource for HTTP.

func NewS3CSVSource

func NewS3CSVSource(region, bucket, key, endpoint, accessKey, secretKey string, delimiter rune, hasHeader bool) *CSVSource

NewS3CSVSource creates a new CSVSource for S3.

func (*CSVSource) Ack

func (s *CSVSource) Ack(ctx context.Context, msg hermod.Message) error

func (*CSVSource) Close

func (s *CSVSource) Close() error

func (*CSVSource) DiscoverDatabases

func (s *CSVSource) DiscoverDatabases(ctx context.Context) ([]string, error)

func (*CSVSource) DiscoverTables

func (s *CSVSource) DiscoverTables(ctx context.Context) ([]string, error)

func (*CSVSource) Ping

func (s *CSVSource) Ping(ctx context.Context) error

func (*CSVSource) Read

func (s *CSVSource) Read(ctx context.Context) (hermod.Message, error)

func (*CSVSource) Sample

func (s *CSVSource) Sample(ctx context.Context, table string) (hermod.Message, error)

type Format

type Format string

Format enumerates parsing/ingestion modes.

const (
	FormatRaw Format = "raw" // emit one message per file, payload contains file bytes
	FormatCSV Format = "csv" // emit one message per CSV record (like legacy CSVSource)
)

type GenericConfig

type GenericConfig struct {
	Backend Backend
	// Common
	Pattern      string // glob like *.csv (applies to local/ftp; s3 handled via prefix + filter)
	Recursive    bool
	PollInterval time.Duration // how often to rescan when queue is empty (0 = one-shot)
	Format       Format        // raw or csv

	// Local
	LocalPath string // directory or file path

	// HTTP (single file)
	URL     string
	Headers map[string]string

	// FTP
	FTPAddr    string // host:port
	FTPUser    string
	FTPPass    string
	FTPRootDir string // list from here
	FTPTLS     bool   // reserved; not used for now (plain FTP)

	// S3
	S3Region    string
	S3Bucket    string
	S3Prefix    string
	S3Endpoint  string
	S3AccessKey string
	S3SecretKey string
}

GenericConfig contains configuration for the generic file source.

type GenericFileSource

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

GenericFileSource implements a polling file reader producing messages per file or per row (CSV).

func NewGenericFileSource

func NewGenericFileSource(cfg GenericConfig) *GenericFileSource

func (*GenericFileSource) Ack

func (*GenericFileSource) Close

func (s *GenericFileSource) Close() error

func (*GenericFileSource) GetState

func (s *GenericFileSource) GetState() map[string]string

GetState/SetState implement hermod.Stateful to persist watermark.

func (*GenericFileSource) Ping

func (s *GenericFileSource) Ping(ctx context.Context) error

func (*GenericFileSource) Read

Read implements hermod.Source. It returns a message when available.

func (*GenericFileSource) Sample

func (s *GenericFileSource) Sample(ctx context.Context, table string) (hermod.Message, error)

Sample reads a single record/file for preview purposes. It is non-destructive: it does not mutate the ingestion queue or the watermark, so calling it from the UI does not skip or consume real data during a subsequent run.

func (*GenericFileSource) SetLogger

func (s *GenericFileSource) SetLogger(l hermod.Logger)

func (*GenericFileSource) SetState

func (s *GenericFileSource) SetState(state map[string]string)

type SourceType

type SourceType string
const (
	SourceTypeLocal  SourceType = "local"
	SourceTypeHTTP   SourceType = "http"
	SourceTypeS3     SourceType = "s3"
	SourceTypeCustom SourceType = "custom"
)

Jump to

Keyboard shortcuts

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