app

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAsynqClient

func NewAsynqClient(c config.Config) *taskqueue.Client

NewAsynqClient returns the tracing asynq client: EnqueueContext stamps the caller's trace context onto the task for the worker-side middleware to resume. Pass task options to EnqueueContext, not NewTask — wrapping rebuilds the task.

func NewAsynqInspector

func NewAsynqInspector(c config.Config) *asynq.Inspector

func NewDeviceManager

func NewDeviceManager(srv *Application) *devicesocket.DeviceManager

func NewStore

func NewStore(db *gorm.DB, rds *redis.Client) *repository.GormStore

NewStore assembles the shared store from the module-owned repo builders (falling back to the repository package's legacy builders for implementations that have not migrated yet). One connection pool, module- owned persistence (ADR-001 step-6 preparation).

Types

type Application

type Application struct {
	Redis        *redis.Client
	Runtime      *state.State
	Queue        *taskqueue.Client
	Inspector    *asynq.Inspector
	ExchangeRate *billing.CurrencyRateCache
	GeoIP        *geoip.IPLocation
	Store        repository.Store

	// Domain modules (see docs/design/adr-001-modular-monolith.md). Application is
	// their composition root; handlers call the module facades.
	Support      support.Service
	Billing      billing.Service
	Platform     platform.Service
	Subscription subscription.Service
	Identity     identity.Service
	Network      network.Service
	Notification notification.Service
	EventBus     *eventbus.Bus

	//NodeCache   *cache.NodeCacheClient
	AuthLimiter   *ratelimit.PeriodLimit
	DeviceManager *devicesocket.DeviceManager
}

func NewApplication

func NewApplication(c config.Config) *Application

type Dependencies

type Dependencies struct {
	Config                 func() config.Config
	Store                  repository.Store
	Bootstrap              *bootstrap.Dependencies
	HTTP                   func() httpserver.Dependencies
	SetRestart             func(func() error)
	SetReinitializeHandler func(func(string))
}

type DeviceMessage

type DeviceMessage struct {
	Method DeviceMessageMethod `json:"method"`
}

func (*DeviceMessage) Json

func (dm *DeviceMessage) Json() string

type DeviceMessageMethod

type DeviceMessageMethod string
const (
	// DeviceKickedMax 设备数量超出限制
	DeviceKickedMax DeviceMessageMethod = "kicked_device"
	// DeviceKickedAdmin 管理员踢下线
	DeviceKickedAdmin DeviceMessageMethod = "kicked_admin"
	// SubscribeUpdate 订阅有更新
	SubscribeUpdate DeviceMessageMethod = "subscribe_update"
)

type Service

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

func NewService

func NewService(deps Dependencies) *Service

func (*Service) Restart

func (m *Service) Restart() error

func (*Service) Start

func (m *Service) Start()

func (*Service) Stop

func (m *Service) Stop()

Directories

Path Synopsis
migration
Package appstate owns the process-wide mutable runtime state.
Package appstate owns the process-wide mutable runtime state.

Jump to

Keyboard shortcuts

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