autoflow

package
v19.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "autoflow"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowLimiter added in v19.1.0

type AllowLimiter interface {
	Allow(ctx context.Context) bool
}

func NewRedisAllowLimiter added in v19.1.0

func NewRedisAllowLimiter(
	redisClient rueidis.Client,
	keyPrefix string,
	perMinute uint32,
	log *slog.Logger,
	handleProcessingError func(msg string, err error),
	tracer trace.Tracer,
	meter otelmetric.Meter,
) (AllowLimiter, error)

NewRedisAllowLimiter returns a metrics-instrumented AllowLimiter backed by a Redis token bucket keyed per project ID + event type, allowing perMinute events through each one-minute window. Returns an error if the metric instrumentation fails to register.

type CompositeModuleManager added in v19.1.0

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

func NewCompositeModuleManager added in v19.1.0

func NewCompositeModuleManager(delegate flowcore.ModuleManager, modules map[int64]pkg_autoflow.Module) *CompositeModuleManager

NewCompositeModuleManager builds a module manager that serves the given built-in modules in-process and delegates everything else. The map key is the built-in module's agent id.

func (*CompositeModuleManager) InvokeAction added in v19.1.0

func (m *CompositeModuleManager) InvokeAction(
	ctx context.Context,
	agentKey api.AgentKey,
	actionName, workflowKey, identityKey string,
	args []*pkg_autoflow.Value,
	kwargs []*pkg_autoflow.NamedValue,
	channelTokens []*pkg_autoflow.ChannelToken,
) (*pkg_autoflow.Result, error)

func (*CompositeModuleManager) LoadModuleDescriptor added in v19.1.0

func (m *CompositeModuleManager) LoadModuleDescriptor(ctx context.Context, moduleName string) (*flowcore.RegisteredModuleDescriptor, error)

type RateLimiterCtxKey added in v19.1.0

type RateLimiterCtxKey string

type RedisModuleRegistry added in v19.1.0

type RedisModuleRegistry struct {
	Client    rueidis.Client
	KeyPrefix string
	TTL       time.Duration
	Validator protovalidate.Validator
}

RedisModuleRegistry registers AutoFlow modules in Redis. A module's descriptor can be looked up by name.

func (*RedisModuleRegistry) LoadModuleDescriptor added in v19.1.0

func (r *RedisModuleRegistry) LoadModuleDescriptor(ctx context.Context, moduleName string) (*flowcore.RegisteredModuleDescriptor, error)

LoadModuleDescriptor loads a module descriptor from Redis. Returns (nil, nil) if not found.

func (*RedisModuleRegistry) RegisterDescriptor added in v19.1.0

func (r *RedisModuleRegistry) RegisterDescriptor(ctx context.Context, moduleName string, desc *flowcore.RegisteredModuleDescriptor) error

type RemoteModuleClient added in v19.1.0

type RemoteModuleClient struct {
	AgentConnPool func(api.AgentKey) grpc.ClientConnInterface
}

func (*RemoteModuleClient) InvokeAction added in v19.1.0

InvokeAction sends a request to a matching agent.

This method uses the simplified tunneling approach. A Remote AutoFlow Module client for that agent key must have an open InvokeAction RPC call to any Relay. The req is routed through a gateway Relay (potentially itself) to that client. This method must send the RPC messages in reversed order - meaning that the actually defined RPC "response" becomes this client's request and the vice versa.

type RemoteModuleManager added in v19.1.0

type RemoteModuleManager struct {
	ModuleClient *RemoteModuleClient
	Registry     *RedisModuleRegistry
}

func (*RemoteModuleManager) InvokeAction added in v19.1.0

func (m *RemoteModuleManager) InvokeAction(
	ctx context.Context,
	agentKey api.AgentKey,
	actionName, workflowKey, identityKey string,
	args []*pkg_autoflow.Value,
	kwargs []*pkg_autoflow.NamedValue,
	channelTokens []*pkg_autoflow.ChannelToken,
) (*pkg_autoflow.Result, error)

func (*RemoteModuleManager) LoadModuleDescriptor added in v19.1.0

func (m *RemoteModuleManager) LoadModuleDescriptor(ctx context.Context, moduleName string) (*flowcore.RegisteredModuleDescriptor, error)

type WorkflowRateLimiter added in v19.1.0

type WorkflowRateLimiter struct {
	AllowLimiter AllowLimiter
}

WorkflowRateLimiter wraps a generic allowLimiter to provide a more suitable interface. This type mostly exists because the redistool.TokenLimiter implements this interface, too. NOTE: we may consider refactoring the redistool.TokenLimiter and metric.AllowLimiter to be more generic and not needing the HandleProcessingError (the caller can do that) and RequestKey function. The latter value can be provided as argument by the caller.

func (*WorkflowRateLimiter) Allow added in v19.1.0

func (l *WorkflowRateLimiter) Allow(ctx context.Context, projectID int64, eventType string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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