Brainstorming/HostFerret/SQL/hf checkins: Difference between revisions
< Brainstorming | HostFerret | SQL
Jump to navigation
Jump to search
m (updated syntax highlight tag) |
(some corrections) |
||
Line 2: | Line 2: | ||
'''Purpose''': Rather than log each and every single checkin, we'll just keep statistics about stretches of checkins that fall within expected time-limits. That is, as long as a checkin isn't too late, we'll just treat it as part of a stretch of checkins and keep stats about the stretch. Each record is actually a stretch; maybe I should rename the table. | '''Purpose''': Rather than log each and every single checkin, we'll just keep statistics about stretches of checkins that fall within expected time-limits. That is, as long as a checkin isn't too late, we'll just treat it as part of a stretch of checkins and keep stats about the stretch. Each record is actually a stretch; maybe I should rename the table. | ||
Also for now, there will be no security – i.e. you don't have to have an account or permission to log a check-in (though you will need to have permission to access the logs). '''We will need security''' in order to implement DNS host record updating | Also for now, there will be no security – i.e. you don't have to have an account or permission to log a check-in (though you will need to have permission to access the logs). '''We will need security''' in order to implement DNS host record updating, otherwise any client which guesses an active name could cause a domain to be redirected to their IP. | ||
==Fields== | ==Fields== | ||
* '''Stats*''': These collect enough information to allow mean and [[variance]]/[[standard deviation]] to be calculated. | * '''Stats*''': These collect enough information to allow mean and [[variance]]/[[standard deviation]] to be calculated. | ||
Line 9: | Line 8: | ||
** '''Stats_DiffSum''': total of all time-intervals (note that this should be divided by (N-1) to produce [[mean]] | ** '''Stats_DiffSum''': total of all time-intervals (note that this should be divided by (N-1) to produce [[mean]] | ||
** '''Stats_DiffSSq''': sum of time-interval squares | ** '''Stats_DiffSSq''': sum of time-interval squares | ||
==History== | |||
* '''2017-12-10''' Removed ID_Session, because (mainly) we'd have to save cookies somehow on the wget side or else we'd create a new session each time. | |||
** Also added missing "NOT" to NameGiven | |||
==SQL== | ==SQL== | ||
<syntaxhighlight lang=mysql>CREATE TABLE `hf_checkins` ( | <syntaxhighlight lang=mysql>CREATE TABLE `hf_checkins` ( | ||
`ID` | `ID` INT NOT NULL AUTO_INCREMENT, | ||
`NameGiven` | `NameGiven` VARCHAR(255) NOT NULL COMMENT "self-identifying string offered by remote", | ||
`WhenStart` | `WhenStart` DATETIME NOT NULL COMMENT "when the stretch started", | ||
`Stats_Count` INT NOT NULL COMMENT "number of checkins in this stretch", | |||
`Stats_Count` | `Stats_DiffSum` INT NOT NULL COMMENT "SUM(X) where X is interval since previous checkin", | ||
`Stats_DiffSum` | `Stats_DiffSSq` INT NOT NULL COMMENT "SUM(X^2)", | ||
`Stats_DiffSSq` | |||
PRIMARY KEY(`ID`) | PRIMARY KEY(`ID`) | ||
) | ) | ||
ENGINE = InnoDB;</syntaxhighlight> | ENGINE = InnoDB;</syntaxhighlight> |
Revision as of 22:31, 10 December 2017
About
Purpose: Rather than log each and every single checkin, we'll just keep statistics about stretches of checkins that fall within expected time-limits. That is, as long as a checkin isn't too late, we'll just treat it as part of a stretch of checkins and keep stats about the stretch. Each record is actually a stretch; maybe I should rename the table.
Also for now, there will be no security – i.e. you don't have to have an account or permission to log a check-in (though you will need to have permission to access the logs). We will need security in order to implement DNS host record updating, otherwise any client which guesses an active name could cause a domain to be redirected to their IP.
Fields
- Stats*: These collect enough information to allow mean and variance/standard deviation to be calculated.
- Stats_Count (N): number of checkins total
- Stats_DiffSum: total of all time-intervals (note that this should be divided by (N-1) to produce mean
- Stats_DiffSSq: sum of time-interval squares
History
- 2017-12-10 Removed ID_Session, because (mainly) we'd have to save cookies somehow on the wget side or else we'd create a new session each time.
- Also added missing "NOT" to NameGiven
SQL
CREATE TABLE `hf_checkins` (
`ID` INT NOT NULL AUTO_INCREMENT,
`NameGiven` VARCHAR(255) NOT NULL COMMENT "self-identifying string offered by remote",
`WhenStart` DATETIME NOT NULL COMMENT "when the stretch started",
`Stats_Count` INT NOT NULL COMMENT "number of checkins in this stretch",
`Stats_DiffSum` INT NOT NULL COMMENT "SUM(X) where X is interval since previous checkin",
`Stats_DiffSSq` INT NOT NULL COMMENT "SUM(X^2)",
PRIMARY KEY(`ID`)
)
ENGINE = InnoDB;