Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithThrottler(ctx context.Context, debugLog io.Writer, confs *ThrottleConfigurations) context.Context
- func ErrorType(err error) errType
- func MakeStoreProto(data *EventData, at *EventAttachments) *storage.StoredTask
- func NameOf(ev *ActionEvent) (string, string)
- func Retain(af *RunningAction) *storage.Command
- func Return[V any](ctx context.Context, ev *ActionEvent, f func(context.Context) (V, error)) (V, error)
- func Return0(ctx context.Context, ev *ActionEvent, f func(context.Context) error) error
- func SetupFlags(flags *pflag.FlagSet)
- func TraceCaller(ctx context.Context, makeLogger func(context.Context) io.Writer, name string)
- func TryProtoAsJson(pr ProtoResolver, msg proto.Message, multiline bool) ([]byte, error)
- func WithSink(ctx context.Context, sink ActionSink) context.Context
- type ActionArgument
- type ActionEvent
- func (ev *ActionEvent) Anchor(id ActionID) *ActionEvent
- func (ev *ActionEvent) Arg(name string, msg interface{}) *ActionEvent
- func (ev *ActionEvent) Category(category string) *ActionEvent
- func (ev *ActionEvent) Clone(makeName func(string) string) *ActionEvent
- func (ev *ActionEvent) HumanReadablef(label string, args ...interface{}) *ActionEvent
- func (ev *ActionEvent) ID(id ActionID) *ActionEvent
- func (ev *ActionEvent) IncludesPrivateData() *ActionEvent
- func (ev *ActionEvent) Indefinite() *ActionEvent
- func (ev *ActionEvent) Log(ctx context.Context)
- func (ev *ActionEvent) LogLevel(level int) *ActionEvent
- func (ev *ActionEvent) OnDone(f OnDoneFunc) *ActionEvent
- func (ev *ActionEvent) Parent(tid ActionID) *ActionEvent
- func (ev *ActionEvent) Progress(p ActionProgress) *ActionEvent
- func (ev *ActionEvent) Run(ctx context.Context, f func(context.Context) error) error
- func (ev *ActionEvent) RunWithOpts(ctx context.Context, opts RunOpts) error
- func (ev *ActionEvent) Scope(pkgs ...schema.PackageName) *ActionEvent
- func (ev *ActionEvent) Start(ctx context.Context) *RunningAction
- func (ev *ActionEvent) StartTimestamp(ts time.Time) *ActionEvent
- func (ev *ActionEvent) Str(name string, msg fmt.Stringer) *ActionEvent
- type ActionID
- type ActionProgress
- type ActionSink
- type ActionState
- type EventAttachments
- func (ev *EventAttachments) ActionID() ActionID
- func (ev *EventAttachments) AddResult(key string, msg interface{}) *EventAttachments
- func (ev *EventAttachments) Attach(name OutputName, body []byte)
- func (ev *EventAttachments) AttachSerializable(name, modifier string, body interface{}) error
- func (ev *EventAttachments) IsRecording() bool
- func (ev *EventAttachments) Output(name OutputName, cat common.CatOutputType) io.Writer
- func (ev *EventAttachments) ReaderByName(name string) io.ReadCloser
- func (ev *EventAttachments) ReaderByOutputName(outputName OutputName) io.ReadCloser
- func (ev *EventAttachments) SetProgress(p ActionProgress) *EventAttachments
- type EventData
- type Observer
- type OnDoneFunc
- type OutputName
- type ProtoResolver
- type ResultData
- type RunOpts
- type RunningAction
- func (af *RunningAction) Attachments() *EventAttachments
- func (af *RunningAction) Call(ctx context.Context, f func(context.Context) error) error
- func (af *RunningAction) CustomDone(t time.Time, err error) bool
- func (af *RunningAction) Done(err error) error
- func (af *RunningAction) ID() ActionID
- func (af *RunningAction) Proto() *protocol.Task
- type StatefulSink
- func (s *StatefulSink) HistoricReaderByName(id ActionID, name string) io.ReadCloser
- func (s *StatefulSink) History(max int, filter func(*protocol.Task) bool) []*protocol.Task
- func (s *StatefulSink) Observe(obs Observer) func()
- func (s *StatefulSink) Sink() ActionSink
- func (s *StatefulSink) Trace(id ActionID) (trace []*protocol.Task)
- type ThrottleConfiguration
- func (*ThrottleConfiguration) Descriptor() ([]byte, []int)deprecated
- func (x *ThrottleConfiguration) GetCapacity() int32
- func (x *ThrottleConfiguration) GetCountPerLabel() string
- func (x *ThrottleConfiguration) GetLabels() map[string]string
- func (*ThrottleConfiguration) ProtoMessage()
- func (x *ThrottleConfiguration) ProtoReflect() protoreflect.Message
- func (x *ThrottleConfiguration) Reset()
- func (x *ThrottleConfiguration) String() string
- type ThrottleConfigurations
- func (*ThrottleConfigurations) Descriptor() ([]byte, []int)deprecated
- func (x *ThrottleConfigurations) GetThrottleConfiguration() []*ThrottleConfiguration
- func (*ThrottleConfigurations) ProtoMessage()
- func (x *ThrottleConfigurations) ProtoReflect() protoreflect.Message
- func (x *ThrottleConfigurations) Reset()
- func (x *ThrottleConfigurations) String() string
- type WellKnown
Constants ¶
View Source
const ( ActionCreated = "fn.action.created" ActionWaiting = "fn.action.waiting" ActionRunning = "fn.action.running" ActionDone = "fn.action.done" ActionInstant = "fn.action.instant" )
View Source
const ErrTypeIsCancelled errType = "CANCELLED"
View Source
const ErrTypeIsDependencyFailed errType = "DEPENDENCY FAILED"
View Source
const ErrTypeIsRegular errType = ""
View Source
const (
WkAction = "action"
)
Variables ¶
View Source
var ActionStorer func(*RunningAction)
View Source
var (
BaseDefaultConfig = computeDefaultConfig()
)
View Source
var File_std_tasks_configuration_proto protoreflect.FileDescriptor
View Source
var LogActions = environment.IsRunningInCI()
View Source
var OutputFullTraceCallsToDebug bool = false
View Source
var (
TaskOutputTextLog = Output("text.log", "text/plain")
)
Functions ¶
func ContextWithThrottler ¶
func MakeStoreProto ¶
func MakeStoreProto(data *EventData, at *EventAttachments) *storage.StoredTask
func NameOf ¶
func NameOf(ev *ActionEvent) (string, string)
func Retain ¶
func Retain(af *RunningAction) *storage.Command
func SetupFlags ¶
func TraceCaller ¶
func TryProtoAsJson ¶
Types ¶
type ActionArgument ¶
type ActionArgument struct { Name string Msg interface{} }
type ActionEvent ¶
type ActionEvent struct {
// contains filtered or unexported fields
}
func Action ¶
func Action(name string) *ActionEvent
func (*ActionEvent) Anchor ¶
func (ev *ActionEvent) Anchor(id ActionID) *ActionEvent
func (*ActionEvent) Arg ¶
func (ev *ActionEvent) Arg(name string, msg interface{}) *ActionEvent
func (*ActionEvent) Category ¶
func (ev *ActionEvent) Category(category string) *ActionEvent
func (*ActionEvent) Clone ¶
func (ev *ActionEvent) Clone(makeName func(string) string) *ActionEvent
func (*ActionEvent) HumanReadablef ¶
func (ev *ActionEvent) HumanReadablef(label string, args ...interface{}) *ActionEvent
func (*ActionEvent) ID ¶
func (ev *ActionEvent) ID(id ActionID) *ActionEvent
func (*ActionEvent) IncludesPrivateData ¶
func (ev *ActionEvent) IncludesPrivateData() *ActionEvent
func (*ActionEvent) Indefinite ¶
func (ev *ActionEvent) Indefinite() *ActionEvent
func (*ActionEvent) Log ¶
func (ev *ActionEvent) Log(ctx context.Context)
func (*ActionEvent) LogLevel ¶
func (ev *ActionEvent) LogLevel(level int) *ActionEvent
Sets the level for this action (by default it's zero). The lower the level, the higher the importance.
func (*ActionEvent) OnDone ¶
func (ev *ActionEvent) OnDone(f OnDoneFunc) *ActionEvent
func (*ActionEvent) Parent ¶
func (ev *ActionEvent) Parent(tid ActionID) *ActionEvent
func (*ActionEvent) Progress ¶
func (ev *ActionEvent) Progress(p ActionProgress) *ActionEvent
func (*ActionEvent) RunWithOpts ¶
func (ev *ActionEvent) RunWithOpts(ctx context.Context, opts RunOpts) error
func (*ActionEvent) Scope ¶
func (ev *ActionEvent) Scope(pkgs ...schema.PackageName) *ActionEvent
func (*ActionEvent) Start ¶
func (ev *ActionEvent) Start(ctx context.Context) *RunningAction
func (*ActionEvent) StartTimestamp ¶
func (ev *ActionEvent) StartTimestamp(ts time.Time) *ActionEvent
func (*ActionEvent) Str ¶
func (ev *ActionEvent) Str(name string, msg fmt.Stringer) *ActionEvent
type ActionProgress ¶
type ActionProgress interface {
FormatProgress() string
}
type ActionSink ¶
type ActionSink interface { Waiting(*RunningAction) Started(*RunningAction) Done(*RunningAction) Instant(*EventData) AttachmentsUpdated(ActionID, *ResultData) Output(name, contentType string, outputType common.CatOutputType) io.Writer }
func NullSink ¶
func NullSink() ActionSink
func SinkFrom ¶
func SinkFrom(ctx context.Context) ActionSink
type ActionState ¶
type ActionState string
func (ActionState) IsDone ¶
func (a ActionState) IsDone() bool
func (ActionState) IsRunning ¶
func (a ActionState) IsRunning() bool
type EventAttachments ¶
type EventAttachments struct { ResultData // contains filtered or unexported fields }
func Attachments ¶
func Attachments(ctx context.Context) *EventAttachments
func (*EventAttachments) ActionID ¶
func (ev *EventAttachments) ActionID() ActionID
func (*EventAttachments) AddResult ¶
func (ev *EventAttachments) AddResult(key string, msg interface{}) *EventAttachments
func (*EventAttachments) Attach ¶
func (ev *EventAttachments) Attach(name OutputName, body []byte)
func (*EventAttachments) AttachSerializable ¶
func (ev *EventAttachments) AttachSerializable(name, modifier string, body interface{}) error
func (*EventAttachments) IsRecording ¶
func (ev *EventAttachments) IsRecording() bool
func (*EventAttachments) Output ¶
func (ev *EventAttachments) Output(name OutputName, cat common.CatOutputType) io.Writer
func (*EventAttachments) ReaderByName ¶
func (ev *EventAttachments) ReaderByName(name string) io.ReadCloser
func (*EventAttachments) ReaderByOutputName ¶
func (ev *EventAttachments) ReaderByOutputName(outputName OutputName) io.ReadCloser
func (*EventAttachments) SetProgress ¶
func (ev *EventAttachments) SetProgress(p ActionProgress) *EventAttachments
type EventData ¶
type EventData struct { ActionID ActionID ParentID ActionID AnchorID ActionID // This action represents "waiting" on the action represented by `anchorID`. SpanID string State ActionState Name string HumanReadable string // If not set, name is used. Category string Created time.Time Started time.Time Completed time.Time Arguments []ActionArgument Scope schema.PackageList Level int HasPrivateData bool Indefinite bool Err error }
type Observer ¶
type Observer interface { OnStart(*RunningAction) OnUpdate(*RunningAction) OnDone(*RunningAction) }
type OnDoneFunc ¶
type OutputName ¶
type OutputName struct {
// contains filtered or unexported fields
}
func Output ¶
func Output(name string, contentType string) OutputName
type ProtoResolver ¶
type ProtoResolver interface { protoregistry.ExtensionTypeResolver protoregistry.MessageTypeResolver }
type ResultData ¶
type ResultData struct { Items []*ActionArgument Progress ActionProgress }
type RunningAction ¶
type RunningAction struct { Data EventData Progress ActionProgress // contains filtered or unexported fields }
func ActionFromProto ¶
func (*RunningAction) Attachments ¶
func (af *RunningAction) Attachments() *EventAttachments
func (*RunningAction) CustomDone ¶
func (af *RunningAction) CustomDone(t time.Time, err error) bool
func (*RunningAction) Done ¶
func (af *RunningAction) Done(err error) error
func (*RunningAction) ID ¶
func (af *RunningAction) ID() ActionID
func (*RunningAction) Proto ¶
func (af *RunningAction) Proto() *protocol.Task
type StatefulSink ¶
type StatefulSink struct {
// contains filtered or unexported fields
}
func NewStatefulSink ¶
func NewStatefulSink(parent ActionSink, keepHistory bool) *StatefulSink
func WithStatefulSink ¶
func WithStatefulSink(ctx context.Context) (context.Context, *StatefulSink)
func (*StatefulSink) HistoricReaderByName ¶
func (s *StatefulSink) HistoricReaderByName(id ActionID, name string) io.ReadCloser
func (*StatefulSink) Observe ¶
func (s *StatefulSink) Observe(obs Observer) func()
func (*StatefulSink) Sink ¶
func (s *StatefulSink) Sink() ActionSink
type ThrottleConfiguration ¶
type ThrottleConfiguration struct { // Capacity configuration applies to requests with these labels. Labels map[string]string `` /* 153-byte string literal not displayed */ // Maximum capacity, i.e. concurrency. Capacity int32 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` // If specified, maintain a map of capacities, keyed by the value of the specified label. CountPerLabel string `protobuf:"bytes,3,opt,name=count_per_label,json=countPerLabel,proto3" json:"count_per_label,omitempty"` // contains filtered or unexported fields }
func (*ThrottleConfiguration) Descriptor
deprecated
func (*ThrottleConfiguration) Descriptor() ([]byte, []int)
Deprecated: Use ThrottleConfiguration.ProtoReflect.Descriptor instead.
func (*ThrottleConfiguration) GetCapacity ¶
func (x *ThrottleConfiguration) GetCapacity() int32
func (*ThrottleConfiguration) GetCountPerLabel ¶
func (x *ThrottleConfiguration) GetCountPerLabel() string
func (*ThrottleConfiguration) GetLabels ¶
func (x *ThrottleConfiguration) GetLabels() map[string]string
func (*ThrottleConfiguration) ProtoMessage ¶
func (*ThrottleConfiguration) ProtoMessage()
func (*ThrottleConfiguration) ProtoReflect ¶
func (x *ThrottleConfiguration) ProtoReflect() protoreflect.Message
func (*ThrottleConfiguration) Reset ¶
func (x *ThrottleConfiguration) Reset()
func (*ThrottleConfiguration) String ¶
func (x *ThrottleConfiguration) String() string
type ThrottleConfigurations ¶
type ThrottleConfigurations struct { ThrottleConfiguration []*ThrottleConfiguration `protobuf:"bytes,1,rep,name=throttle_configuration,json=throttleConfiguration,proto3" json:"throttle_configuration,omitempty"` // contains filtered or unexported fields }
func LoadThrottlerConfig ¶
func LoadThrottlerConfig(ctx context.Context, debugLog io.Writer) *ThrottleConfigurations
func (*ThrottleConfigurations) Descriptor
deprecated
func (*ThrottleConfigurations) Descriptor() ([]byte, []int)
Deprecated: Use ThrottleConfigurations.ProtoReflect.Descriptor instead.
func (*ThrottleConfigurations) GetThrottleConfiguration ¶
func (x *ThrottleConfigurations) GetThrottleConfiguration() []*ThrottleConfiguration
func (*ThrottleConfigurations) ProtoMessage ¶
func (*ThrottleConfigurations) ProtoMessage()
func (*ThrottleConfigurations) ProtoReflect ¶
func (x *ThrottleConfigurations) ProtoReflect() protoreflect.Message
func (*ThrottleConfigurations) Reset ¶
func (x *ThrottleConfigurations) Reset()
func (*ThrottleConfigurations) String ¶
func (x *ThrottleConfigurations) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.