platform

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 9 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// DatastoreKV collection KV
	DatastoreKV string = "KV"
	// DefaultExpiration is the minimum time to keep an entry in the store
	DefaultExpiration int64 = 86400 * 14 // 14 days
)
View Source
const (
	// DatastoreTasks collection Task
	DatastoreTasks string = "TASK"
)

Variables

This section is empty.

Functions

func Close

func Close()

Close the platform related clients

func Count

func Count(ctx context.Context, topic, label string, value int)

Count collects a numeric counter value

func Critical

func Critical(topic, format string, args ...interface{})

Critical is like Debug, but on CRITICAL level

func DataStore

func DataStore() *datastore.Client

DataStore returns a reference to the datastore

func Debug

func Debug(topic, format string, args ...interface{})

Debug formats its arguments according to the format, analogous to fmt.Printf, and records the text as a log message at Debug level.

func Get

func Get(ctx context.Context, k string) (string, error)

Get retrieves a value from the store or raises an exception if it does not exist

func GetLastRun added in v0.0.4

func GetLastRun(ctx context.Context, name string) int64

GetLastRun returns the timestamp when a task was last executed

func Info

func Info(topic, format string, args ...interface{})

Info is like Debug, but on INFO level

func Invalidate

func Invalidate(ctx context.Context, k string)

Invalidate removes an entry from the cache

func PrintError

func PrintError(msg string, args ...interface{})

PrintError prints an error message to stderr

func Report

func Report(err error)

Report reports an error, what else?

func Set

func Set(ctx context.Context, k, v string, duration int64) error

Set adds an entry to the store. Existing values get updated

func UpdateTask added in v0.0.4

func UpdateTask(ctx context.Context, name string, ts int64) error

UpdateTask updates the timestamp of a task execution

func Warn

func Warn(topic, format string, args ...interface{})

Warn is like Debug, but on WARN level

Types

type KV

type KV struct {
	Key     string
	Value   string
	Expires int64
}

KV is the datastructure to store stuff

type Task added in v0.0.4

type Task struct {
	Name    string
	Count   int
	LastRun int64
}

Task is the datastructure to store when a task last ran

Jump to

Keyboard shortcuts

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