core

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 11 Imported by: 0 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

This section is empty.

Variables

This section is empty.

Functions

func InitApp

func InitApp(opts ...kratosx.Option) *kratosx.App

InitApp 初始化系统

Types

type AppConfigCache added in v1.2.4

type AppConfigCache struct {
	Ttl         time.Duration // 正缓存兜底 TTL(整行快照)
	NegativeTtl time.Duration // 空结果负缓存 TTL(与正缓存同 key,空串即哨兵)
}

AppConfigCache app_config 的 Redis 缓存口径

type Conf

type Conf struct {
	Upload         *Upload         // 上传与分片
	Export         *Export         // 导出(首版不读取)
	ObjectAudit    *ObjectAudit    // 离线对象核对
	AppConfigCache *AppConfigCache // app_config 缓存
}

Conf business 段服务配置

type Context

type Context struct {
	kratosx.Context
}

func MustContext

func MustContext(ctx context.Context, opts ...kratosx.ContextOptionFunc) Context

func (Context) Auth

func (c Context) Auth() *authorize.CheckAuthReply

func (Context) Clone

func (c Context) Clone() Context

func (Context) Config

func (Context) Config() *Conf

func (Context) Lock added in v1.2.4

func (c Context) Lock(key string, opts ...lock.LockOption) lock.Lock

Lock 取一把基于 Redis 的分布式锁(kratosx 提供,进程退出时自动释放)。

func (Context) Transaction

func (c Context) Transaction(fn func(ctx Context) error, name ...string) error

type Export

type Export struct {
	LocalDir             string        // 本地工作目录;容量调度与本地清理见 .prd/草案-导出本地目录与容量调度.md
	Lease                time.Duration // 租约时长;单次导出最长耗时的 2~3 倍(P99 基准),同时复用为导出亲和锁 TTL
	Heartbeat            time.Duration // worker 心跳周期(顶 leased_at);须 < lease,建议 lease/3
	WorkerCount          int           // worker 池大小
	Retention            time.Duration // 请求行保留期(30 天);须 >= export_ttl 最大值
	CleanupInterval      time.Duration // 产出物清理周期(expired_at 到期 → 删桶对象 → status=4)
	LeaseReclaimInterval time.Duration // 租约恢复周期(leased_at 超租约 → status=3)
	TaskReclaimInterval  time.Duration // 任务行回收周期(status IN (2,3,4) 且无 export 引用 → DELETE)
}

Export 导出(⏸ 首版不实现,配置保留为设计占位,导出功能启动时才读取)

type ObjectAudit added in v1.2.4

type ObjectAudit struct {
	Enable    bool          // 是否启用
	Interval  time.Duration // 扫描周期
	BatchSize int           // 单批扫描行数
}

ObjectAudit 离线对象核对(回收 A 类残留)

type Upload added in v1.2.4

type Upload struct {
	SessionTtl time.Duration // 分片会话过期;GC 按 updated_at 扫
	GcInterval time.Duration // GC 扫描周期
	PartUrlTtl time.Duration // 预签名分片 URL 有效期;覆盖"一个批次从下发到传完",非整份文件
}

Upload 上传与分片配置

Jump to

Keyboard shortcuts

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