logbus

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const GenericDefault = "_generic:default"

GenericDefault is the internal name used to identify messages unrelated to a specific target or command.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

Bus is a build log data bus. It listens for raw deltas via WriteDeltaManifest and WriteRawLog, passes them on to raw subscribers, who can then write formatted deltas back to the bus via WriteFormattedLog. The formatted deltas are then passed on to formatted subscribers.

func New

func New() *Bus

New creates a new Bus.

func (*Bus) AddFormattedSubscriber

func (b *Bus) AddFormattedSubscriber(sub Subscriber)

AddFormattedSubscriber adds a formatted subscriber to the bus. A formatted subscriber receives only the formatted deltas: DeltaFormattedLog.

func (*Bus) AddRawSubscriber

func (b *Bus) AddRawSubscriber(sub Subscriber)

AddRawSubscriber adds a raw subscriber to the bus. A raw subscriber only receives the raw deltas: DeltaManifest and DeltaLog.

func (*Bus) AddSubscriber

func (b *Bus) AddSubscriber(sub Subscriber)

AddSubscriber adds a subscriber to the bus. A subscriber receives both the raw and formatted deltas.

func (*Bus) CreatedAt

func (b *Bus) CreatedAt() time.Time

CreatedAt returns the time the bus was created.

func (*Bus) FormattedWriter

func (b *Bus) FormattedWriter(targetID, commandID string) *FormattedWriter

FormattedWriter returns a writer that writes formatted deltas to the bus.

func (*Bus) NowUnixNanos

func (b *Bus) NowUnixNanos() uint64

NowUnixNanos returns the current time in unix nanoseconds, ensuring monotonically increasing time.

func (*Bus) RemoveFormattedSubscriber

func (b *Bus) RemoveFormattedSubscriber(sub Subscriber)

RemoveFormattedSubscriber removes a formatted subscriber from the bus.

func (*Bus) RemoveRawSubscriber

func (b *Bus) RemoveRawSubscriber(sub Subscriber)

RemoveRawSubscriber removes a raw subscriber from the bus.

func (*Bus) RemoveSubscriber

func (b *Bus) RemoveSubscriber(sub Subscriber)

RemoveSubscriber removes a subscriber from the bus.

func (*Bus) Run

func (b *Bus) Run() *Run

Run returns the underlying run.

func (*Bus) TsUnixNanos

func (b *Bus) TsUnixNanos(t2 time.Time) uint64

TsUnixNanos returns a given timestamp in unix nanoseconds, ensuring monotonically increasing time.

func (*Bus) WriteDeltaManifest

func (b *Bus) WriteDeltaManifest(dm *logstream.DeltaManifest)

WriteDeltaManifest write a raw delta log to the bus.

func (*Bus) WriteFormattedLog

func (b *Bus) WriteFormattedLog(dfl *logstream.DeltaFormattedLog)

WriteFormattedLog writes a formatted delta to the bus.

func (*Bus) WriteRawLog

func (b *Bus) WriteRawLog(dl *logstream.DeltaLog)

WriteRawLog write a raw delta log to the bus.

type Command

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

Command is a build log writer for a command.

func (*Command) AddDependsOn added in v0.8.4

func (t *Command) AddDependsOn(targetID, refName string)

AddDependsOn creates a delta that will be used to merge the specified target ID & name into the command's list of targets on which it depends.

func (*Command) SetCached

func (c *Command) SetCached(cached bool)

SetCached sets the cached status of the command.

func (*Command) SetEnd

func (c *Command) SetEnd(end time.Time, status logstream.RunStatus, errorStr string)

SetEnd sets the end time of the command.

func (*Command) SetEndError added in v0.8.4

func (c *Command) SetEndError(err error)

SetEndError is a helper that allows for setting expected end metadata on a command based on whether there was an error. Note, this method assumes the status values.

func (*Command) SetName added in v0.8.4

func (c *Command) SetName(name string)

SetName sets the name of the command.

func (*Command) SetProgress

func (c *Command) SetProgress(progress int32)

SetProgress sets the progress of the command.

func (*Command) SetStart

func (c *Command) SetStart(start time.Time)

SetStart sets the start time of the command.

func (*Command) TailOutput

func (c *Command) TailOutput() []byte

TailOutput returns the tail of the output.

func (*Command) Write

func (c *Command) Write(dt []byte, ts time.Time, stream int32) (int, error)

Write prints a byte slice with a timestamp.

type FormattedWriter

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

FormattedWriter is a writer that produces DeltaFormattedLog messages.

func NewFormattedWriter

func NewFormattedWriter(bus *Bus, targetID, commandID string) *FormattedWriter

NewFormattedWriter creates a new FormattedWriter.

func (*FormattedWriter) Write

func (w *FormattedWriter) Write(dt []byte) (int, error)

Write writes the given bytes to the writer.

type Generic

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

Generic is a generic writer for build output unrelated to a specific target.

func (*Generic) WithPrefix

func (g *Generic) WithPrefix(category string) conslogging.PrefixWriter

WithPrefix returns a new Generic with the given prefix. This satisfies the conslogging.PrefixWriter interface.

func (*Generic) Write

func (g *Generic) Write(dt []byte) (int, error)

Write writes the given bytes to the generic printer.

func (*Generic) WriteWithTimestamp

func (g *Generic) WriteWithTimestamp(dt []byte, ts time.Time) (int, error)

WriteWithTimestamp writes the given bytes to the generic printer.

type Run

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

Run is a run logstream delta generator for a run.

func (*Run) Command

func (run *Run) Command(commandID string) (*Command, bool)

Command returns the command printer for the given command ID.

func (*Run) Generic

func (run *Run) Generic() *Generic

Generic returns a generic writer for build output unrelated to a specific target.

func (*Run) NewCommand

func (run *Run) NewCommand(commandID, command string, targetID, category, platform string, cached, local, interactive bool, sourceLocation *spec.SourceLocation, repoURL, repoHash, fileRelToRepo string) (*Command, error)

NewCommand creates a new command printer.

func (*Run) NewTarget

func (run *Run) NewTarget(targetID string, target domain.Target, overrideArgs []string, initialPlatform string, runner string) (*Target, error)

NewTarget creates a new target printer.

func (*Run) SetEnd

func (run *Run) SetEnd(end time.Time, status logstream.RunStatus)

SetEnd sets the end time and status of the build.

func (*Run) SetFatalError

func (run *Run) SetFatalError(end time.Time, targetID string, commandID string, failureType logstream.FailureType, helpMsg, errorMsg string)

SetFatalError sets a fatal error for the build.

func (*Run) SetGenericFatalError added in v0.7.22

func (run *Run) SetGenericFatalError(end time.Time, failureType logstream.FailureType, helpMsg, errorMsg string)

SetGenericFatalError sets a fatal error for the build with an empty target id and a command id indicating not to prefix the error with target info.

func (*Run) SetStart

func (run *Run) SetStart(start time.Time)

SetStart sets the start time of the build.

func (*Run) Target

func (run *Run) Target(targetID string) (*Target, bool)

Target returns the target printer for the given target ID.

type Subscriber

type Subscriber interface {
	Write(*logstream.Delta)
}

Subscriber is an object that can receive deltas.

type Target

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

Target is a delta generator for a target.

func (*Target) AddDependsOn added in v0.8.0

func (t *Target) AddDependsOn(targetID string)

AddDependsOn creates a delta that will be used to merge the specified target ID into the current target's list of targets on which it depends.

func (*Target) SetEnd

func (t *Target) SetEnd(end time.Time, status logstream.RunStatus, finalPlatform string)

SetEnd sets the end time of the target.

func (*Target) SetStart

func (t *Target) SetStart(start time.Time)

SetStart sets the start time of the target.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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