Documentation
¶
Overview ¶
Package activity counts the install as active, once a day it's used (spec_054_active_installs): the first time a front end is used on a day, it's marked in ~/.blitz/activity.json and a ping goes to Retail Cortex with the install's random ID, the day, the front end, the version and the platform, and nothing else. A ping that fails is tried again for up to Keep days. [usage] count = false turns all of it off.
Index ¶
Constants ¶
const ( Desktop = "desktop" CLI = "cli" VSCode = "vscode" )
The front ends (AI-01).
const URL = "https://license.retailcortex.com/v1/blitz/active"
URL is where the pings go (AI-10); BLITZ_ACTIVITY_URL replaces it (AI-13).
Variables ¶
var ( Wait = 5 * time.Second Keep = 3 )
Wait is how long a ping may take (AI-11); Keep how many days before today a ping that failed is still tried (AI-12).
var Fronts = []string{Desktop, CLI, VSCode}
Fronts are the front ends a ping may name.
Functions ¶
Types ¶
type Recorder ¶
type Recorder struct {
Dir string // ~/.blitz: activity.json and install-id
Version string // Blitz's
// On says whether use is counted: [usage] count (AI-30), read at each
// use so a change applies at once. nil is on.
On func() bool
// URL is where the pings go: URL, or BLITZ_ACTIVITY_URL, unless set.
URL string
HTTP *http.Client
Now func() time.Time
// contains filtered or unexported fields
}
Recorder marks the day's use and sends the pings. Its zero value isn't usable: give Dir and Version at least.
func (*Recorder) Flush ¶
Flush sends the pings still to send (AI-10, AI-12): those Retail Cortex takes, or refuses as not counted, aren't sent again; those that fail are kept for a later flush, within Keep days. The file isn't locked while the pings go (AI-11: a Mark never waits on the network), and what was sent is merged into the file as it is then, so a day marked meanwhile, here or by another process, is kept.