modelRT/app/types.go

40 lines
1.3 KiB
Go
Raw Normal View History

// Package app holds the dependency-injection wiring for the ModelRT service.
//
// Phase 1 of the Wire migration centralizes the resource assembly that used to
// live inline in main(). Package-level singletons and their Get... accessors are
// intentionally left in place; only the startup assembly is moved here.
package app
import (
"github.com/panjf2000/ants/v2"
"github.com/redis/go-redis/v9"
)
// CLIArgs carries the command-line configuration locators into the injector.
type CLIArgs struct {
ConfigDir string
ConfigName string
ConfigType string
}
// The following named types disambiguate providers that would otherwise share
// the same underlying type. Wire resolves dependencies by type, so the two
// *redis.Client instances (storage vs locker) and the two *ants.PoolWithFunc
// instances (parse vs anchor) must be distinct named types.
type (
// ServiceToken is the signed client token used to authenticate routes.
ServiceToken string
// StorageRedis is the go-redis client backing diagram/storage data.
StorageRedis *redis.Client
// LockerRedis is the go-redis client backing the distributed lock.
LockerRedis *redis.Client
// ParsePool is the ants pool running model parse tasks.
ParsePool *ants.PoolWithFunc
// AnchorPool is the ants pool running real-time anchor param tasks.
AnchorPool *ants.PoolWithFunc
)