api

package
v0.0.0-...-7b48451 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package api defines RPC messages used to communicate with the runner module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Bucket string         `json:"bucket"`
	Data   map[string]any `json:"data"`
}

type Amendment

type Amendment struct {
	Bucket  string        `json:"bucket"`
	Time    time.Time     `json:"time"`
	Message string        `json:"msg"`
	Replace []Replacement `json:"replace,omitempty"`
}

type BucketMetadata

type BucketMetadata struct {
	ID       string         `json:"id"`
	Name     string         `json:"name"`
	Type     string         `json:"type"`
	Client   string         `json:"client"`
	Hostname string         `json:"hostname"`
	Created  time.Time      `json:"created"`
	Data     map[string]any `json:"data,omitempty"`
	Events   []Event        `json:"events,omitempty"`
}

type Config

type Config struct {
	LogLevel  *slog.Level `json:"log_level,omitempty"`
	AddSource *bool       `json:"log_add_source,omitempty"`
	Options   struct {
		DynamicLocation *bool `json:"dynamic_location,omitempty"`
		Web             *Web  `json:"web,omitempty"`
		// Database is the URL location of the worklog
		// database. When the scheme is sqlite, the location
		// is a directory relative to XDG_STATE_HOME as
		// URL opaque data.
		Database  string          `json:"database,omitempty"`
		Hostname  string          `json:"hostname,omitempty"`
		Heartbeat *rpc.Duration   `json:"heartbeat,omitempty"`
		Rules     map[string]Rule `json:"rules,omitempty"`
	} `json:"options,omitempty"`
}

Config defines configuration options.

type DetailMapper

type DetailMapper interface {
	DetailMap() map[string]any
}

DetailMapper is the report details interface.

type Event

type Event struct {
	Bucket   string         `json:"bucket,omitempty"`
	ID       int64          `json:"id,omitempty"`
	Start    time.Time      `json:"start"`
	End      time.Time      `json:"end"`
	Data     map[string]any `json:"data,omitempty"`
	Continue *bool          `json:"continue,omitempty"`
}

type MapDetails

type MapDetails map[string]any

MapDetails is a generic detailer. Type information may not be present so it is the CEL code's responsibility to ensure that values are converted to appropriate types.

func (MapDetails) DetailMap

func (d MapDetails) DetailMap() map[string]any

type Replacement

type Replacement struct {
	Start time.Time      `json:"start"`
	End   time.Time      `json:"end"`
	Data  map[string]any `json:"data"`
}

type Report

type Report struct {
	Time    time.Time    `json:"time"`
	Period  rpc.Duration `json:"period"`
	Details DetailMapper `json:"details"`
}

func (*Report) Map

func (r *Report) Map() map[string]any

func (*Report) UnmarshalJSON

func (r *Report) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into the receiver, detecting the type of the details. If the details field in data can be unmarshalled into a WatcherDetails, this type will be used, otherwise it will be unmarshalled into a MapDetailer.

type Rule

type Rule struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Src  string `json:"src"`
}

type WatcherDetails

type WatcherDetails watcher.Details

WatcherDetails is a set of variables provided to rules from a watcher event message. Each field is provided to the CEL environment as a field of the global, curr, and the previous evaluation's values are available as fields of the global, last. See watcher.Details for the names used for fields in the CEL environment.

func (*WatcherDetails) DetailMap

func (d *WatcherDetails) DetailMap() map[string]any

type Web

type Web struct {
	// Addr is the dashboard and dump server address.
	Addr string `json:"addr"`

	// HTML is the path to custom HTML for dashboard rendering.
	HTML string `json:"html,omitempty"`

	// Rules is the set of transformation rules for rendering
	// events on a dashboard. The map keys are source bucket
	// and destination bucket.
	Rules map[string]map[string]WebRule `json:"rules,omitempty"`

	// AllowModification enables the amend and load endpoints
	// on the server, allowing direct modification of the
	// bucket contents. For this configuration to be effective
	// Addr must be a loopback device.
	AllowModification bool `json:"can_modify"`
}

type WebRule

type WebRule struct {
	Name string `json:"name"`
	Src  string `json:"src"`
}

Jump to

Keyboard shortcuts

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