Documentation
¶
Overview ¶
Package platform is the facade of the platform module, the shared kernel: audit and message logs with their retention settings, the system settings, the admin console dashboard and tools, and the unauthenticated site-level reads of the public portal. See docs/design/adr-001-modular-monolith.md.
Index ¶
- func NewRepoBuilder() kernel.PlatformBuilder
- type AuthMethod
- type ClientApplication
- type ClientApplicationLister
- type Deps
- type GlobalConfigSnapshot
- type NodeReader
- type OrderReader
- type OrdersTotal
- type OrdersTotalWithDate
- type Server
- type ServerTrafficRanking
- type Service
- type Store
- type TicketReader
- type TotalTraffic
- type TrafficLog
- type TrafficLogDetailsFilter
- type TrafficLogPruner
- type TrafficReader
- type UserReader
- type UserStatisticsWithDate
- type UserTrafficRanking
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRepoBuilder ¶ added in v1.15.2
func NewRepoBuilder() kernel.PlatformBuilder
NewRepoBuilder exports the module-owned repository implementations for store assembly (ADR-001 step-6 preparation).
Types ¶
type AuthMethod ¶ added in v1.21.0
type AuthMethod = readmodel.AuthMethod
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type ClientApplication ¶ added in v1.21.0
type ClientApplication = publicinfo.ClientApplication
ClientApplication and ClientApplicationLister re-export the public-info subdomain's port onto the subscription module's client applications; the composition root adapts the subscription facade to it.
type ClientApplicationLister ¶ added in v1.21.0
type ClientApplicationLister = publicinfo.ClientApplicationLister
ClientApplication and ClientApplicationLister re-export the public-info subdomain's port onto the subscription module's client applications; the composition root adapts the subscription facade to it.
type Deps ¶
type Deps struct {
Logs kernel.LogRepo
System kernel.SystemRepo
Traffic TrafficReader
Store auditlog.PlatformTransactor
// OnLogSettingChanged propagates a committed retention change to the
// running configuration.
OnLogSettingChanged func(autoClear bool, clearDays int64)
// LogRetention reads the current (mutable) retention configuration.
LogRetention func() (autoClear bool, clearDays int64)
// TrafficRetention prunes the network's raw traffic log with the system
// log when the retention settings ask for it.
TrafficRetention TrafficLogPruner
// System-setting dependencies (see internal/systemsetting).
Reinitialize func(subsystem string) error
Restart func() error
SubscribePath func() string
Multiplier systemsetting.MultiplierFunc
// Dashboard and public-info read ports onto the other domains, and the
// dashboard's cache.
Orders OrderReader
Users UserReader
Tickets TicketReader
Nodes NodeReader
Cache dashboard.Cache
// Public-info dependencies: the full read surface, the shared Redis
// cache and the runtime-mutable public configuration snapshot.
PublicStore Store
Redis *redis.Client
PublicConfig func() GlobalConfigSnapshot
// Clients lists the client applications of the public download page
// (the subscription facade).
Clients ClientApplicationLister
// Tool dependencies: the logger output path and the GeoIP reader, which
// the public statistics also locate the nodes with.
LogPath string
GeoIP func() *geoip2.Reader
}
Deps declares everything the module needs; the composition root (internal/app) provides them.
type GlobalConfigSnapshot ¶
type GlobalConfigSnapshot = publicinfo.GlobalConfigSnapshot
GlobalConfigSnapshot re-exports the public-info subdomain's per-request view of the public runtime configuration for the composition root.
type NodeReader ¶ added in v1.21.0
type NodeReader interface {
dashboard.NodeStatsReader
publicinfo.NodeStats
}
The read ports onto the other domains, typed with the read models above: OrderReader onto billing, UserReader onto identity, TicketReader onto support, NodeReader and TrafficReader onto network. They serve the dashboard, the audit views and the public statistics.
type OrderReader ¶ added in v1.21.0
type OrderReader = dashboard.OrderStatsReader
The read ports onto the other domains, typed with the read models above: OrderReader onto billing, UserReader onto identity, TicketReader onto support, NodeReader and TrafficReader onto network. They serve the dashboard, the audit views and the public statistics.
type OrdersTotal ¶ added in v1.21.0
type OrdersTotal = readmodel.OrdersTotal
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type OrdersTotalWithDate ¶ added in v1.21.0
type OrdersTotalWithDate = readmodel.OrdersTotalWithDate
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type Server ¶ added in v1.21.0
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type ServerTrafficRanking ¶ added in v1.21.0
type ServerTrafficRanking = readmodel.ServerTrafficRanking
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type Service ¶
type Service interface {
FilterBalanceLog(ctx context.Context, req *dto.FilterBalanceLogRequest) (*dto.FilterBalanceLogResponse, error)
FilterCommissionLog(ctx context.Context, req *dto.FilterCommissionLogRequest) (*dto.FilterCommissionLogResponse, error)
FilterEmailLog(ctx context.Context, req *dto.FilterLogParams) (*dto.FilterEmailLogResponse, error)
FilterGiftLog(ctx context.Context, req *dto.FilterGiftLogRequest) (*dto.FilterGiftLogResponse, error)
FilterLoginLog(ctx context.Context, req *dto.FilterLoginLogRequest) (*dto.FilterLoginLogResponse, error)
FilterMobileLog(ctx context.Context, req *dto.FilterLogParams) (*dto.FilterMobileLogResponse, error)
FilterOrderLog(ctx context.Context, req *dto.FilterOrderLogRequest) (*dto.FilterOrderLogResponse, error)
FilterRegisterLog(ctx context.Context, req *dto.FilterRegisterLogRequest) (*dto.FilterRegisterLogResponse, error)
FilterResetSubscribeLog(ctx context.Context, req *dto.FilterResetSubscribeLogRequest) (*dto.FilterResetSubscribeLogResponse, error)
FilterServerTrafficLog(ctx context.Context, req *dto.FilterServerTrafficLogRequest) (*dto.FilterServerTrafficLogResponse, error)
FilterSubscribeLog(ctx context.Context, req *dto.FilterSubscribeLogRequest) (*dto.FilterSubscribeLogResponse, error)
FilterTrafficLogDetails(ctx context.Context, req *dto.FilterTrafficLogDetailsRequest) (*dto.FilterTrafficLogDetailsResponse, error)
FilterUserSubscribeTrafficLog(ctx context.Context, req *dto.FilterSubscribeTrafficRequest) (*dto.FilterSubscribeTrafficResponse, error)
GetLogSetting(ctx context.Context) (*dto.LogSetting, error)
// UpdateLogSetting persists the retention settings and propagates them to
// the running configuration.
UpdateLogSetting(ctx context.Context, req *dto.LogSetting) error
// CleanupLogs applies the log retention settings to the system log and
// the network's raw traffic log.
CleanupLogs(ctx context.Context) error
GetMessageLogList(ctx context.Context, req *dto.GetMessageLogListRequest) (*dto.GetMessageLogListResponse, error)
// FilterAdminActionLog pages the administrators' audit trail.
FilterAdminActionLog(ctx context.Context, req *dto.FilterAdminActionLogRequest) (*dto.FilterAdminActionLogResponse, error)
// FilterUnmatchedPaymentLog pages the gateway payments that could not
// settle an order.
FilterUnmatchedPaymentLog(ctx context.Context, req *dto.FilterUnmatchedPaymentLogRequest) (*dto.FilterUnmatchedPaymentLogResponse, error)
// System configuration management; updates persist the settings and
// re-initialize the owning subsystem through injected callbacks.
GetCurrencyConfig(ctx context.Context) (*dto.CurrencyConfig, error)
GetInviteConfig(ctx context.Context) (*dto.InviteConfig, error)
GetNodeConfig(ctx context.Context) (*dto.NodeConfig, error)
GetNodeMultiplier(ctx context.Context) (*dto.GetNodeMultiplierResponse, error)
GetPrivacyPolicyConfig(ctx context.Context) (*dto.PrivacyPolicyConfig, error)
GetRegisterConfig(ctx context.Context) (*dto.RegisterConfig, error)
GetSiteConfig(ctx context.Context) (*dto.SiteConfig, error)
GetSubscribeConfig(ctx context.Context) (*dto.SubscribeConfig, error)
GetTosConfig(ctx context.Context) (*dto.TosConfig, error)
GetVerifyCodeConfig(ctx context.Context) (*dto.VerifyCodeConfig, error)
GetVerifyConfig(ctx context.Context) (*dto.VerifyConfig, error)
PreViewNodeMultiplier(ctx context.Context) (*dto.PreViewNodeMultiplierResponse, error)
SetNodeMultiplier(ctx context.Context, req *dto.SetNodeMultiplierRequest) error
SettingTelegramBot(ctx context.Context) error
UpdateCurrencyConfig(ctx context.Context, req *dto.CurrencyConfig) error
UpdateInviteConfig(ctx context.Context, req *dto.InviteConfig) error
UpdateNodeConfig(ctx context.Context, req *dto.NodeConfig) error
UpdatePrivacyPolicyConfig(ctx context.Context, req *dto.PrivacyPolicyConfig) error
UpdateRegisterConfig(ctx context.Context, req *dto.RegisterConfig) error
UpdateSiteConfig(ctx context.Context, req *dto.SiteConfig) error
UpdateSubscribeConfig(ctx context.Context, req *dto.SubscribeConfig) error
UpdateTosConfig(ctx context.Context, req *dto.TosConfig) error
UpdateVerifyCodeConfig(ctx context.Context, req *dto.VerifyCodeConfig) error
UpdateVerifyConfig(ctx context.Context, req *dto.VerifyConfig) error
// Admin console reporting aggregates (cross-domain reads through ports).
QueryRevenueStatistics(ctx context.Context) (*dto.RevenueStatisticsResponse, error)
QueryServerTotalData(ctx context.Context) (*dto.ServerTotalDataResponse, error)
QueryTicketWaitReply(ctx context.Context) (*dto.TicketWaitRelpyResponse, error)
QueryUserStatistics(ctx context.Context) (*dto.UserStatisticsResponse, error)
// Admin utility tools: system log tail, version, IP geolocation and
// process restart.
GetSystemLog(ctx context.Context) (*dto.LogResponse, error)
GetVersion(ctx context.Context) (*dto.VersionResponse, error)
QueryIPLocation(ctx context.Context, req *dto.QueryIPLocationRequest) (*dto.QueryIPLocationResponse, error)
RestartSystem(ctx context.Context) error
// Unauthenticated site-level reads for the public portal.
GetGlobalConfig(ctx context.Context) (*dto.GetGlobalConfigResponse, error)
GetTos(ctx context.Context) (*dto.GetTosResponse, error)
GetPrivacyPolicy(ctx context.Context) (*dto.PrivacyPolicyConfig, error)
GetStat(ctx context.Context) (*dto.GetStatResponse, error)
GetClient(ctx context.Context) (*dto.GetSubscribeClientResponse, error)
Heartbeat(ctx context.Context) (*dto.HeartbeatResponse, error)
}
Service is the only surface other code may depend on; the implementation lives under internal/ where the compiler seals it off.
type Store ¶ added in v1.20.3
type Store interface {
System() kernel.SystemRepo
}
Store is the persistence the public-info reads need: the system settings. It excludes unrelated repositories and application-wide transactions.
type TicketReader ¶ added in v1.21.0
type TicketReader = dashboard.TicketStatsReader
The read ports onto the other domains, typed with the read models above: OrderReader onto billing, UserReader onto identity, TicketReader onto support, NodeReader and TrafficReader onto network. They serve the dashboard, the audit views and the public statistics.
type TotalTraffic ¶ added in v1.21.0
type TotalTraffic = readmodel.TotalTraffic
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type TrafficLog ¶ added in v1.21.0
type TrafficLog = readmodel.TrafficLog
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type TrafficLogDetailsFilter ¶ added in v1.21.0
type TrafficLogDetailsFilter = readmodel.TrafficLogDetailsFilter
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type TrafficLogPruner ¶ added in v1.21.0
type TrafficLogPruner = auditlog.TrafficLogPruner
TrafficLogPruner re-exports the audit-log subdomain's port onto the network domain's raw traffic log; the composition root adapts the network facade.
type TrafficReader ¶ added in v1.21.0
type TrafficReader interface {
dashboard.TrafficStatsReader
auditlog.TrafficReader
}
The read ports onto the other domains, typed with the read models above: OrderReader onto billing, UserReader onto identity, TicketReader onto support, NodeReader and TrafficReader onto network. They serve the dashboard, the audit views and the public statistics.
type UserReader ¶ added in v1.21.0
type UserReader interface {
dashboard.UserStatsReader
publicinfo.AccountStats
}
The read ports onto the other domains, typed with the read models above: OrderReader onto billing, UserReader onto identity, TicketReader onto support, NodeReader and TrafficReader onto network. They serve the dashboard, the audit views and the public statistics.
type UserStatisticsWithDate ¶ added in v1.21.0
type UserStatisticsWithDate = readmodel.UserStatisticsWithDate
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
type UserTrafficRanking ¶ added in v1.21.0
type UserTrafficRanking = readmodel.UserTrafficRanking
The platform's read models of the other modules' data. The shared kernel depends on no module, so the composition root converts the owning modules' facade results into these.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dto holds the platform module's contract: the requests and responses of the audit log, system settings, admin console, admin tool and public site endpoints.
|
Package dto holds the platform module's contract: the requests and responses of the audit log, system settings, admin console, admin tool and public site endpoints. |
|
entity
|
|
|
inbox
Package inbox holds the idempotent-consumer inbox row: the marker a domain step records, inside its own transaction, for every event it has processed, so a redelivered event is skipped (ADR-001 step 2).
|
Package inbox holds the idempotent-consumer inbox row: the marker a domain step records, inside its own transaction, for every event it has processed, so a redelivered event is skipped (ADR-001 step 2). |
|
log
Package log holds the system log row (the system_logs table) and the typed content of each kind of entry: the message and subscription logs, the login, registration, balance, commission, gift and order logs, and the traffic logs, rankings and daily statistics.
|
Package log holds the system log row (the system_logs table) and the typed content of each kind of entry: the message and subscription logs, the login, registration, balance, commission, gift and order logs, and the traffic logs, rankings and daily statistics. |
|
outbox
Package outbox holds the generic domain-event outbox row (ADR-001 step-6 preparation): appended in the owning domain's transaction, published onto the asynq queue by the dispatch pump, consumed idempotently via the inbox.
|
Package outbox holds the generic domain-event outbox row (ADR-001 step-6 preparation): appended in the owning domain's transaction, published onto the asynq queue by the dispatch pump, consumed idempotently via the inbox. |
|
system
Package system holds the system settings row (the system table), one stored value per setting, and the parsing of the node settings kept in it.
|
Package system holds the system settings row (the system table), one stored value per setting, and the parsing of the node settings kept in it. |
|
task
Package task holds the task bookkeeping rows (the task and task_error tables) and the scope and content of the batch email and quota gift tasks they record.
|
Package task holds the task bookkeeping rows (the task and task_error tables) and the scope and content of the batch email and quota gift tasks they record. |
|
internal
|
|
|
auditlog
Package auditlog implements the audit/message log subdomain of the platform module: filtered views over the system log, message log listing and the log retention settings.
|
Package auditlog implements the audit/message log subdomain of the platform module: filtered views over the system log, message log listing and the log retention settings. |
|
dashboard
Package dashboard implements the admin console subdomain of the platform module: cross-domain reporting aggregates.
|
Package dashboard implements the admin console subdomain of the platform module: cross-domain reporting aggregates. |
|
publicinfo
Package publicinfo implements the public-info subdomain of the platform module: the unauthenticated site-level reads (global configuration, terms of service and privacy policy, aggregate statistics, client downloads, liveness).
|
Package publicinfo implements the public-info subdomain of the platform module: the unauthenticated site-level reads (global configuration, terms of service and privacy policy, aggregate statistics, client downloads, liveness). |
|
readmodel
Package readmodel holds the platform's own views of other modules' data: the figures its dashboards, audit views and public statistics show.
|
Package readmodel holds the platform's own views of other modules' data: the figures its dashboards, audit views and public statistics show. |
|
repo
Package repo holds the platform module's repository implementations: the system settings, cached in Redis, the system log, the task bookkeeping and the event inbox and outbox.
|
Package repo holds the platform module's repository implementations: the system settings, cached in Redis, the system log, the task bookkeeping and the event inbox and outbox. |
|
systemsetting
Package systemsetting implements the system configuration subdomain of the platform module.
|
Package systemsetting implements the system configuration subdomain of the platform module. |
|
tool
Package tool implements the admin tool subdomain of the platform module: the system log tail, the version, IP geolocation and the process restart.
|
Package tool implements the admin tool subdomain of the platform module: the system log tail, the version, IP geolocation and the process restart. |
|
transport
|
|
|
http/admin/console
Package console holds the Hertz handlers of the admin console dashboard: the revenue, user, traffic and ticket figures the platform facade computes.
|
Package console holds the Hertz handlers of the admin console dashboard: the revenue, user, traffic and ticket figures the platform facade computes. |
|
http/admin/log
Package log holds the Hertz handlers of the admin audit and message log views and of the log retention settings.
|
Package log holds the Hertz handlers of the admin audit and message log views and of the log retention settings. |
|
http/admin/system
Package system holds the Hertz handlers of the admin system settings: site, registration, verification, subscription, invitation, currency, terms, node and Telegram bot settings.
|
Package system holds the Hertz handlers of the admin system settings: site, registration, verification, subscription, invitation, currency, terms, node and Telegram bot settings. |
|
http/admin/tool
Package tool holds the Hertz handlers of the admin tools: the system log tail, the version, IP geolocation and the server restart.
|
Package tool holds the Hertz handlers of the admin tools: the system log tail, the version, IP geolocation and the server restart. |
|
http/common
Package common holds the Hertz handlers of the unauthenticated site-level reads: the global configuration, the terms of service and privacy policy, the site statistics, the client downloads and the heartbeat.
|
Package common holds the Hertz handlers of the unauthenticated site-level reads: the global configuration, the terms of service and privacy policy, the site statistics, the client downloads and the heartbeat. |
|
http/internal/handlertest
Package handlertest drives the platform's Hertz handlers in their behaviour tests: it performs a request on a registered route and decodes the JSON envelope the handlers answer with, and it records the calls a fake facade port receives.
|
Package handlertest drives the platform's Hertz handlers in their behaviour tests: it performs a request on a registered route and decodes the JSON envelope the handlers answer with, and it records the calls a fake facade port receives. |