source

package
v1.6.26 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRangeNotSupported  = errors.New("range not supported")
	ErrStreamNotSupported = errors.New("stream not supported")
)

Functions

This section is empty.

Types

type AgentSource

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

func NewAgentSource

func NewAgentSource(websiteID, id string) *AgentSource

func (*AgentSource) ID

func (s *AgentSource) ID() string

func (*AgentSource) ListTargets

func (s *AgentSource) ListTargets(ctx context.Context) ([]TargetRef, error)

func (*AgentSource) OpenRange

func (s *AgentSource) OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)

func (*AgentSource) OpenStream

func (s *AgentSource) OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)

func (*AgentSource) Stat

func (s *AgentSource) Stat(ctx context.Context, target TargetRef) (TargetMeta, error)

func (*AgentSource) Type

func (s *AgentSource) Type() SourceType

type HTTPIndex

type HTTPIndex struct {
	URL     string
	Method  string
	Headers map[string]string
	JSONMap map[string]string
}

type HTTPSource

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

func NewHTTPSource

func NewHTTPSource(websiteID, id, url string, headers map[string]string, rangePolicy RangePolicy, index *HTTPIndex, compression string) *HTTPSource

func NewHTTPSourceWithTimeout added in v1.6.13

func NewHTTPSourceWithTimeout(
	websiteID, id, url string,
	headers map[string]string,
	rangePolicy RangePolicy,
	index *HTTPIndex,
	compression string,
	timeout time.Duration,
) *HTTPSource

func (*HTTPSource) ID

func (s *HTTPSource) ID() string

func (*HTTPSource) ListTargets

func (s *HTTPSource) ListTargets(ctx context.Context) ([]TargetRef, error)

func (*HTTPSource) OpenRange

func (s *HTTPSource) OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)

func (*HTTPSource) OpenStream

func (s *HTTPSource) OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)

func (*HTTPSource) Stat

func (s *HTTPSource) Stat(ctx context.Context, target TargetRef) (TargetMeta, error)

func (*HTTPSource) Type

func (s *HTTPSource) Type() SourceType

type LocalSource

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

func NewLocalSource

func NewLocalSource(websiteID, id, path, pattern, compression string) *LocalSource

func (*LocalSource) ID

func (s *LocalSource) ID() string

func (*LocalSource) ListTargets

func (s *LocalSource) ListTargets(ctx context.Context) ([]TargetRef, error)

func (*LocalSource) OpenRange

func (s *LocalSource) OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)

func (*LocalSource) OpenStream

func (s *LocalSource) OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)

func (*LocalSource) Stat

func (s *LocalSource) Stat(ctx context.Context, target TargetRef) (TargetMeta, error)

func (*LocalSource) Type

func (s *LocalSource) Type() SourceType

type LogSource

type LogSource interface {
	ID() string
	Type() SourceType
	ListTargets(ctx context.Context) ([]TargetRef, error)
	OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)
	OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)
	Stat(ctx context.Context, target TargetRef) (TargetMeta, error)
}

func NewFromConfig

func NewFromConfig(websiteID string, cfg config.SourceConfig) (LogSource, error)

type RangePolicy

type RangePolicy string
const (
	RangeAuto  RangePolicy = "auto"
	RangeForce RangePolicy = "range"
	RangeFull  RangePolicy = "full"
)

type S3Source

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

func NewS3Source

func NewS3Source(websiteID, id, endpoint, region, bucket, prefix, pattern, accessKey, secretKey, compression string) (*S3Source, error)

func (*S3Source) ID

func (s *S3Source) ID() string

func (*S3Source) ListTargets

func (s *S3Source) ListTargets(ctx context.Context) ([]TargetRef, error)

func (*S3Source) OpenRange

func (s *S3Source) OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)

func (*S3Source) OpenStream

func (s *S3Source) OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)

func (*S3Source) Stat

func (s *S3Source) Stat(ctx context.Context, target TargetRef) (TargetMeta, error)

func (*S3Source) Type

func (s *S3Source) Type() SourceType

type SFTPSource

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

func NewSFTPSource

func NewSFTPSource(websiteID, id, host string, port int, user, keyFile, password, passphrase, pathValue, pattern, compression string) *SFTPSource

func (*SFTPSource) ID

func (s *SFTPSource) ID() string

func (*SFTPSource) ListTargets

func (s *SFTPSource) ListTargets(ctx context.Context) ([]TargetRef, error)

func (*SFTPSource) OpenRange

func (s *SFTPSource) OpenRange(ctx context.Context, target TargetRef, start, end int64) (io.ReadCloser, error)

func (*SFTPSource) OpenStream

func (s *SFTPSource) OpenStream(ctx context.Context, target TargetRef) (io.ReadCloser, error)

func (*SFTPSource) Stat

func (s *SFTPSource) Stat(ctx context.Context, target TargetRef) (TargetMeta, error)

func (*SFTPSource) Type

func (s *SFTPSource) Type() SourceType

type SourceType

type SourceType string
const (
	SourceLocal SourceType = "local"
	SourceSFTP  SourceType = "sftp"
	SourceHTTP  SourceType = "http"
	SourceS3    SourceType = "s3"
	SourceAgent SourceType = "agent"
)

type TargetMeta

type TargetMeta struct {
	Size       int64
	ModTime    time.Time
	ETag       string
	Compressed bool
}

type TargetRef

type TargetRef struct {
	WebsiteID string
	SourceID  string
	Key       string
	Meta      TargetMeta
}

Jump to

Keyboard shortcuts

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