ftp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 30 Imported by: ? modules, 0 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

View Source
const (
	QueryFormatUnknown     = filedata.QueryFormatUnknown
	QueryFormatAuto        = filedata.QueryFormatAuto
	QueryFormatCSV         = filedata.QueryFormatCSV
	QueryFormatJSON        = filedata.QueryFormatJSON
	QueryFormatFile        = filedata.QueryFormatFile
	QueryFormatSpreadsheet = filedata.QueryFormatSpreadsheet
)
View Source
const MaxArtifactBytes = 10 << 20

Variables

View Source
var ErrArtifactChanged = xerror.New(xerror.KindInvalidInput, "FTP_ARTIFACT_CHANGED", "FTP artifact bytes differ from receipt")

Functions

func ArtifactCSVDialect

func ArtifactCSVDialect(delimiter string, header *bool) (string, bool)

ArtifactCSVDialect aligns completion reads with the writer's CSV defaults.

Types

type ArtifactEvidence

type ArtifactEvidence struct {
	DeliveryID  uuid.UUID
	FinalPath   string
	StagingPath string
	SizeBytes   int64
	SHA256      string
}

func PrepareArtifactCSV

func PrepareArtifactCSV(config Config, directory, filename string, id uuid.UUID, limit int64, content any, options filedata.ParseCSVOptions) (ArtifactEvidence, []byte, error)

PrepareArtifactCSV performs no provider I/O. The directory must come from a qualified storage binding and the filename from the pinned write operation.

type Config

type Config struct {
	Host              string `json:"host"                          validate:"required,hostname|ip"`
	Port              int    `json:"port"                          validate:"required,min=1,max=65535"`
	BasePath          string `json:"base_path,omitempty"`
	ConnectTimeout    int    `json:"connect_timeout,omitempty"     validate:"omitempty,min=1,max=300"`
	AllowPrivateHosts bool   `json:"allow_private_hosts,omitempty"`
}

Config holds configuration for FTP connections.

func (Config) ValidateBasePath

func (cfg Config) ValidateBasePath() error

ValidateBasePath checks the configured directory before it is persisted or used.

type Connector

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

Connector connects to FTP servers and executes file-backed row queries.

func New

func New(ctx context.Context, config Config, creds Credentials) (*Connector, error)

New creates a new FTP connector.

func (*Connector) Close

func (c *Connector) Close() error

Close closes the FTP connection.

func (*Connector) Execute

func (c *Connector) Execute(
	ctx context.Context,
	queryData json.RawMessage,
	params map[string]types.TypedParam,
	limits ...types.ExecutionLimits,
) (*result.ExecutionResult, error)

Execute runs an FTP file operation (read or write) and returns an FTP execution result.

func (*Connector) FetchArtifactCSV

func (c *Connector) FetchArtifactCSV(ctx context.Context, evidence ArtifactEvidence, limit int64, options filedata.ParseCSVOptions) (*result.FileResult, error)

FetchArtifactCSV fetches one copy and checks its identity before parsing.

func (*Connector) IntrospectSchema

func (c *Connector) IntrospectSchema(ctx context.Context) (*filedata.Schema, error)

IntrospectSchema enumerates supported files and infers schema fields.

func (*Connector) PublishArtifact

func (c *Connector) PublishArtifact(ctx context.Context, evidence ArtifactEvidence, body io.Reader, beforeRename func(context.Context) error) (retErr error)

PublishArtifact receives evidence and bytes already matched by the trusted executor. beforeRename rechecks the live database claim after STOR.

func (*Connector) TestConnection

func (c *Connector) TestConnection(ctx context.Context) (err error)

TestConnection verifies that a connection to the FTP server is still alive.

type Credentials

type Credentials struct {
	Username string `json:"username" validate:"required,min=1"`
	Password string `json:"password" validate:"required,min=1"`
}

Credentials holds FTP authentication values.

type QueryFormat

type QueryFormat = filedata.QueryFormat

QueryFormat is an alias for filedata.QueryFormat.

Jump to

Keyboard shortcuts

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