sdk

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustServe

func MustServe(plugin *Plugin)

Types

type Flag

type Flag string
const (
	Deprecated     Flag = "deprecated"
	NotImplemented Flag = "not implemented"
	Experimental   Flag = "experimental"
)

type LockMode

type LockMode int

LockMode represents the locking behavior for task execution.

const (
	// NoLock allows concurrent execution without any locking restrictions (default).
	NoLock LockMode = iota
	// WriteLock allows only one write task at a time, but read tasks can run concurrently.
	WriteLock
	// ExclusiveLock ensures only one task runs at a time, blocking all others.
	// Be careful, it blocks any other tasks like specs refresh.
	// Usually for Jackadi internal operations.
	ExclusiveLock
)

func (LockMode) String

func (lm LockMode) String() string

type Options

type Options interface {
	SetDefaults()
}

type Plugin

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

func New

func New(name string) *Plugin

func (*Plugin) CollectSpecs

func (t *Plugin) CollectSpecs(ctx context.Context) ([]byte, error)

func (Plugin) Do

func (t Plugin) Do(ctx context.Context, task string, input *proto.Input) (core.Response, error)

func (Plugin) GetTaskLockMode

func (t Plugin) GetTaskLockMode(taskName string) (proto.LockMode, error)

func (Plugin) Help

func (t Plugin) Help(taskName string) (map[string]string, error)

func (*Plugin) MustRegisterSpecCollector

func (t *Plugin) MustRegisterSpecCollector(name string, function any) *SpecCollector

MustRegister registers a task (function) with a string identifier.

func (*Plugin) MustRegisterTask

func (t *Plugin) MustRegisterTask(name string, function any) *Task

MustRegisterTask registers a task (function) with a string identifier.

func (Plugin) Name

func (t Plugin) Name() (string, error)

func (Plugin) Tasks

func (t Plugin) Tasks() ([]string, error)

func (Plugin) Version

func (t Plugin) Version() (core.Version, error)

type SpecCollector

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

func (*SpecCollector) WithDescription

func (p *SpecCollector) WithDescription(text string) *SpecCollector

WithDescription set long description.

func (*SpecCollector) WithFlags

func (p *SpecCollector) WithFlags(flags ...Flag) *SpecCollector

WithFlags add flags (e.g. Deprecated, NotImplemented, ...).

func (*SpecCollector) WithSummary

func (p *SpecCollector) WithSummary(text string) *SpecCollector

WithSummary set the short description.

type Task

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

func (*Task) WithArg

func (t *Task) WithArg(name, argType, example string) *Task

WithDoc add an argument.

func (*Task) WithDescription

func (t *Task) WithDescription(text string) *Task

WithDescription set long description.

func (*Task) WithFlags

func (t *Task) WithFlags(flags ...Flag) *Task

WithFlags add flags (e.g. Deprecated, NotImplemented, ...).

func (*Task) WithLockMode

func (t *Task) WithLockMode(lockMode LockMode) *Task

WithLockMode sets the default lock mode for this task.

func (*Task) WithSummary

func (t *Task) WithSummary(text string) *Task

WithSummary set the short description.

Jump to

Keyboard shortcuts

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