core

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateJobCapabilities

func ValidateJobCapabilities(required, available JobCapabilities) error

ValidateJobCapabilities fails fast when required job features are not available.

Types

type BackupDriver

type BackupDriver interface {
	Create(ctx context.Context, req backupcontract.CreateRequest) (backupcontract.Manifest, error)
}

BackupDriver creates framework backup manifests from runtime state.

type BlobStorage

type BlobStorage interface {
	Put(ctx context.Context, in PutObjectInput) (StoredObject, error)
	Delete(ctx context.Context, bucket, key string) error
	PresignGet(ctx context.Context, bucket, key string, expiry time.Duration) (string, error)
}

BlobStorage is the app-facing object storage boundary.

type Cache

type Cache interface {
	Get(ctx context.Context, key string) (value []byte, found bool, err error)
	Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Delete(ctx context.Context, key string) error
	InvalidatePrefix(ctx context.Context, prefix string) error
	Close() error
}

Cache is the app-facing cache boundary.

type EnqueueOptions

type EnqueueOptions struct {
	Queue      string
	RunAt      time.Time
	MaxRetries int
	Timeout    time.Duration
	Retention  time.Duration
	Priority   int
}

EnqueueOptions controls queue execution behavior.

type I18n

type I18n interface {
	DefaultLanguage() string
	SupportedLanguages() []string
	NormalizeLanguage(raw string) string
	T(ctx context.Context, key string, templateData ...map[string]any) string
	TC(ctx context.Context, key string, count any, templateData ...map[string]any) string
	TS(ctx context.Context, key string, choice string, templateData ...map[string]any) string
}

I18n is the app-facing localization boundary.

type JobCapabilities

type JobCapabilities struct {
	Delayed    bool
	Retries    bool
	Cron       bool
	Priority   bool
	DeadLetter bool
	Dashboard  bool
}

JobCapabilities declares backend-supported jobs features.

func (JobCapabilities) Missing

func (c JobCapabilities) Missing(required JobCapabilities) []string

Missing returns required capability names not supported by the current backend.

type JobHandler

type JobHandler func(ctx context.Context, payload []byte) error

JobHandler processes an enqueued job payload.

type JobListFilter

type JobListFilter struct {
	Queue    string
	Statuses []JobStatus
	Limit    int
	Offset   int
}

type JobRecord

type JobRecord struct {
	ID         string
	Queue      string
	Name       string
	Payload    []byte
	Status     JobStatus
	Attempt    int
	MaxRetries int
	RunAt      time.Time
	CreatedAt  time.Time
	UpdatedAt  time.Time
	LastError  string
}

type JobStatus

type JobStatus string
const (
	JobStatusQueued  JobStatus = "queued"
	JobStatusRunning JobStatus = "running"
	JobStatusDone    JobStatus = "done"
	JobStatusFailed  JobStatus = "failed"
)

type Jobs

type Jobs interface {
	Register(name string, handler JobHandler) error
	Enqueue(ctx context.Context, name string, payload []byte, opts EnqueueOptions) (jobID string, err error)
	StartWorker(ctx context.Context) error
	StartScheduler(ctx context.Context) error
	Stop(ctx context.Context) error
	Capabilities() JobCapabilities
}

Jobs is the app-facing background jobs boundary.

type JobsInspector

type JobsInspector interface {
	List(ctx context.Context, filter JobListFilter) ([]JobRecord, error)
	Get(ctx context.Context, id string) (JobRecord, bool, error)
}

type MailAddress

type MailAddress struct {
	Email string
	Name  string
}

MailAddress represents an email identity.

type MailAttachment

type MailAttachment struct {
	Filename    string
	ContentType string
	Content     []byte
}

MailAttachment represents one attachment for a message.

type MailMessage

type MailMessage struct {
	From        MailAddress
	To          []MailAddress
	CC          []MailAddress
	BCC         []MailAddress
	ReplyTo     *MailAddress
	Subject     string
	TextBody    string
	HTMLBody    string
	Headers     map[string]string
	Attachments []MailAttachment
}

MailMessage is the app-facing portable mail payload.

type Mailer

type Mailer interface {
	Send(ctx context.Context, msg MailMessage) error
}

Mailer is the app-facing mail delivery boundary.

type MessageHandler

type MessageHandler func(ctx context.Context, topic string, payload []byte) error

MessageHandler processes pubsub payloads.

type Module

type Module interface {
	ID() string
	Migrations() fs.FS
}

Module is the installable framework module contract.

type PubSub

type PubSub interface {
	Publish(ctx context.Context, topic string, payload []byte) error
	Subscribe(ctx context.Context, topic string, handler MessageHandler) (Subscription, error)
	Close() error
}

PubSub is the app-facing pubsub boundary.

type PutObjectInput

type PutObjectInput struct {
	Bucket      string
	Key         string
	ContentType string
	Reader      io.Reader
	Size        int64
	Metadata    map[string]string
}

PutObjectInput describes an object upload request.

type RestoreDriver

type RestoreDriver interface {
	Restore(ctx context.Context, req backupcontract.RestoreRequest) error
}

RestoreDriver validates and applies restore operations from backup manifests.

type RoutableModule

type RoutableModule interface {
	Module
	RegisterRoutes(r Router) error
}

RoutableModule registers HTTP routes in addition to base module metadata.

type Router

type Router interface {
	Group(prefix string, middleware ...echo.MiddlewareFunc) *echo.Group
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

Router is the minimal Echo routing surface exposed to modules.

type Store

type Store interface {
	Ping(ctx context.Context) error
	WithTx(ctx context.Context, fn TxFunc) error
}

Store is the app-facing database boundary.

type StoredObject

type StoredObject struct {
	Bucket string
	Key    string
	ETag   string
	Size   int64
}

StoredObject describes an object written to blob storage.

type Subscription

type Subscription interface {
	Close() error
}

Subscription represents an active pubsub subscription.

type TxFunc

type TxFunc func(ctx context.Context) error

TxFunc is executed inside a store transaction boundary.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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