runtime

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooEarly    = errors.New(http.StatusTooEarly, "***TOO EARLY***", "fns: service is not ready, try later again")
	ErrUnavailable = errors.Unavailable("fns: server is closed")
)

Functions

func AcquireLocker

func AcquireLocker(ctx context.Context, key []byte, ttl time.Duration) (locker shareds.Locker, err error)

func AppId added in v1.1.3

func AppId(ctx context.Context) []byte

func AppName added in v1.1.3

func AppName(ctx context.Context) string

func AppVersion added in v1.1.3

func AppVersion(ctx context.Context) versions.Version

func Barrier

func Barrier(ctx context.Context, key []byte, fn func() (result interface{}, err error)) (result barriers.Result, err error)

func CheckHealth

func CheckHealth(ctx context.Context, client transports.Client) (ok bool)

func Endpoints

func Endpoints(ctx context.Context) services.Endpoints

func Execute

func Execute(ctx context.Context, task workers.Task)

func HealthHandler

func HealthHandler() transports.MuxHandler

func Middleware

func Middleware(rt *Runtime) transports.Middleware

func SharedStore

func SharedStore(ctx context.Context) (store shareds.Store)

func TryExecute

func TryExecute(ctx context.Context, task workers.Task) bool

func With

func With(ctx context.Context, rt *Runtime) context.Context

Types

type Health

type Health struct {
	Id      string    `json:"id" avro:"id"`
	Name    string    `json:"name" avro:"name"`
	Version string    `json:"version" avro:"version"`
	Running bool      `json:"running" avro:"running"`
	Serving bool      `json:"serving" avro:"serving"`
	Launch  time.Time `json:"launch" avro:"launch"`
	Now     time.Time `json:"now" avro:"now"`
}

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func Load

func Load(ctx context.Context) *Runtime

func New

func New(id string, name string, version versions.Version, status *switchs.Switch, log logs.Logger, worker workers.Workers, endpoints services.Endpoints, barrier barriers.Barrier, shared shareds.Shared) *Runtime

func (*Runtime) AppId

func (rt *Runtime) AppId() []byte

func (*Runtime) AppName

func (rt *Runtime) AppName() string

func (*Runtime) AppVersion

func (rt *Runtime) AppVersion() versions.Version

func (*Runtime) Barrier

func (rt *Runtime) Barrier() barriers.Barrier

func (*Runtime) Endpoints

func (rt *Runtime) Endpoints() services.Endpoints

func (*Runtime) Execute

func (rt *Runtime) Execute(ctx context.Context, task workers.Task)

func (*Runtime) RootLog

func (rt *Runtime) RootLog() logs.Logger

func (*Runtime) Running

func (rt *Runtime) Running() (running bool, serving bool)

func (*Runtime) Shared

func (rt *Runtime) Shared() shareds.Shared

func (*Runtime) TryExecute

func (rt *Runtime) TryExecute(ctx context.Context, task workers.Task) bool

func (*Runtime) Workers

func (rt *Runtime) Workers() workers.Workers

Jump to

Keyboard shortcuts

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