Documentation
¶
Overview ¶
Package quota is the quota of platform AI: its unit, the tariffs and their caps for a family day, the typical tasks a new task of handwriting must find room for, and the reserve of a kind of call when tutor gives no expected price.
The values are the configuration of api, and a pull request changes them: they are product, not deployment, and a deployment that set its own would make two platforms of one release without a word in the log. The tariff of the closed slice is $1.00 a profile and $3.00 an account.
Index ¶
Constants ¶
const ( // ClosedSlice is the tariff of the closed slice, a code's by default. ClosedSlice = "closed_slice" // Probe is a tariff of a few cents a day, which the operator gives an // account to see the quota run out on a run with app: room for a typical // task and a few checks after it, and no more. Probe = "probe" // DevCheck is the tariff of the account of dev-check on the dev projects, // fivefold the closed slice's, so that the runs of a chain of tasks in one // family day all find room. It is off a deployment alone: there the // commands refuse it, and api reads it as a tariff with no caps. DevCheck = "dev_check" )
The tariffs. An account gets its tariff with its invite code, and the operator changes it by api tariff.
Variables ¶
This section is empty.
Functions ¶
func DevOnly ¶ added in v0.1.50
DevOnly says whether the tariff name is the dev projects' alone, which neither an invite code nor an account of a deployment may have.
func Reached ¶ added in v0.1.34
Reached says whether what the profile or its account has spent has reached its cap of caps: no request of the profile on platform AI goes until the next family day.
func Share ¶ added in v0.1.34
Share is the share of the cap limit that spent takes, in whole percent rounded down, as the share of the quota gives it: 100 is the cap reached, and spending past it is 100 too, as is any of no cap.
func Tariffs ¶
func Tariffs() []string
Tariffs is every tariff, by its name, in the order of the table.
func ValidOffset ¶
ValidOffset says whether minutes is an offset of a clock from UTC that the quota takes: from −12 to +14 hours, a multiple of a quarter of an hour. Any other is ignored, and the request counts under the offset kept.
Types ¶
type Caps ¶
type Caps struct {
Profile, Account Micro
}
Caps are the caps of a tariff for a family day: of each profile, which keeps the children of one account fair to each other, and of the account, which holds what the account spends.
func CapsOf ¶
CapsOf is the caps of the tariff, and false for an account with no tariff or a tariff with no caps: platform AI is closed to it, by default, as the function of admission closes a route it does not know. A tariff of the dev projects alone has its caps only offDeployment, so that, deployed or not told otherwise, an account that got it all the same opens no spending of the platform's.
type Clock ¶
Clock is what an account keeps of its family day: the last offset its devices sent, in minutes, if any, and its current day, if it has had one.
func (Clock) Sent ¶
Sent is the clock c after a request at now that sent the offset reported, if it sent one, and whether it changed: a valid offset is kept, for the days that begin from then on — the current day ends at its own end — and once the day kept is over, the clock keeps the day that holds now. An offset that is not valid is ignored.
type Counter ¶
type Counter struct {
Spent, Reserved Micro
}
Counter is what a counter of a family day holds: spent, and in reserve.
type Day ¶
Day is a family day: the instant it begins, the key of its counters, and the instant it ends, the first of the next.
type Micro ¶
type Micro int64
Micro is an amount of US dollars by tutor's estimate, in whole micro-dollars, as the export writes the counters (exportv7.QuotaCounter): a sum of them adds up the same in every order, which a float does not.
const ( // TypicalHandwriting is a task of handwriting: two checks and the words of a // rung and of praise, ≈ $0.05 by tutor's expected prices (Tutor.Price), with // room for checks dearer than expected, as the first app measured them. TypicalHandwriting Micro = 60_000 // TypicalRubric is a task with a rubric: two readings of the essay with their // assessment, the first submission and one rewrite, ≈ $0.06 by tutor's price // of an essay. TypicalRubric Micro = 60_000 )
The typical tasks. A new task that platform AI checks begins only when what is left of the day holds one, so that the learner does not begin work nobody can read today.
func Reserve ¶
Reserve is what a call of the kind reserves before it goes: tutor's expected price, when it has one, or the value of the kind here.
type Spent ¶
type Spent string
Spent is why a reserve does not fit, in the words of the log's line of an exhausted quota: the cap of the profile or of the account has too little left, or the account has no tariff with caps. Fits is none: it fits.
const ( Fits Spent = "" ProfileCap Spent = "profile" AccountCap Spent = "account" NoTariff Spent = "tariff" )
The reasons a reserve does not fit.