sensordata

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MachineID_DataType_GSI           string = "DataType_MachineID"
	SerialNum_DataType_MachineID_GSI string = "SerialNum_DataType_MachineID"
)

Variables

This section is empty.

Functions

func GetDataType

func GetDataType() types.DataType

func GetSensorDataExpiresAfter

func GetSensorDataExpiresAfter(timeProvider clock.TimeProvider) int64

func MachineIDSensorDataPKSK

func MachineIDSensorDataPKSK(machineID string) (string, string)

MachineIDSensorDataPKSK returns the partition and sort keys for a machine id

func SensorDataPK

func SensorDataPK(machineID string) string

Types

type ConcreteSensorDataFinder

type ConcreteSensorDataFinder struct {
	// contains filtered or unexported fields
}

func (ConcreteSensorDataFinder) GetMachineIDsFromSerialNumber

func (f ConcreteSensorDataFinder) GetMachineIDsFromSerialNumber(serialNumber string, limit int32) (machineIDs []string, err error)

func (ConcreteSensorDataFinder) GetMachineIDsStartingWith

func (f ConcreteSensorDataFinder) GetMachineIDsStartingWith(prefix string, limit int32) (machineIDs []string, err error)

type SensorData

type SensorData struct {
	dynamodb.PrimaryKey
	MachineID            string           `dynamodbav:"MachineID"`
	SerialNum            string           `dynamodbav:"SerialNum"`
	OSVersion            string           `dynamodbav:"OSVersion"`
	OSBuild              string           `dynamodbav:"OSBuild"`
	SantaVersion         string           `dynamodbav:"SantaVersion"`
	ClientMode           types.ClientMode `dynamodbav:"ClientMode"`
	RequestCleanSync     bool             `dynamodbav:"RequestCleanSync"`
	PrimaryUser          string           `dynamodbav:"PrimaryUser"`
	RuleCount            int              `dynamodbav:"RuleCount"`
	CertificateRuleCount int              `dynamodbav:"CertificateRuleCount"`
	BinaryRuleCount      int              `dynamodbav:"BinaryRuleCount"`
	CDHashRuleCount      int              `dynamodbav:"CDHashRuleCount"`
	TeamIDRuleCount      int              `dynamodbav:"TeamIDRuleCount"`
	SigningIDRuleCount   int              `dynamodbav:"SigningIDRuleCount"`
	CompilerRuleCount    int              `dynamodbav:"CompilerRuleCount"`
	TransitiveRuleCount  int              `dynamodbav:"TransitiveRuleCount"`
	Time                 string           `dynamodbav:"Time"`
	ExpiresAfter         int64            `dynamodbav:"ExpiresAfter,omitempty"`
	DataType             types.DataType   `dynamodbav:"DataType"`
}

SensorData encapsulation for a DDB row encapsulating data that is uploaded in preflight

func GetSensorData

func GetSensorData(client dynamodb.GetItemAPI, machineID string) (sensorData *SensorData, err error)

GetSensorData gets a previously stored sensor data BUG(derek.wang) In a NoSQL database like DynamoDB the whole idea of save-then-get is an antipattern.

It requires this call to be strongly consistent with doubles the cost.
We should think about a different way of designing the data model.

func NewSensorData

func NewSensorData(
	timeProvider clock.TimeProvider,
	machineID string,
	serialNumber string,
	osVersion string,
	osBuild string,
	santaVersion string,
	clientMode rudolphtypes.ClientMode,
	requestCleanSync bool,
	primaryUser string,
	certRuleCount int,
	binaryRuleCount int,
	cdHashRuleCount int,
	teamIDRuleCount int,
	signingIDRuleCount int,
	compilerRuleCount int,
	transitiveRuleCount int,
) SensorData

type SensorDataFinder

type SensorDataFinder interface {
	GetMachineIDsStartingWith(prefix string, limit int32) ([]string, error)
	GetMachineIDsFromSerialNumber(serialNumber string, limit int32) ([]string, error)
}

SensorDataFinder is a service that allows you to search the SensorData logs for machineIDs or serial numbers of sensors that have recently checked into Rudolph

This service is particularly useful for typeahead and can be re-used for external applications.

func GetSensorDataFinder

func GetSensorDataFinder(api dynamodb.QueryAPI) SensorDataFinder

type SerialNumDataTypeMachineIdGSIItem

type SerialNumDataTypeMachineIdGSIItem struct {
	PrimaryKey dynamodb.PrimaryKey
	SerialNumb string         `dynamodbav:"SerialNum"`
	MachineID  string         `dynamodbav:"MachineID"`
	DataType   types.DataType `dynamodbav:"DataType"`
}

Notes

Bugs

  • In a NoSQL database like DynamoDB the whole idea of save-then-get is an antipattern.

    It requires this call to be strongly consistent with doubles the cost.
    We should think about a different way of designing the data model.
    

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL