system

package
v1.4.1-rc5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxStderrFileLength = 1 * datasize.GB

MaxStderrFileLength sets the max size for stderr file during container execution (needed to prevent DoS)

View Source
var MaxStderrReturnLength = 2 * datasize.KB

MaxStderrReturnLength sets the max size for stderr string return into RunOutput (with truncation) from container execution (needed to prevent DoS)

View Source
var MaxStdoutFileLength = 1 * datasize.GB

MaxStdoutFileLength sets the max size for stdout file during container execution (needed to prevent DoS)

View Source
var MaxStdoutReturnLength = 2 * datasize.KB

MaxStdoutReturnLength sets the max size for stdout string return into RunOutput (with truncation) from container execution (needed to prevent DoS)

View Source
var Stderr = struct{ io.Writer }{os.Stderr}
View Source
var Stdout = struct{ io.Writer }{os.Stdout}

Functions

func AddJobIDToBaggage

func AddJobIDToBaggage(ctx context.Context, jobID string) context.Context

func AddNodeIDToBaggage

func AddNodeIDToBaggage(ctx context.Context, nodeID string) context.Context

func ConvertToClientID added in v1.2.1

func ConvertToClientID(key *rsa.PublicKey) string

ConvertToClientID converts a public key to a client ID:

func DecodePublicKey added in v1.2.1

func DecodePublicKey(key string) (*rsa.PublicKey, error)

DecodePublicKey decodes a public key from a string:

func FindJobIDInTestOutput

func FindJobIDInTestOutput(testOutput string) string

func FindJobIDInTestOutputLegacy added in v1.1.0

func FindJobIDInTestOutputLegacy(testOutput string) string

func GetTracer

func GetTracer() oteltrace.Tracer

func MustParseURL added in v0.3.25

func MustParseURL(uri string) *url.URL

func NewRootSpan

func NewRootSpan(ctx context.Context, t oteltrace.Tracer, name string) (context.Context, oteltrace.Span)

func PathExists

func PathExists(path string) (bool, error)

PathExists returns whether the given file or directory exists

func PublicKeyMatchesID

func PublicKeyMatchesID(publicKey, clientID string) (bool, error)

PublicKeyMatchesID returns true if the given base64-encoded public key and the given client ID correspond to each other:

func ReverseList

func ReverseList(s []string) []string

func Span

Span creates and starts a new span, and a context containing it. For more information see the otel.Tracer.Start(...) docs: https://pkg.go.dev/go.opentelemetry.io/otel/trace#Tracer ctx: the context to use for the span tracerName: the name of the service that the span is for - will be prefixed with "tracer/". Will create a new one if one with the same name does not exist spanName: the name of the span, inside the service opts: additional options to configure the span from trace.SpanStartOption

func SplitLines

func SplitLines(s string) []string

func Verify

func Verify(msg []byte, sig, publicKey string) error

Verify verifies a signed message with the given encoding of a public key. Returns non nil if the key is invalid.

Types

type CleanupManager

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

CleanupManager provides utilities for ensuring that sub-goroutines can clean up their resources before the main goroutine exits. Can be used to register callbacks for long-running system processes.

func NewCleanupManager

func NewCleanupManager() *CleanupManager

NewCleanupManager returns a new CleanupManager instance.

func (*CleanupManager) Cleanup

func (cm *CleanupManager) Cleanup(ctx context.Context)

Cleanup runs all registered clean-up functions in sub-goroutines and waits for them all to complete before exiting.

func (*CleanupManager) RegisterCallback

func (cm *CleanupManager) RegisterCallback(fn cleanUpWithoutContext)

RegisterCallback registers a clean-up function.

func (*CleanupManager) RegisterCallbackWithContext

func (cm *CleanupManager) RegisterCallbackWithContext(fn cleanUpWithContext)

RegisterCallbackWithContext registers a clean-up function. The context passed is guaranteed not to be already canceled.

type Environment

type Environment string
const (
	// Known environments that are configured in ops/terraform:
	EnvironmentStaging Environment = "staging"
	EnvironmentProd    Environment = "production"
	EnvironmentDev     Environment = "development"
	EnvironmentTest    Environment = "test"
)

func GetEnvironment

func GetEnvironment() Environment

func (Environment) IsKnown

func (e Environment) IsKnown() bool

func (Environment) String

func (e Environment) String() string

type FunctionWaiter

type FunctionWaiter struct {
	Name        string
	MaxAttempts int
	Delay       time.Duration
	Handler     func() (bool, error)
}

func (*FunctionWaiter) Wait

func (waiter *FunctionWaiter) Wait(ctx context.Context) error

type MessageSigner added in v1.3.2

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

func NewMessageSigner added in v1.3.2

func NewMessageSigner(sk *rsa.PrivateKey) *MessageSigner

func (*MessageSigner) PublicKey added in v1.3.2

func (m *MessageSigner) PublicKey() *rsa.PublicKey

func (*MessageSigner) PublicKeyString added in v1.3.2

func (m *MessageSigner) PublicKeyString() string

PublicKeyString returns a base64-encoding of the user's public ID key:

func (*MessageSigner) Sign added in v1.3.2

func (m *MessageSigner) Sign(msg []byte) (string, error)

type Signer added in v1.3.2

type Signer interface {
	// Sign signs a message with the user's private ID key.
	Sign(msg []byte) (string, error)
	PublicKey() *rsa.PublicKey
	PublicKeyString() string
}

Jump to

Keyboard shortcuts

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