pebl

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package sdk provides go bindings for pebl's system calls.

For more detailed guides on utilizing pebl, check out the docs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cron

func Cron(name, schedule string, method func()) error

Cron creates a scheduled task.

The name identifies the scheduled task, and subsequent uses of the same name will overwrite the same logical task.

The schedule must be valid cron schedule with 5 fields separated by spaces. It also accepts @hourly and @daily, which are shorthand for "0 * * * *" and "0 0 * * *" respectively.

func InternalService

func InternalService(app http.Handler, endpoint string) error

InternalService takes an http.Handler and creates a private service at the endpoint. A private service can only be reached by other workloads in the cluster using the provided `endpoint` argument.

Unlike `Service`, the `endpoint` used here can be any valid domain. Though in general we recommend a scheme to easily identify internal vs. external services, something like `foo.local` or `bar.private`.

func KVGet added in v0.0.10

func KVGet(key string) (string, bool, error)

func KVSet added in v0.0.10

func KVSet(key, value string) error

func Mount added in v0.1.1

func Mount(name, path string) error

func Publish added in v0.1.0

func Publish(topic, data string) error

func Read

func Read(path string) (io.ReadCloser, error)

Read returns an object with io.ReadCloser interface.

Interleaving Read and Write on the same path may result in unexpected behavior.

func Service

func Service(app http.Handler, endpoint string) error

Service takes an http.Handler and creates a serving resource at the endpoint. This service will be reachable from outside the cluster from the provided `endpoint` argument.

The endpoint must be a valid domain owned by the user.

func Subscribe added in v0.1.0

func Subscribe(topic string, cb func(string)) error

func Write

func Write(path string) (io.WriteCloser, error)

Write returns an object with io.WriteCloser interface. Close() must be called before the contents of the Write() are made available at the provided path.

Interleaving Read and Write on the same path may result in unexpected behavior.

Types

type MysqlConn added in v0.0.6

type MysqlConn struct {
	User     string
	Password string
	Addr     string
	Host     string
	Port     int
}

MysqlConn provides the connection information for a mysql instance

func Mysql added in v0.0.6

func Mysql(name string) (*MysqlConn, error)

Mysql returns connection information for the provided mysql instance with the name `name`

type RedisConn

type RedisConn struct {
	Addr string
	Host string
	Port int
}

RedisConn provides the Host and Port of the target redis instance

func Redis

func Redis(name string) (*RedisConn, error)

Redis returns connection information for the provided redis instance with the name `name`

Jump to

Keyboard shortcuts

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