db

package
v0.0.0-...-99a6bcb Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

TableName: customers Schema: customerName (text), customerSecret (text), id (int), status(text) Status Values: "Active", "Inactive"

TableName: {customerName}_devices Schema: fp (text), lastHB (text), status (text) fp - device fingerprint - has to be unique lastHB - string representation of a time at which last heart beat was gotten from this device status - "Active", "RMA"

//Assumptions - licenses for same feature will have same usagePeriod TableName: {customerName}_purchases Schema: featureName(text), licCount(int), usagePeriod (int), purchaseTime(text) licCount - count remaining on a purchased license [Constraint >= 0] usagePeriod - seconds of usage for each of the license

TableName: {customerName}_licenseAllocs Schema: featureName(text), deviceFp(text), status(text), periodLeft(int), lastUse(text) deviceFp - is "" when the license is NOT allocated to any device status - "InUse", "Available"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomerPurchase

func AddCustomerPurchase(custName, feature string, licenseCount, usagePeriod int) error

func AddDevice

func AddDevice(custName string, deviceFp string) (bool, bool)

func AllocateLicense

func AllocateLicense(custName, deviceFp, feature string) bool

func DeviceHeartBeat

func DeviceHeartBeat(custName, deviceFp string, autoRealloc bool) (expiredLics []string, err error)

func FreeLicense

func FreeLicense(custName, deviceFp, feature string) bool

func GetCustomerNames

func GetCustomerNames() []string

func InitLicenseDb

func InitLicenseDb(ctx Context) Context

func IsValidCustomer

func IsValidCustomer(custName string) (status string, ok bool)

func IsValidCustomerSecret

func IsValidCustomerSecret(custName string, inSecret string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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