Documentation
¶
Index ¶
- Constants
- func RetryWithBackoff(ctx context.Context, attempts int, initialBackoffMS int, desc string, ...) error
- func SetPolicy(ctx context.Context, store storage.Storage, policy ErrorPolicy, ...) error
- func SetRetryAttempts(ctx context.Context, store storage.Storage, attempts int) error
- func SetRetryBackoff(ctx context.Context, store storage.Storage, backoffMS int) error
- func SetSkipEncodingErrors(ctx context.Context, store storage.Storage, skip bool) error
- func SetWriteManifest(ctx context.Context, store storage.Storage, write bool) error
- func WriteManifest(jsonlPath string, manifest *Manifest) error
- type Config
- type ConfigStore
- type DataType
- type ErrorPolicy
- type FailedIssue
- type FetchResult
- type Manifest
Constants ¶
const ( ConfigKeyErrorPolicy = "export.error_policy" ConfigKeyRetryAttempts = "export.retry_attempts" ConfigKeyRetryBackoffMS = "export.retry_backoff_ms" ConfigKeySkipEncodingErrors = "export.skip_encoding_errors" ConfigKeyWriteManifest = "export.write_manifest" ConfigKeyAutoExportPolicy = "auto_export.error_policy" )
Config keys for export error handling
const ( DefaultErrorPolicy = PolicyStrict DefaultRetryAttempts = 3 DefaultRetryBackoffMS = 100 DefaultSkipEncodingErrors = false DefaultWriteManifest = false DefaultAutoExportPolicy = PolicyBestEffort )
Default values
Variables ¶
This section is empty.
Functions ¶
func RetryWithBackoff ¶
func RetryWithBackoff(ctx context.Context, attempts int, initialBackoffMS int, desc string, fn func() error) error
RetryWithBackoff wraps a function with retry logic
func SetPolicy ¶
func SetPolicy(ctx context.Context, store storage.Storage, policy ErrorPolicy, autoExport bool) error
SetPolicy sets the error policy for exports
func SetRetryAttempts ¶
SetRetryAttempts sets the number of retry attempts
func SetRetryBackoff ¶
SetRetryBackoff sets the initial retry backoff in milliseconds
func SetSkipEncodingErrors ¶
SetSkipEncodingErrors sets whether to skip issues with encoding errors
func SetWriteManifest ¶
SetWriteManifest sets whether to write export manifests
func WriteManifest ¶
WriteManifest writes an export manifest alongside the JSONL file
Types ¶
type Config ¶
type Config struct {
Policy ErrorPolicy
RetryAttempts int
RetryBackoffMS int
SkipEncodingErrors bool
WriteManifest bool
IsAutoExport bool // If true, may use different policy
}
Config holds export error handling configuration
func LoadConfig ¶
LoadConfig reads export configuration from storage
type ConfigStore ¶
type ConfigStore interface {
GetConfig(ctx context.Context, key string) (string, error)
SetConfig(ctx context.Context, key, value string) error
}
ConfigStore defines the minimal storage interface needed for config
type ErrorPolicy ¶
type ErrorPolicy string
ErrorPolicy defines how export operations handle errors
const ( // PolicyStrict fails fast on any error (default for user-initiated exports) PolicyStrict ErrorPolicy = "strict" // PolicyBestEffort skips failed operations with warnings (good for auto-export) PolicyBestEffort ErrorPolicy = "best-effort" // PolicyPartial retries transient failures, skips persistent ones with manifest PolicyPartial ErrorPolicy = "partial" // PolicyRequiredCore fails on core data (issues/deps), skips enrichments (labels/comments) PolicyRequiredCore ErrorPolicy = "required-core" )
func (ErrorPolicy) IsValid ¶
func (p ErrorPolicy) IsValid() bool
IsValid checks if the policy is a valid value
type FailedIssue ¶
type FailedIssue struct {
IssueID string `json:"issue_id"`
Reason string `json:"reason"`
MissingData []string `json:"missing_data,omitempty"` // e.g., ["labels", "comments"]
}
FailedIssue tracks a single issue that failed to export
type FetchResult ¶
FetchResult holds the result of a data fetch operation
func FetchWithPolicy ¶
func FetchWithPolicy(ctx context.Context, cfg *Config, dataType DataType, desc string, fn func() error) FetchResult
FetchWithPolicy executes a fetch operation with the configured error policy
type Manifest ¶
type Manifest struct {
ExportedCount int `json:"exported_count"`
FailedIssues []FailedIssue `json:"failed_issues,omitempty"`
PartialData []string `json:"partial_data,omitempty"` // e.g., ["labels", "comments"]
Warnings []string `json:"warnings,omitempty"`
Complete bool `json:"complete"`
ExportedAt time.Time `json:"exported_at"`
ErrorPolicy string `json:"error_policy"`
}
Manifest tracks export completeness and failures
func NewManifest ¶
func NewManifest(policy ErrorPolicy) *Manifest
NewManifest creates a new export manifest