Documentation ¶
Index ¶
- Constants
- Variables
- func BuildLogger() (*zap.Logger, error)
- type Callable
- type Option
- type Options
- type RunOption
- type RunOptions
- type Runtime
- func (rt *Runtime) Execute(ctx context.Context, host, shell string, opts ...RunOption) ([]byte, error)
- func (rt *Runtime) Inventory() *inv.Manager
- func (rt *Runtime) Logger() *zap.Logger
- func (rt *Runtime) Play(ctx context.Context, pr *process.Process, opts ...RunOption) error
- func (rt *Runtime) RunBpmnProcess(ctx context.Context, definitions *schema.Definitions, ...) error
- func (rt *Runtime) Stop() error
Examples ¶
Constants ¶
View Source
const (
DefaultCacheSize = 1024 * 1024 * 10
)
Variables ¶
View Source
var (
DefaultParallel = runtime.NumCPU() * 2
)
View Source
var (
Version = "0.1.0"
)
Functions ¶
func BuildLogger ¶
Types ¶
type RunOption ¶
type RunOption func(*RunOptions)
func WithMetadata ¶ added in v0.2.2
func WithRunCallback ¶ added in v0.2.0
func WithRunFilter ¶ added in v0.2.0
func WithRunSync ¶ added in v0.2.0
func WithRunTracer ¶ added in v0.2.0
type RunOptions ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Example ¶
package main import ( "context" "go.uber.org/zap" "github.com/olive-io/bee" inv "github.com/olive-io/bee/inventory" "github.com/olive-io/bee/parser" "github.com/olive-io/bee/vars" ) var inventoryText = ` host1 bee_host=localhost:22 bee_user=root bee_ssh_passwd=123456 ` func main() { sources := []string{"host1"} lg, _ := zap.NewDevelopment() dataloader := parser.NewDataLoader() if err := dataloader.ParseString(inventoryText); err != nil { lg.Fatal("parse inventory", zap.Error(err)) } inventory, err := inv.NewInventoryManager(dataloader, sources...) if err != nil { lg.Fatal("inventory manager", zap.Error(err)) } variables := vars.NewVariablesManager(dataloader, inventory) options := []bee.Option{ bee.SetDir("_output/bee"), bee.SetLogger(lg), bee.SetModulePath([]string{"_output/mymodule"}), } rt, err := bee.NewRuntime(inventory, variables, dataloader, options...) if err != nil { lg.Fatal("bee runtime", zap.Error(err)) } ctx := context.TODO() execOptions := make([]bee.RunOption, 0) data, err := rt.Execute(ctx, "host1", "hello_world name=lack", execOptions...) if err != nil { lg.Fatal("bee runtime", zap.Error(err)) } lg.Info("output", zap.String("data", string(data))) }
Output:
func NewRuntime ¶
func NewRuntime( inventory *inv.Manager, variables *vars.VariableManager, loader *parser.DataLoader, opts ...Option, ) (*Runtime, error)
func (*Runtime) RunBpmnProcess ¶ added in v0.2.0
Directories ¶
Path | Synopsis |
---|---|
api
|
|
cmd
|
|
server
|
|
slog
Package slog provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs.
|
Package slog provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs. |
slog/internal/buffer
Package buffer provides a pool-allocated byte buffer.
|
Package buffer provides a pool-allocated byte buffer. |
test
|
|
Click to show internal directories.
Click to hide internal directories.