Documentation
¶
Index ¶
- Constants
- Variables
- func IsListedItemType(t string) bool
- func IsRecruitStage(stage *SEOStage) bool
- func ItemOnServer(item *SEOItem, server string, matrix *SEOMatrix) bool
- func ItemPageURL(site, lang, server, itemID string) (u string, ok bool)
- func Module() fx.Option
- func StageOnServer(stage *SEOStage, server string, matrix *SEOMatrix) bool
- func StagePageURL(site, lang, server string, stage *SEOStage) (u string, ok bool)
- func StatsPagePath(lang, server, section string, ids ...string) string
- type Account
- type Activity
- type Admin
- func (s *Admin) CloneFromCN(ctx context.Context, req types.CloneFromCNRequest) error
- func (s *Admin) EvaluateRejectRules(ctx context.Context, ...) (RejectRulesReevaluationEvaluationResultSet, error)
- func (s *Admin) GetRejectRulesReportContext(ctx context.Context, req types.RejectRulesReevaluationPreviewRequest) ([]RejectRulesReevaluationEvaluationContext, error)
- func (s *Admin) SaveRenderedObjects(ctx context.Context, objects *gamedata.RenderedObjects) error
- type Analytics
- type DropInfo
- func (s *DropInfo) CloneDropInfosFromCN(ctx context.Context, originRangeId int, destRangeId int, server string) error
- func (s *DropInfo) GetAppearStageIdsByServer(ctx context.Context, server string) ([]int, error)
- func (s *DropInfo) GetDropInfosByServer(ctx context.Context, server string) ([]*model.DropInfo, error)
- func (s *DropInfo) GetDropInfosWithFilters(ctx context.Context, server string, timeRanges []*model.TimeRange, ...) ([]*model.DropInfo, error)
- func (s *DropInfo) GetItemDropSetByStageIdAndRangeId(ctx context.Context, server string, stageId int, rangeId int) ([]int, error)
- func (s *DropInfo) GetItemDropSetByStageIdAndTimeRange(ctx context.Context, server string, stageId int, startTime *time.Time, ...) ([]int, error)
- func (s *DropInfo) GetOpeningStageIdsByServer(ctx context.Context, server string) ([]int, error)
- type DropMatrix
- func (s *DropMatrix) DropGlobalDropMatrixCaches(server string)
- func (s *DropMatrix) GetShimCustomizedDropMatrixResults(ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, ...) (*modelv2.DropMatrixQueryResult, error)
- func (s *DropMatrix) GetShimDropMatrix(ctx context.Context, server string, showClosedZones bool, ...) (*modelv2.DropMatrixQueryResult, error)
- func (s *DropMatrix) GlobalDropMatrixCachesUsed(server string) bool
- func (s *DropMatrix) RefreshGlobalDropMatrixCaches(ctx context.Context, server string) error
- func (s *DropMatrix) RunCalcDropMatrixJob(ctx context.Context, server string) error
- func (s *DropMatrix) UpdateDropMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error
- func (s *DropMatrix) WarmUpGlobalDropMatrixCaches(ctx context.Context, server string) error
- type DropMatrixElement
- func (s *DropMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.DropMatrixElement, server string) error
- func (s *DropMatrixElement) CalcGlobalDropMatrixAggregates(ctx context.Context, server string, targets []*model.GlobalDropMatrixTarget, ...) (map[model.GlobalDropMatrixKey]*model.GlobalDropMatrixAggregate, error)
- func (s *DropMatrixElement) CalcSiteStatsAggregates(ctx context.Context, server string, fromDayNum, toDayNum null.Int) ([]*model.SiteStatsAggregate, error)
- func (s *DropMatrixElement) DeleteByServerAndDayNum(ctx context.Context, server string, dayNum int) error
- func (s *DropMatrixElement) GetElementsByServerAndSourceCategoryAndDayNumRange(ctx context.Context, server string, sourceCategory string, startDayNum int, ...) ([]*model.DropMatrixElement, error)
- func (s *DropMatrixElement) IsExistByServerAndDayNum(ctx context.Context, server string, dayNum int) (bool, error)
- type DropPatternElement
- type DropReport
- func (s *DropReport) CalcDropMatrixForIntervalsBySourceCategories(ctx context.Context, queryCtxs []*model.DropReportQueryContext, ...) ([]map[string][]*model.TotalTimesResult, ...)
- func (s *DropReport) CalcQuantityUniqCount(ctx context.Context, queryCtx *model.DropReportQueryContext) ([]*model.QuantityUniqCountResultForDropMatrix, error)
- func (s *DropReport) CalcRecentUniqueUserCountBySource(ctx context.Context, duration time.Duration) ([]*modelv2.UniqueUserCountBySource, error)
- func (s *DropReport) CalcTotalQuantityForPatternMatrix(ctx context.Context, queryCtx *model.DropReportQueryContext) ([]*model.TotalQuantityResultForPatternMatrix, error)
- func (s *DropReport) CalcTotalQuantityForPatternMatrixBySourceCategories(ctx context.Context, queryCtx *model.DropReportQueryContext, ...) (map[string][]*model.TotalQuantityResultForPatternMatrix, error)
- func (s *DropReport) CalcTotalQuantityForTrend(ctx context.Context, server string, startTime *time.Time, ...) ([]*model.TotalQuantityResultForTrend, error)
- func (s *DropReport) CalcTotalStageQuantityForShimSiteStats(ctx context.Context, server string, isRecent24h bool) ([]*modelv2.TotalStageTime, error)
- func (s *DropReport) CalcTotalTimesForDropMatrix(ctx context.Context, queryCtx *model.DropReportQueryContext) ([]*model.TotalTimesResult, error)
- func (s *DropReport) CalcTotalTimesForPatternMatrix(ctx context.Context, queryCtx *model.DropReportQueryContext) ([]*model.TotalTimesResult, error)
- func (s *DropReport) CalcTotalTimesForTrend(ctx context.Context, server string, startTime *time.Time, ...) ([]*model.TotalTimesResultForTrend, error)
- func (s *DropReport) GetDropReports(ctx context.Context, queryCtx *model.DropReportQueryContext) ([]*model.DropReport, error)
- func (s *DropReport) RunWithStatementTimeout(ctx context.Context, timeout time.Duration, fn func(ctx context.Context) error) error
- type Export
- type Formula
- type FrontendConfig
- type GeoIP
- type Health
- type HealthStatus
- type Item
- func (s *Item) GetItemByArkId(ctx context.Context, arkItemId string) (*model.Item, error)
- func (s *Item) GetItemById(ctx context.Context, itemId int) (*model.Item, error)
- func (s *Item) GetItems(ctx context.Context) ([]*model.Item, error)
- func (s *Item) GetItemsMapByArkId(ctx context.Context) (map[string]*model.Item, error)
- func (s *Item) GetItemsMapById(ctx context.Context) (map[int]*model.Item, error)
- func (s *Item) GetRecruitTagItemsByBilingualName(ctx context.Context) (map[string]string, error)
- func (s *Item) GetShimItemByArkId(ctx context.Context, arkItemId string) (*modelv2.Item, error)
- func (s *Item) GetShimItems(ctx context.Context) ([]*modelv2.Item, error)
- func (s *Item) SearchItemByName(ctx context.Context, name string) (*model.Item, error)
- type Notice
- type PatternMatrix
- func (s *PatternMatrix) DropGlobalPatternMatrixCaches(server string)
- func (s *PatternMatrix) GetShimPatternMatrix(ctx context.Context, server string, accountId null.Int, sourceCategory string, ...) (*modelv2.PatternMatrixQueryResult, error)
- func (s *PatternMatrix) GlobalPatternMatrixCachesUsed(server string) bool
- func (s *PatternMatrix) RefreshGlobalPatternMatrixCaches(ctx context.Context, server string) error
- func (s *PatternMatrix) RunCalcPatternMatrixJob(ctx context.Context, server string) error
- func (s *PatternMatrix) UpdatePatternMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error
- func (s *PatternMatrix) WarmUpGlobalPatternMatrixCaches(ctx context.Context, server string) error
- type PatternMatrixElement
- func (s *PatternMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.PatternMatrixElement, server string) error
- func (s *PatternMatrixElement) CalcGlobalPatternMatrixAggregates(ctx context.Context, server string, targets []*model.GlobalPatternMatrixTarget, ...) (map[string]*model.GlobalPatternMatrixAggregates, error)
- func (s *PatternMatrixElement) DeleteByServerAndDayNum(ctx context.Context, server string, dayNum int) error
- func (s *PatternMatrixElement) IsExistByServerAndDayNum(ctx context.Context, server string, dayNum int) (bool, error)
- type RejectRulesReevaluationEvaluationContext
- type RejectRulesReevaluationEvaluationResult
- type RejectRulesReevaluationEvaluationResultSet
- type RejectRulesReevaluationEvaluationResultSetChangeSet
- type RejectRulesReevaluationEvaluationResultSetDiff
- type RejectRulesReevaluationEvaluationResultSetSummary
- type RejectRulesReevaluationEvaluationResultSetSummaryReliabilityChanges
- type RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations
- type Report
- func (s *Report) PipelineAccount(ctx *fiber.Ctx) (accountId int, err error)
- func (s *Report) PipelineAggregateGachaboxDrops(ctx context.Context, singleReport *types.ReportTaskSingleReport) error
- func (s *Report) PipelineMergeDropsAndMapDropTypes(ctx context.Context, drops []types.ArkDrop) ([]*types.Drop, error)
- func (s *Report) PipelinePreprocessRecruitmentTags(ctx context.Context, req *types.SingularReportRequest) error
- func (s *Report) PipelinePreprocessRerunStageIdForMaa(ctx context.Context, req *types.SingularReportRequest) error
- func (s *Report) PipelineTaskId(ctx *fiber.Ctx) string
- func (s *Report) PreprocessAndQueueBatchReport(ctx *fiber.Ctx, req *types.BatchReportRequest) (taskId string, err error)
- func (s *Report) PreprocessAndQueueSingularReport(ctx *fiber.Ctx, req *types.SingularReportRequest) (taskId string, err error)
- func (s *Report) RecallSingularReport(ctx context.Context, req *types.SingularReportRecallRequest) error
- type SEOCatalog
- type SEOData
- type SEOExistence
- type SEOI18n
- type SEOItem
- type SEOMatrix
- type SEORow
- type SEOStage
- type SEOZone
- type ShortURL
- type SiteStats
- func (s *SiteStats) DropShimSiteStats(server string)
- func (s *SiteStats) GetShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)
- func (s *SiteStats) InvalidateSiteStatsBase(ctx context.Context, server string) error
- func (s *SiteStats) RefreshShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)
- func (s *SiteStats) ShimSiteStatsUsed(server string) bool
- type Snapshot
- type Stage
- func (s *Stage) GetGachaBoxStages(ctx context.Context) ([]*model.Stage, error)
- func (s *Stage) GetShimStageByArkId(ctx context.Context, arkStageId string, server string) (*modelv2.Stage, error)
- func (s *Stage) GetShimStages(ctx context.Context, server string) ([]*modelv2.Stage, error)
- func (s *Stage) GetShimStagesForFakeTime(ctx context.Context, server string, t time.Time) ([]*modelv2.Stage, error)
- func (s *Stage) GetStageByArkId(ctx context.Context, arkStageId string) (*model.Stage, error)
- func (s *Stage) GetStageById(ctx context.Context, stageId int) (*model.Stage, error)
- func (s *Stage) GetStages(ctx context.Context) ([]*model.Stage, error)
- func (s *Stage) GetStagesByZoneId(ctx context.Context, zoneId int) ([]*model.Stage, error)
- func (s *Stage) GetStagesMapByArkId(ctx context.Context) (map[string]*model.Stage, error)
- func (s *Stage) GetStagesMapById(ctx context.Context) (map[int]*model.Stage, error)
- func (s *Stage) SearchStageByCode(ctx context.Context, code string) (*model.Stage, error)
- type TimeRange
- func (s *TimeRange) GetAllMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)
- func (s *TimeRange) GetCurrentTimeRangesByServer(ctx context.Context, server string) ([]*model.TimeRange, error)
- func (s *TimeRange) GetLatestTimeRangesByServer(ctx context.Context, server string) (map[int]*model.TimeRange, error)
- func (s *TimeRange) GetMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)
- func (s *TimeRange) GetTimeRangeById(ctx context.Context, rangeId int) (*model.TimeRange, error)
- func (s *TimeRange) GetTimeRangeByServerAndName(ctx context.Context, server string, name string) (*model.TimeRange, error)
- func (s *TimeRange) GetTimeRangesByServer(ctx context.Context, server string) ([]*model.TimeRange, error)
- func (s *TimeRange) GetTimeRangesMap(ctx context.Context, server string) (map[int]*model.TimeRange, error)
- type Trend
- func (s *Trend) DropShimTrend(server string)
- func (s *Trend) GetShimCustomizedTrendResults(ctx context.Context, server string, startTime *time.Time, ...) (*modelv2.TrendQueryResult, error)
- func (s *Trend) GetShimTrend(ctx context.Context, server string) (*modelv2.TrendQueryResult, error)
- func (s *Trend) RefreshShimTrend(ctx context.Context, server string) error
- func (s *Trend) ShimTrendUsed(server string) bool
- func (s *Trend) WarmUpShimTrend(ctx context.Context, server string) error
- type Upyun
- func (c *Upyun) ImageURIToSignedURL(uri, style string) (path string, err error)
- func (c *Upyun) InitImageUpload(prefix string, uploadId string) (types.UpyunInitResponse, error)
- func (c *Upyun) MarshalImageURI(path string) string
- func (c *Upyun) VerifyImageUploadCallback(ctx *fiber.Ctx) (path string, err error)
- type Zone
- func (s *Zone) GetShimZoneByArkId(ctx context.Context, arkZoneId string) (*modelv2.Zone, error)
- func (s *Zone) GetShimZones(ctx context.Context) ([]*modelv2.Zone, error)
- func (s *Zone) GetZoneByArkId(ctx context.Context, arkZoneId string) (*model.Zone, error)
- func (s *Zone) GetZoneById(ctx context.Context, id int) (*model.Zone, error)
- func (s *Zone) GetZones(ctx context.Context) ([]*model.Zone, error)
Constants ¶
const ( HealthOK = "ok" HealthDegraded = "degraded" HealthUnreachable = "unreachable" )
const ( DropDataLicenseURL = "https://creativecommons.org/licenses/by-nc/4.0/" DropDataLicenseName = "CC BY-NC 4.0" )
The license of the drop data (meta.footer.copyright of the frontend)
const ( StatsSectionItem = "item" StatsSectionStage = "stage" )
The sections of the stats routes: the list of the items or stages, and the pages under it
const SEOCatalogRefreshInterval = time.Minute
SEOCatalogRefreshInterval is how often SEOData reloads the items, stages and zones.
const SEOSourceCategory = constant.SourceCategoryAll
SEOSourceCategory is the source category of the matrix the stats pages show: the one the frontend shows by default (frontend-v2 src/store/modules/dataSource.js).
const StatsDefaultLang = "en"
StatsDefaultLang is the fallback locale of the frontend: the x-default of the hreflang links of the pages
const (
UpyunAuthorizationHeaderRealm = "UPYUN"
)
Variables ¶
var ( ErrReportNotFound = pgerr.ErrInvalidReq.Msg("report not existed or has already been recalled") ErrAccountMissing = pgerr.ErrInvalidReq.Msg("account missing") ErrNatsTimeout = errors.New("timeout waiting for NATS response") )
var ( ErrSnapshotNotFound = errors.New("snapshot not found") ErrSnapshotNonNullable = errors.New("snapshot content cannot be empty") )
var ListedItemTypes = []string{"MATERIAL", "CARD_EXP", "CHIP", "FURN", "ACTIVITY_ITEM"}
ListedItemTypes are the types of the items the frontend lists (src/utils/getters.js), in the order its item list groups them
var StatsLangs = []string{"zh", "en", "ja", "ko"}
StatsLangs are the languages of the stats routes of the frontend (src/router.js statsLanguages)
Functions ¶
func IsListedItemType ¶
IsListedItemType tells whether the frontend lists the items of type t
func IsRecruitStage ¶
IsRecruitStage tells whether the stage is the recruitment statistics, which the frontend shows in beta with measures of their own
func ItemOnServer ¶
ItemOnServer tells whether the item has a stats page on server: an item the frontend lists that exists there or has drops there. matrix is the matrix of server, nil while it is not calculated.
func ItemPageURL ¶
ItemPageURL is the URL of the stats page of an item on server in lang, at site (an origin). ok is false if there is no such page to link: a language or server without stats routes, or an ID that is routed as another path (see routablePage).
func StageOnServer ¶
StageOnServer tells whether the stage has a stats page on server: a stage in a zone that exists there or has drops there. matrix is the matrix of server, nil while it is not calculated.
func StagePageURL ¶
StagePageURL is the URL of the stats page of a stage on server in lang, at site (an origin), whose path holds the zone of the stage. ok is false if there is no such page to link: a stage without a zone, as ItemPageURL otherwise.
func StatsPagePath ¶
StatsPagePath is the path of a stats page of the frontend: /{lang}/result/{server}, then the section, if any, and the IDs, escaped.
Types ¶
type Account ¶
func NewAccount ¶
func (*Account) CreateAccountWithRandomPenguinId ¶
type Activity ¶
func NewActivity ¶
func (*Activity) GetActivities ¶
Cache: (singular) activities, 1 hr; records last modified time
func (*Activity) GetActivityById ¶
type Admin ¶
type Admin struct {
DB *bun.DB
AdminRepo *repo.Admin
DropReportService *DropReport
RejectRuleRepo *repo.RejectRule
ZoneService *Zone
StageService *Stage
ActivityService *Activity
TimeRangeService *TimeRange
DropInfoService *DropInfo
}
func (*Admin) CloneFromCN ¶
func (*Admin) EvaluateRejectRules ¶
func (s *Admin) EvaluateRejectRules(ctx context.Context, evaluationContexts []RejectRulesReevaluationEvaluationContext, ruleId int) (RejectRulesReevaluationEvaluationResultSet, error)
func (*Admin) GetRejectRulesReportContext ¶
func (s *Admin) GetRejectRulesReportContext(ctx context.Context, req types.RejectRulesReevaluationPreviewRequest) ([]RejectRulesReevaluationEvaluationContext, error)
func (*Admin) SaveRenderedObjects ¶
type Analytics ¶
type Analytics struct {
DropReportService *DropReport
}
func NewAnalytics ¶
func NewAnalytics(dropReportService *DropReport) *Analytics
type DropInfo ¶
func NewDropInfo ¶
func (*DropInfo) CloneDropInfosFromCN ¶
func (*DropInfo) GetAppearStageIdsByServer ¶
func (*DropInfo) GetDropInfosByServer ¶
func (*DropInfo) GetDropInfosWithFilters ¶
func (*DropInfo) GetItemDropSetByStageIdAndRangeId ¶
func (s *DropInfo) GetItemDropSetByStageIdAndRangeId(ctx context.Context, server string, stageId int, rangeId int) ([]int, error)
Cache: itemDropSet#server|stageId|rangeId:{server}|{stageId}|{rangeId}, 24 hrs
func (*DropInfo) GetItemDropSetByStageIdAndTimeRange ¶
func (s *DropInfo) GetItemDropSetByStageIdAndTimeRange(ctx context.Context, server string, stageId int, startTime *time.Time, endTime *time.Time) ([]int, error)
Cache: itemDropSet#server|stageId|startTime|endTime:{server}|{stageId}|{startTime}|{endTime}, 24 hrs
func (*DropInfo) GetOpeningStageIdsByServer ¶
GetOpeningStageIdsByServer returns the distinct ids of the stages of server with a drop info in a current time range, reading only those stage ids instead of every drop info of server.
type DropMatrix ¶
type DropMatrix struct {
Config *appconfig.Config
TimeRangeService *TimeRange
DropReportService *DropReport
DropInfoService *DropInfo
DropMatrixElementService *DropMatrixElement
StageService *Stage
ItemService *Item
SiteStatsService *SiteStats
}
func NewDropMatrix ¶
func NewDropMatrix( config *appconfig.Config, timeRangeService *TimeRange, dropReportService *DropReport, dropInfoService *DropInfo, dropMatrixElementService *DropMatrixElement, stageService *Stage, itemService *Item, siteStatsService *SiteStats, ) *DropMatrix
func (*DropMatrix) DropGlobalDropMatrixCaches ¶
func (s *DropMatrix) DropGlobalDropMatrixCaches(server string)
DropGlobalDropMatrixCaches deletes the cached global drop matrices of server that RefreshGlobalDropMatrixCaches replaces, those cached only: a refresh of them in another process left them stale, and requests recalculate them.
func (*DropMatrix) GetShimCustomizedDropMatrixResults ¶
func (*DropMatrix) GetShimDropMatrix ¶
func (s *DropMatrix) GetShimDropMatrix( ctx context.Context, server string, showClosedZones bool, stageFilterStr string, itemFilterStr string, accountId null.Int, sourceCategory string, ) (*modelv2.DropMatrixQueryResult, error)
Cache: shimGlobalDropMatrix#server|showClosedZones|sourceCategory:{server}|{showClosedZones}|{sourceCategory}, 24 hrs, records last modified time Called by frontend, used for both global and personal, only for max accumulable results
func (*DropMatrix) GlobalDropMatrixCachesUsed ¶
func (s *DropMatrix) GlobalDropMatrixCachesUsed(server string) bool
GlobalDropMatrixCachesUsed reports whether any of the global drop matrices of server that RefreshGlobalDropMatrixCaches replaces is used (see cache.Set.Used): whether this process serves them, and should follow their refreshes (cachesync).
func (*DropMatrix) RefreshGlobalDropMatrixCaches ¶
func (s *DropMatrix) RefreshGlobalDropMatrixCaches(ctx context.Context, server string) error
RefreshGlobalDropMatrixCaches recalculates the global drop matrices of server and replaces the cached ones (for every source category, raw and shim with and without closed zones). Requests keep getting the previous ones in the meantime instead of all waiting for a recalculation. If the recalculation fails, the cached ones are dropped, also if it panics (the worker recovers the panic): the source categories cached before it must not keep matrices of this refresh while the others keep those of an earlier one.
func (*DropMatrix) RunCalcDropMatrixJob ¶
func (s *DropMatrix) RunCalcDropMatrixJob(ctx context.Context, server string) error
Calc today's drop matrix elements and save to DB Called by worker
func (*DropMatrix) UpdateDropMatrixByGivenDate ¶
func (s *DropMatrix) UpdateDropMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error
Update drop matrix elements for a given date (entire day) Called by admin api
func (*DropMatrix) WarmUpGlobalDropMatrixCaches ¶
func (s *DropMatrix) WarmUpGlobalDropMatrixCaches(ctx context.Context, server string) error
WarmUpGlobalDropMatrixCaches fills the cached global drop matrices of server (for every source category, raw and shim with and without closed zones) as requests do: it skips those cached, and waits for a calculation a request runs instead of running another one. RefreshGlobalDropMatrixCaches recalculates them instead.
type DropMatrixElement ¶
type DropMatrixElement struct {
DropMatrixElementRepo *repo.DropMatrixElement
}
func NewDropMatrixElement ¶
func NewDropMatrixElement(dropMatrixElementRepo *repo.DropMatrixElement) *DropMatrixElement
func (*DropMatrixElement) BatchSaveElements ¶
func (s *DropMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.DropMatrixElement, server string) error
func (*DropMatrixElement) CalcGlobalDropMatrixAggregates ¶
func (s *DropMatrixElement) CalcGlobalDropMatrixAggregates( ctx context.Context, server string, targets []*model.GlobalDropMatrixTarget, sourceCategories []string, ) (map[model.GlobalDropMatrixKey]*model.GlobalDropMatrixAggregate, error)
func (*DropMatrixElement) CalcSiteStatsAggregates ¶
func (s *DropMatrixElement) CalcSiteStatsAggregates( ctx context.Context, server string, fromDayNum, toDayNum null.Int, ) ([]*model.SiteStatsAggregate, error)
func (*DropMatrixElement) DeleteByServerAndDayNum ¶
func (*DropMatrixElement) GetElementsByServerAndSourceCategoryAndDayNumRange ¶
func (s *DropMatrixElement) GetElementsByServerAndSourceCategoryAndDayNumRange( ctx context.Context, server string, sourceCategory string, startDayNum int, endDayNum int, ) ([]*model.DropMatrixElement, error)
func (*DropMatrixElement) IsExistByServerAndDayNum ¶
type DropPatternElement ¶
type DropPatternElement struct {
DropPatternElementRepo *repo.DropPatternElement
}
func NewDropPatternElement ¶
func NewDropPatternElement(dropPatternElementRepo *repo.DropPatternElement) *DropPatternElement
func (*DropPatternElement) GetDropPatternElementsByPatternId ¶
func (s *DropPatternElement) GetDropPatternElementsByPatternId(ctx context.Context, patternId int) ([]*model.DropPatternElement, error)
Cache: dropPatternElements#patternId:{patternId}, 24hrs
func (*DropPatternElement) GetDropPatternElementsMapByPatternIds ¶
func (s *DropPatternElement) GetDropPatternElementsMapByPatternIds(ctx context.Context, patternIds []int) (map[int][]*model.DropPatternElement, error)
type DropReport ¶
type DropReport struct {
DropReportRepo *repo.DropReport
// ColdDropReportRepo, when not nil, serves the archived part of the time ranges of the drop matrix, of the
// pattern matrix and of the customized trend (see CalcDropMatrixForIntervalsBySourceCategories,
// CalcTotalQuantityForPatternMatrixBySourceCategories and CalcTotalQuantityForTrend). In shadow mode
// (ColdstoreShadowEnabled), those answer from PostgreSQL alone and compare the split results in the background.
ColdDropReportRepo *repo.ColdDropReport
// contains filtered or unexported fields
}
func NewDropReport ¶
func NewDropReport(dropReportRepo *repo.DropReport, coldDropReportRepo *repo.ColdDropReport) *DropReport
func (*DropReport) CalcDropMatrixForIntervalsBySourceCategories ¶
func (s *DropReport) CalcDropMatrixForIntervalsBySourceCategories( ctx context.Context, queryCtxs []*model.DropReportQueryContext, sourceCategories []string, ) ([]map[string][]*model.TotalTimesResult, []map[string][]*model.QuantityUniqCountResultForDropMatrix, error)
CalcDropMatrixForIntervalsBySourceCategories, with the cold storage enabled for queries (ColdDropReportRepo), reads the part of each interval before the hot boundary from the cold storage and the rest from PostgreSQL, and adds the two up.
func (*DropReport) CalcQuantityUniqCount ¶
func (s *DropReport) CalcQuantityUniqCount( ctx context.Context, queryCtx *model.DropReportQueryContext, ) ([]*model.QuantityUniqCountResultForDropMatrix, error)
func (*DropReport) CalcRecentUniqueUserCountBySource ¶
func (s *DropReport) CalcRecentUniqueUserCountBySource(ctx context.Context, duration time.Duration) ([]*modelv2.UniqueUserCountBySource, error)
func (*DropReport) CalcTotalQuantityForPatternMatrix ¶
func (s *DropReport) CalcTotalQuantityForPatternMatrix( ctx context.Context, queryCtx *model.DropReportQueryContext, ) ([]*model.TotalQuantityResultForPatternMatrix, error)
func (*DropReport) CalcTotalQuantityForPatternMatrixBySourceCategories ¶
func (s *DropReport) CalcTotalQuantityForPatternMatrixBySourceCategories( ctx context.Context, queryCtx *model.DropReportQueryContext, sourceCategories []string, ) (map[string][]*model.TotalQuantityResultForPatternMatrix, error)
CalcTotalQuantityForPatternMatrixBySourceCategories, with the cold storage enabled for queries (ColdDropReportRepo), reads the part of the interval before the hot boundary from the cold storage and the rest from PostgreSQL, and adds the two up.
func (*DropReport) CalcTotalQuantityForTrend ¶
func (s *DropReport) CalcTotalQuantityForTrend( ctx context.Context, server string, startTime *time.Time, intervalLength time.Duration, intervalNum int, stageIdItemIdMap map[int][]int, accountId null.Int, sourceCategory string, ) ([]*model.TotalQuantityResultForTrend, error)
CalcTotalQuantityForTrend, with the cold storage enabled for queries (ColdDropReportRepo), reads the reports before the hot boundary from the cold storage and the rest from PostgreSQL, and adds the two up per bucket. A bucket that straddles the boundary is counted from both.
func (*DropReport) CalcTotalStageQuantityForShimSiteStats ¶
func (s *DropReport) CalcTotalStageQuantityForShimSiteStats(ctx context.Context, server string, isRecent24h bool) ([]*modelv2.TotalStageTime, error)
func (*DropReport) CalcTotalTimesForDropMatrix ¶
func (s *DropReport) CalcTotalTimesForDropMatrix( ctx context.Context, queryCtx *model.DropReportQueryContext, ) ([]*model.TotalTimesResult, error)
func (*DropReport) CalcTotalTimesForPatternMatrix ¶
func (s *DropReport) CalcTotalTimesForPatternMatrix( ctx context.Context, queryCtx *model.DropReportQueryContext, ) ([]*model.TotalTimesResult, error)
func (*DropReport) CalcTotalTimesForTrend ¶
func (s *DropReport) CalcTotalTimesForTrend( ctx context.Context, server string, startTime *time.Time, intervalLength time.Duration, intervalNum int, stageIds []int, accountId null.Int, sourceCategory string, ) ([]*model.TotalTimesResultForTrend, error)
CalcTotalTimesForTrend splits the trend at the hot boundary as CalcTotalQuantityForTrend.
func (*DropReport) GetDropReports ¶
func (s *DropReport) GetDropReports( ctx context.Context, queryCtx *model.DropReportQueryContext, ) ([]*model.DropReport, error)
func (*DropReport) RunWithStatementTimeout ¶
func (s *DropReport) RunWithStatementTimeout(ctx context.Context, timeout time.Duration, fn func(ctx context.Context) error) error
RunWithStatementTimeout runs fn with a context in which PostgreSQL cancels the drop report aggregations still running timeout after it was called. Each aggregation runs in a transaction of its own; fn holds no connection between them.
type Export ¶
type Export struct {
DropReportService *DropReport
DropPatternElementService *DropPatternElement
ItemService *Item
}
func NewExport ¶
func NewExport( dropReportService *DropReport, dropPatternElementService *DropPatternElement, itemService *Item, ) *Export
func (*Export) ExportDropReportsAndPatterns ¶
type FrontendConfig ¶
func NewFrontendConfig ¶
func NewFrontendConfig(propertyRepo *repo.Property) *FrontendConfig
func (*FrontendConfig) GetFrontendConfig ¶
func (s *FrontendConfig) GetFrontendConfig(ctx context.Context) (json.RawMessage, error)
Cache: (singular) frontend_config, 1 hr
type GeoIP ¶
type GeoIP struct {
// contains filtered or unexported fields
}
func (*GeoIP) InChinaMainland ¶
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
Postgres string `json:"postgres"`
Redis string `json:"redis"`
// NATS is the connection status, e.g. CONNECTED or RECONNECTING
NATS string `json:"nats"`
}
HealthStatus is the state of the dependencies: "degraded" when any of them is down.
type Item ¶
func (*Item) GetItemByArkId ¶
Cache: item#arkItemId:{arkItemId}, 1 hr
func (*Item) GetItemById ¶
func (*Item) GetItemsMapByArkId ¶
Cache: (singular) itemsMapByArkId, 1 hr
func (*Item) GetItemsMapById ¶
Cache: (singular) itemsMapById, 1 hr
func (*Item) GetRecruitTagItemsByBilingualName ¶
Cache: (singular) recruitTagMap, 1 hr
func (*Item) GetShimItemByArkId ¶
Cache: shimItem#arkItemId:{arkItemId}, 1 hr
func (*Item) GetShimItems ¶
Cache: (singular) shimItems, 1 hr; records last modified time
type PatternMatrix ¶
type PatternMatrix struct {
Config *appconfig.Config
TimeRangeService *TimeRange
DropReportService *DropReport
DropInfoService *DropInfo
PatternMatrixElementService *PatternMatrixElement
DropPatternElementService *DropPatternElement
StageService *Stage
ItemService *Item
}
func NewPatternMatrix ¶
func NewPatternMatrix( config *appconfig.Config, timeRangeService *TimeRange, dropReportService *DropReport, dropInfoService *DropInfo, patternMatrixElementService *PatternMatrixElement, dropPatternElementService *DropPatternElement, stageService *Stage, itemService *Item, ) *PatternMatrix
func (*PatternMatrix) DropGlobalPatternMatrixCaches ¶
func (s *PatternMatrix) DropGlobalPatternMatrixCaches(server string)
DropGlobalPatternMatrixCaches deletes the cached global pattern matrices of server that RefreshGlobalPatternMatrixCaches replaces, those cached only: a refresh of them in another process left them stale, and requests recalculate them.
func (*PatternMatrix) GetShimPatternMatrix ¶
func (s *PatternMatrix) GetShimPatternMatrix(ctx context.Context, server string, accountId null.Int, sourceCategory string, showAllPatterns bool, ) (*modelv2.PatternMatrixQueryResult, error)
Cache: shimGlobalPatternMatrix#server|sourceCategory|showAllPatterns:{server}|{sourceCategory}|{showAllPatterns}, 24hrs, records last modified time Called by frontend, used for both global and personal, only for latest timeranges
func (*PatternMatrix) GlobalPatternMatrixCachesUsed ¶
func (s *PatternMatrix) GlobalPatternMatrixCachesUsed(server string) bool
GlobalPatternMatrixCachesUsed reports whether any of the global pattern matrices of server that RefreshGlobalPatternMatrixCaches replaces is used (see cache.Set.Used): whether this process serves them, and should follow their refreshes (cachesync).
func (*PatternMatrix) RefreshGlobalPatternMatrixCaches ¶
func (s *PatternMatrix) RefreshGlobalPatternMatrixCaches(ctx context.Context, server string) error
RefreshGlobalPatternMatrixCaches recalculates the global pattern matrices of server and replaces the cached ones (for every source category, with all and with the top patterns). Requests keep getting the previous ones in the meantime instead of all waiting for a recalculation. If the recalculation fails, the cached ones are dropped, also if it panics (the worker recovers the panic): the source categories cached before it must not keep matrices of this refresh while the others keep those of an earlier one.
func (*PatternMatrix) RunCalcPatternMatrixJob ¶
func (s *PatternMatrix) RunCalcPatternMatrixJob(ctx context.Context, server string) error
Calc today's pattern matrix elements and save to DB Called by worker
func (*PatternMatrix) UpdatePatternMatrixByGivenDate ¶
func (s *PatternMatrix) UpdatePatternMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error
Update pattern matrix elements for a given date (entire day) Called by admin api
func (*PatternMatrix) WarmUpGlobalPatternMatrixCaches ¶
func (s *PatternMatrix) WarmUpGlobalPatternMatrixCaches(ctx context.Context, server string) error
WarmUpGlobalPatternMatrixCaches fills the cached global pattern matrices of server (for every source category, with all and with the top patterns) as requests do: it skips those cached, and waits for a calculation a request runs instead of running another one. RefreshGlobalPatternMatrixCaches recalculates them instead.
type PatternMatrixElement ¶
type PatternMatrixElement struct {
PatternMatrixElementRepo *repo.PatternMatrixElement
}
func NewPatternMatrixElement ¶
func NewPatternMatrixElement(patternMatrixElementRepo *repo.PatternMatrixElement) *PatternMatrixElement
func (*PatternMatrixElement) BatchSaveElements ¶
func (s *PatternMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.PatternMatrixElement, server string) error
func (*PatternMatrixElement) CalcGlobalPatternMatrixAggregates ¶
func (s *PatternMatrixElement) CalcGlobalPatternMatrixAggregates( ctx context.Context, server string, targets []*model.GlobalPatternMatrixTarget, sourceCategories []string, ) (map[string]*model.GlobalPatternMatrixAggregates, error)
func (*PatternMatrixElement) DeleteByServerAndDayNum ¶
func (*PatternMatrixElement) IsExistByServerAndDayNum ¶
type RejectRulesReevaluationEvaluationContext ¶
type RejectRulesReevaluationEvaluationContext struct {
OriginalReport *model.DropReport `json:"originalReport"`
EvaluateContext *reportverifs.ReportContext `json:"evaluateContext"`
}
type RejectRulesReevaluationEvaluationResult ¶
type RejectRulesReevaluationEvaluationResult struct {
RejectRulesReevaluationEvaluationContext
EvaluationShouldRejectToReliability *int `json:"evaluationShouldRejectToReliability"`
}
type RejectRulesReevaluationEvaluationResultSet ¶
type RejectRulesReevaluationEvaluationResultSet []*RejectRulesReevaluationEvaluationResult
type RejectRulesReevaluationEvaluationResultSetChangeSet ¶
type RejectRulesReevaluationEvaluationResultSetChangeSet []*RejectRulesReevaluationEvaluationResultSetDiff
type RejectRulesReevaluationEvaluationResultSetSummary ¶
type RejectRulesReevaluationEvaluationResultSetSummary struct {
TotalCount int `json:"totalCount"`
ChangeSetCount int `json:"changeSetCount"`
ReliabilityChanges []RejectRulesReevaluationEvaluationResultSetSummaryReliabilityChanges `json:"reliabilityChanges"`
SampledEvaluations RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations `json:"sampledEvaluations"`
}
type RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations ¶
type RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations struct {
ShouldReject []*RejectRulesReevaluationEvaluationResult `json:"shouldReject"`
ShouldPass []*RejectRulesReevaluationEvaluationResult `json:"shouldPass"`
}
type Report ¶
type Report struct {
DB *bun.DB
Redis *redis.Client
NatsConn *nats.Conn
NatsJS nats.JetStreamContext
ItemService *Item
StageService *Stage
AccountService *Account
TimeRangeService *TimeRange
StageRepo *repo.Stage
DropInfoRepo *repo.DropInfo
DropReportRepo *repo.DropReport
DropPatternRepo *repo.DropPattern
DropReportExtraRepo *repo.DropReportExtra
DropPatternElementRepo *repo.DropPatternElement
}
func NewReport ¶
func NewReport(db *bun.DB, redisClient *redis.Client, natsConn *nats.Conn, natsJs nats.JetStreamContext, itemService *Item, stageService *Stage, stageRepo *repo.Stage, dropInfoRepo *repo.DropInfo, dropReportRepo *repo.DropReport, dropReportExtraRepo *repo.DropReportExtra, dropPatternRepo *repo.DropPattern, dropPatternElementRepo *repo.DropPatternElement, accountService *Account, timeRangeService *TimeRange) *Report
func (*Report) PipelineAccount ¶
func (*Report) PipelineAggregateGachaboxDrops ¶
func (*Report) PipelineMergeDropsAndMapDropTypes ¶
func (*Report) PipelinePreprocessRecruitmentTags ¶
func (*Report) PipelinePreprocessRerunStageIdForMaa ¶
func (*Report) PreprocessAndQueueBatchReport ¶
func (*Report) PreprocessAndQueueSingularReport ¶
func (s *Report) PreprocessAndQueueSingularReport(ctx *fiber.Ctx, req *types.SingularReportRequest) (taskId string, err error)
returns taskID and error, if any
func (*Report) RecallSingularReport ¶
type SEOCatalog ¶
type SEOCatalog struct {
Items map[string]*SEOItem
// ItemList is ordered by sort ID
ItemList []*SEOItem
Stages map[string]*SEOStage
// StageList is ordered by the numerical stage ID
StageList []*SEOStage
Zones map[string]*SEOZone
// ChangedAt is when the catalog replaced one with other rows, which the rows have no time of their own to tell;
// zero for the first one loaded after a start, so that a start does not move the Last-Modified of every page
ChangedAt time.Time
}
SEOCatalog holds the items, stages and zones.
func NewSEOCatalog ¶
type SEOData ¶
type SEOData struct {
// contains filtered or unexported fields
}
SEOData is the data of the server-rendered stats pages. It never waits for the database: the items, stages and zones are reloaded in the background, and the matrix is the cached global matrix of the frontend, which the calc worker keeps up to date.
func NewSEOData ¶
func (*SEOData) Catalog ¶
func (d *SEOData) Catalog() *SEOCatalog
Catalog returns the items, stages and zones, or nil before they are loaded.
type SEOExistence ¶
type SEOExistence map[string]struct { Exist bool `json:"exist"` OpenTime null.Int `json:"openTime"` CloseTime null.Int `json:"closeTime"` }
SEOExistence is the existence of an item, stage or zone in each server. Stages and zones of events have the times they open and close (epoch milliseconds), items none.
func (SEOExistence) In ¶
func (e SEOExistence) In(server string) bool
func (SEOExistence) OpenAt ¶
func (e SEOExistence) OpenAt(server string, now time.Time) bool
OpenAt tells whether the item, stage or zone is open on server at now, like the frontend (src/utils/existUtils.js): it exists there, has opened (no open time, or one not after now) and has not closed (no close time, or one after now). The close time of what never closes, constant.FakeEndTimeMilli, counts as none.
type SEOItem ¶
type SEOItem struct {
ArkID string
Type string
Name SEOI18n
// Rarity is the rarity as stored, 0 to 4 (the tier minus 1)
Rarity int
SortID int
Group string
Existence SEOExistence
// Alias holds the other names of the item per language for the search of the frontend (zh and ja only, October
// 2026). They are not unique: 土块 is each of 30011 to 30014.
Alias map[string][]string
// Pron holds the readings of the aliases per language, syllables separated by backticks (gu`yuan`yan)
Pron map[string][]string
}
func (*SEOItem) DisplayName ¶
DisplayName is the name of the item in lang (see SEOI18n.In), or its ID if it has none.
type SEOMatrix ¶
type SEOMatrix struct {
Server string
LastModified time.Time
// ByItem holds the rows of each item ordered by rate, then times descending, then stage ID: the frontend's order
ByItem map[string][]SEORow
// ByStage holds the rows of each stage ordered by rate, then times descending, then item ID
ByStage map[string][]SEORow
}
SEOMatrix is the global matrix of a server indexed by item and by stage.
func NewSEOMatrix ¶
type SEORow ¶
type SEORow struct {
*modelv2.OneDropMatrixElement
// Rate is quantity / times rounded to 5 decimals, the frontend's percentage (src/utils/getters.js): the expected
// quantity per run, which exceeds 1 for items dropped more than once per run on average
Rate float64
}
SEORow is a row of the matrix with its drop rate.
type SEOStage ¶
type SEOStage struct {
ArkID string
StageID int
Code SEOI18n
// Sanity is the sanity cost of a full clear, null for stages without one (the gachas, the recruitment)
Sanity null.Int
// IsGacha tells whether the stage is a gacha (extra process GACHABOX), whose times count the items drawn
IsGacha bool
Zone *SEOZone
Existence SEOExistence
}
func (*SEOStage) DisplayCode ¶
DisplayCode is the code of the stage in lang (see SEOI18n.In), or its ID if it has none.
func (*SEOStage) DisplayName ¶
DisplayName is the code of the stage and the name of its zone in lang: stages have no name of their own. A stage named like its zone (the recruitment statistics) is named once.
func (*SEOStage) SanityCost ¶
SanityCost is the sanity a run of the stage costs. ok is false if it has none to compare drops by: none known (or the placeholder 99 the v2 API fills in for none), 0, or a gacha or the recruitment, whose rows count draws and recruitments rather than runs.
func (*SEOStage) SanityPerItem ¶
SanityPerItem is the sanity required per item of a row of the stage with times and quantity: sanity × times ÷ quantity, from the counts rather than the rounded rate the pages divide by (stats.headers.apPPR). ok is false if the stage has no sanity cost (see SanityCost) or the row no drops.
type SEOZone ¶
type SEOZone struct {
ArkID string
ZoneID int
Index int
Category string
Name SEOI18n
Existence SEOExistence
}
func (*SEOZone) DisplayName ¶
DisplayName is the name of the zone in lang (see SEOI18n.In), or its ID if it has none; "" for no zone.
type ShortURL ¶
type ShortURL struct {
ItemService *Item
StageService *Stage
ZoneService *Zone
GeoIPService *GeoIP
}
func NewShortURL ¶
type SiteStats ¶
type SiteStats struct {
DropReportService *DropReport
DropMatrixElementService *DropMatrixElement
StageService *Stage
ItemService *Item
// contains filtered or unexported fields
}
func NewSiteStats ¶
func NewSiteStats( dropReportService *DropReport, dropMatrixElementService *DropMatrixElement, stageService *Stage, itemService *Item, redisClient *redis.Client, ) *SiteStats
func (*SiteStats) DropShimSiteStats ¶
DropShimSiteStats deletes the cached site stats of server, if they are cached: a refresh of them in another process left them stale, and requests recalculate them.
func (*SiteStats) GetShimSiteStats ¶
func (s *SiteStats) GetShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)
Cache: shimSiteStats#server:{server}, 24hrs, records last modified time
A request on a cold cache calculates under the calculation lock, after any refresh in progress, and caches its stats after releasing it: should a refresh then calculate and cache newer stats first, MutexGetSet notices the write and does not cache the request's. The calculation lock is taken while holding the cache's key lock, which refreshes never take, and released before caching, so that no lock cycle with the cache's own locks exists.
func (*SiteStats) InvalidateSiteStatsBase ¶
InvalidateSiteStatsBase must be called after drop matrix elements of a past day of a server have been rewritten: every process, including those calculating a base right now, then recalculates its base.
func (*SiteStats) RefreshShimSiteStats ¶
func (s *SiteStats) RefreshShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)
RefreshShimSiteStats recalculates the site stats of server and replaces the cached ones. Requests keep getting the previous ones in the meantime instead of waiting for a recalculation, unless the cache is cold. If the recalculation fails, the cached ones are dropped, also if it panics.
func (*SiteStats) ShimSiteStatsUsed ¶
ShimSiteStatsUsed reports whether the site stats of server are used (see cache.Set.Used): whether this process serves them, and should follow their refreshes (cachesync).
type Stage ¶
func (*Stage) GetGachaBoxStages ¶
func (*Stage) GetShimStageByArkId ¶
func (s *Stage) GetShimStageByArkId(ctx context.Context, arkStageId string, server string) (*modelv2.Stage, error)
Cache: shimStages#server:{server}, through GetShimStages
func (*Stage) GetShimStages ¶
Cache: shimStages#server:{server}, 1 hr; records last modified time
func (*Stage) GetShimStagesForFakeTime ¶
func (s *Stage) GetShimStagesForFakeTime(ctx context.Context, server string, t time.Time) ([]*modelv2.Stage, error)
Not Cached
func (*Stage) GetStageByArkId ¶
Cache: stage#arkStageId:{arkStageId}, 1 hr
func (*Stage) GetStageById ¶
func (*Stage) GetStagesByZoneId ¶
func (*Stage) GetStagesMapByArkId ¶
Cache: (singular) stagesMapByArkId, 1 hr
func (*Stage) GetStagesMapById ¶
Cache: (singular) stagesMapById, 1 hr
type TimeRange ¶
func NewTimeRange ¶
func (*TimeRange) GetAllMaxAccumulableTimeRangesByServer ¶
func (s *TimeRange) GetAllMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)
GetAllMaxAccumulableTimeRangesByServer returns, for every stage and item of server, all of its accumulable segments (see accumulableSegments) in chronological order, each as one time range from the start of its first time range to the latest end of its time ranges. The global drop matrix is calculated over the last one, and the drop matrix elements of a day are rendered per segment. Cache: allMaxAccumulableTimeRanges#server:{server}, 5 min
func (*TimeRange) GetCurrentTimeRangesByServer ¶
func (*TimeRange) GetLatestTimeRangesByServer ¶
func (s *TimeRange) GetLatestTimeRangesByServer(ctx context.Context, server string) (map[int]*model.TimeRange, error)
Cache: latestTimeRanges#server:{server}, 5 min
func (*TimeRange) GetMaxAccumulableTimeRangesByServer ¶
func (s *TimeRange) GetMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)
GetMaxAccumulableTimeRangesByServer returns, for every stage and item of server, the time ranges of its latest accumulable segment (see accumulableSegments), newest first. The personal drop matrices are calculated over them. Cache: maxAccumulableTimeRanges#server:{server}, 5 min
func (*TimeRange) GetTimeRangeById ¶
Cache: timeRange#rangeId:{rangeId}, 1 hr
func (*TimeRange) GetTimeRangeByServerAndName ¶
type Trend ¶
type Trend struct {
DropReportService *DropReport
DropInfoService *DropInfo
StageService *Stage
ItemService *Item
DropMatrixElementService *DropMatrixElement
}
func NewTrend ¶
func NewTrend( dropReportService *DropReport, dropInfoService *DropInfo, stageService *Stage, itemService *Item, dropMatrixElementService *DropMatrixElement, ) *Trend
func (*Trend) DropShimTrend ¶
DropShimTrend deletes the cached trend of server, if it is cached: a refresh of it in another process left it stale, and requests recalculate it.
func (*Trend) GetShimCustomizedTrendResults ¶
func (*Trend) GetShimTrend ¶
Cache: shimTrend#server:{server}, 24hrs, records last modified time Called by frontend, only for global
func (*Trend) RefreshShimTrend ¶
RefreshShimTrend recalculates the trend of server from the drop matrix elements and replaces the cached one. Requests keep getting the previous one in the meantime instead of waiting for a recalculation, unless the cache is cold: then they wait for the refresh, see cache.Set.Refresh. The trend is not cached if it was dropped or replaced meanwhile (e.g. purged after an admin recalculation of the elements): it may have been calculated from the elements before. If the recalculation fails, the cached one is dropped, also if it panics (the worker recovers the panic). The trend is cached while its last modified time is recorded, as a request's calculation is (see cache.SetLastModifiedTime).
func (*Trend) ShimTrendUsed ¶
ShimTrendUsed reports whether the trend of server is used (see cache.Set.Used): whether this process serves it, and should follow its refreshes (cachesync).
func (*Trend) WarmUpShimTrend ¶
WarmUpShimTrend fills the cached trend of server as a request does: it skips it if it is cached, and waits for a calculation a request runs instead of running another one. RefreshShimTrend recalculates it instead.
type Upyun ¶
type Upyun struct {
// contains filtered or unexported fields
}
func (*Upyun) ImageURIToSignedURL ¶
func (*Upyun) InitImageUpload ¶
func (*Upyun) MarshalImageURI ¶
type Zone ¶
func (*Zone) GetShimZoneByArkId ¶
Cache: shimZone#arkZoneId:{arkZoneId}, 1 hr
func (*Zone) GetShimZones ¶
Cache: (singular) shimZones, 1 hr; records last modified time
func (*Zone) GetZoneByArkId ¶
Cache: zone#arkZoneId:{arkZoneId}, 1 hr
func (*Zone) GetZoneById ¶
Source Files
¶
- 0module.go
- account.go
- activity.go
- admin.go
- analytics.go
- calc_span.go
- drop_info.go
- drop_matrix.go
- drop_matrix_element.go
- drop_pattern_element.go
- drop_report.go
- drop_report_shadow.go
- export.go
- formula.go
- frontend_config.go
- geoip.go
- health.go
- item.go
- notice.go
- pattern_matrix.go
- pattern_matrix_element.go
- report.go
- seo_data.go
- short_url.go
- site_stats.go
- snapshot.go
- stage.go
- stats_catalog.go
- time_range.go
- trend.go
- upyun.go
- zone.go