platform

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 14 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 (
	// DatastoreMetrics collection of metrics
	DatastoreMetrics string = "METRICS"
	// CountType is a int counter
	CountType = "COUNTER"
)
View Source
const (
	// DatastoreJobs collection of job / cron metadata
	DatastoreJobs string = "JOBS"
)

Variables

This section is empty.

Functions

func Close

func Close()

Close the platform related clients

func Count

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

Count records a numeric counter value

func CreateSimpleTask added in v0.10.0

func CreateSimpleTask(ctx context.Context, handler, payload string) (*taskspb.Task, error)

CreateSimpleTask is used to schedule a background task using the default queue. The payload is a simple string, i.e. no marshalling happens.

func CreateTask added in v0.10.0

func CreateTask(ctx context.Context, handler string, payload interface{}) (*taskspb.Task, error)

CreateTask is used to schedule a background task using the default queue. The payload can be any struct and will be marshalled into a json string.

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 client

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 GetJobTimestamp added in v0.9.0

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

GetJobTimestamp returns the timestamp when a job was last executed

func GetKV added in v0.9.0

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

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

func Info

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

Info is like Debug, but on INFO level

func InvalidateKV added in v0.9.0

func InvalidateKV(ctx context.Context, k string)

InvalidateKV removes an entry from the cache

func Log added in v0.12.0

func Log(args interface{}, labels map[string]string)

Log simple reports a datastructure, on INFO level

func PrintError

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

PrintError prints an error message to stderr

func ReportError added in v0.9.0

func ReportError(err error)

ReportError reports an error, what else?

func SetKV added in v0.9.0

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

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

func Storage added in v0.13.0

func Storage() *storage.Client

Storage returns a reference to the storage client

func UpdateJob added in v0.9.0

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

UpdateJob updates the timestamp and count of the job metadata

func Warn

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

Warn is like Debug, but on WARN level

Types

type Counter added in v0.9.0

type Counter struct {
	Metric
	Value int64
}

Counter is a metric to collect integer values

type Job added in v0.9.0

type Job struct {
	Name    string
	Count   int
	LastRun int64
}

Job is the datastructure to store when a job was last run

type KV

type KV struct {
	Key     string
	Value   string
	Expires int64
}

KV is the datastructure to store stuff

type Metric added in v0.9.0

type Metric struct {
	Name    string // unique name of the metric
	Label   string // additional context, e.g. an id, name/value pairs, comma separated labels etc
	Type    string // the type, e.g. count,
	Created int64
}

Metric is a generic data structure to store metrics

Jump to

Keyboard shortcuts

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