Documentation ¶
Index ¶
- Variables
- func AddJobIDFromBaggageToSpan(ctx context.Context, span oteltrace.Span)
- func AddJobIDToBaggage(ctx context.Context, jobID string) context.Context
- func AddNodeIDToBaggage(ctx context.Context, nodeID string) context.Context
- func ConvertToClientID(key *rsa.PublicKey) string
- func DecodePublicKey(key string) (*rsa.PublicKey, error)
- func FindJobIDInTestOutput(testOutput string) string
- func FindJobIDInTestOutputLegacy(testOutput string) string
- func GetClientID() string
- func GetClientPublicKey() string
- func GetTracer() oteltrace.Tracer
- func MustParseURL(uri string) *url.URL
- func NewRootSpan(ctx context.Context, t oteltrace.Tracer, name string) (context.Context, oteltrace.Span)
- func NewSpan(ctx context.Context, t oteltrace.Tracer, name string, ...) (context.Context, oteltrace.Span)
- func PathExists(path string) (bool, error)
- func PublicKeyMatchesID(publicKey, clientID string) (bool, error)
- func ReverseList(s []string) []string
- func Sign(msg []byte, privKey *rsa.PrivateKey) (string, error)
- func SignForClient(msg []byte) (string, error)
- func Span(ctx context.Context, spanName string, opts ...oteltrace.SpanStartOption) (context.Context, oteltrace.Span)
- func SplitLines(s string) []string
- func Verify(msg []byte, sig, publicKey string) error
- func VerifyForClient(msg []byte, sig string) (bool, error)
- type CleanupManager
- type Environment
- type EnvironmentData
- type FunctionWaiter
- type JobLifecycleEventHandler
Constants ¶
This section is empty.
Variables ¶
var Envs = map[Environment]EnvironmentData{ EnvironmentProd: { APIPort: 1234, APIHost: "bootstrap.production.bacalhau.org", BootstrapAddresses: []string{ "/ip4/35.245.161.250/tcp/1235/p2p/QmbxGSsM6saCTyKkiWSxhJCt6Fgj7M9cns1vzYtfDbB5Ws", "/ip4/34.86.254.26/tcp/1235/p2p/QmeXjeQDinxm7zRiEo8ekrJdbs7585BM6j7ZeLVFrA7GPe", "/ip4/35.245.215.155/tcp/1235/p2p/QmPLPUUjaVE3wQNSSkxmYoaBPHVAWdjBjDYmMkWvtMZxAf", }, IPFSSwarmAddresses: []string{ "/ip4/35.245.161.250/tcp/4001/p2p/12D3KooWAQpZzf3qiNxpwizXeArGjft98ZBoMNgVNNpoWtKAvtYH", "/ip4/35.245.161.250/udp/4001/quic/p2p/12D3KooWAQpZzf3qiNxpwizXeArGjft98ZBoMNgVNNpoWtKAvtYH", "/ip4/34.86.254.26/tcp/4001/p2p/12D3KooWLfFBjDo8dFe1Q4kSm8inKjPeHzmLBkQ1QAjTHocAUazK", "/ip4/34.86.254.26/udp/4001/quic/p2p/12D3KooWLfFBjDo8dFe1Q4kSm8inKjPeHzmLBkQ1QAjTHocAUazK", "/ip4/35.245.215.155/tcp/4001/p2p/12D3KooWH3rxmhLUrpzg81KAwUuXXuqeGt4qyWRniunb5ipjemFF", "/ip4/35.245.215.155/udp/4001/quic/p2p/12D3KooWH3rxmhLUrpzg81KAwUuXXuqeGt4qyWRniunb5ipjemFF", "/ip4/34.145.201.224/tcp/4001/p2p/12D3KooWBCBZnXnNbjxqqxu2oygPdLGseEbfMbFhrkDTRjUNnZYf", "/ip4/34.145.201.224/udp/4001/quic/p2p/12D3KooWBCBZnXnNbjxqqxu2oygPdLGseEbfMbFhrkDTRjUNnZYf", "/ip4/35.245.41.51/tcp/4001/p2p/12D3KooWJM8j97yoDTb7B9xV1WpBXakT4Zof3aMgFuSQQH56rCXa", "/ip4/35.245.41.51/udp/4001/quic/p2p/12D3KooWJM8j97yoDTb7B9xV1WpBXakT4Zof3aMgFuSQQH56rCXa", }, }, EnvironmentDev: { APIPort: 1234, APIHost: "bootstrap.development.bacalhau.org", BootstrapAddresses: []string{ "/ip4/34.86.177.175/tcp/1235/p2p/QmfYBQ3HouX9zKcANNXbgJnpyLpTYS9nKBANw6RUQKZffu", "/ip4/35.245.221.171/tcp/1235/p2p/QmNjEQByyK8GiMTvnZqGyURuwXDCtzp9X6gJRKkpWfai7S", }, IPFSSwarmAddresses: []string{ "/ip4/34.86.177.175/tcp/4001/p2p/12D3KooWMSdbPzUf8WWkEcjxpCzkUfToasP9wRjFHy2iCZ6iiZdV", "/ip4/34.86.177.175/udp/4001/quic/p2p/12D3KooWMSdbPzUf8WWkEcjxpCzkUfToasP9wRjFHy2iCZ6iiZdV", "/ip4/35.245.221.171/tcp/4001/p2p/12D3KooWRBYMhTF6MNh6eN84xcZtg6EX2wJguqEtRTNq4C7aytbu", "/ip4/35.245.221.171/udp/4001/quic/p2p/12D3KooWRBYMhTF6MNh6eN84xcZtg6EX2wJguqEtRTNq4C7aytbu", }, }, EnvironmentStaging: { APIPort: 1234, APIHost: "bootstrap.staging.bacalhau.org", BootstrapAddresses: []string{ "/ip4/34.85.228.65/tcp/1235/p2p/QmafZ9oCXCJZX9Wt1nhrGS9FVVq41qhcBRSNWCkVhz3Nvv", "/ip4/34.86.73.105/tcp/1235/p2p/QmVHCeiLzhFJPCyCj5S1RTAk1vBEvxd8r5A6E4HyJGQtbJ", "/ip4/34.150.138.100/tcp/1235/p2p/QmRr9qPTe4mU7aS9faKnWgvn1NtXt36FT8YUULRPCn2f3K", }, IPFSSwarmAddresses: []string{ "/ip4/34.85.228.65/tcp/4001/p2p/12D3KooWCWSTjjWh7SVoVv24W47z3T1Ly1tgnwZ56CCqCku5e4dS", "/ip4/34.85.228.65/udp/4001/quic/p2p/12D3KooWCWSTjjWh7SVoVv24W47z3T1Ly1tgnwZ56CCqCku5e4dS", "/ip4/34.86.73.105/tcp/4001/p2p/12D3KooWQuhW3LSpvhea25Zed47Z7fD5Cq2nw1xmapQ2tAUJ3q4F", "/ip4/34.86.73.105/udp/4001/quic/p2p/12D3KooWQuhW3LSpvhea25Zed47Z7fD5Cq2nw1xmapQ2tAUJ3q4F", "/ip4/34.150.138.100/tcp/4001/p2p/12D3KooWQm1T8EN8fMBz7rLviHxTGdRnohZ9nDPGbW4bfi78ckVT", "/ip4/34.150.138.100/udp/4001/quic/p2p/12D3KooWQm1T8EN8fMBz7rLviHxTGdRnohZ9nDPGbW4bfi78ckVT", "/ip4/35.245.247.85/tcp/4001/p2p/12D3KooWEztGEJtqtzy7th2d7cTw2iR4CQCPHFUYvj66rhh9Cf7h", "/ip4/35.245.247.85/udp/4001/quic/p2p/12D3KooWEztGEJtqtzy7th2d7cTw2iR4CQCPHFUYvj66rhh9Cf7h", }, }, EnvironmentTest: { APIPort: 9999, APIHost: "test", BootstrapAddresses: []string{ "/ip4/0.0.0.0/tcp/1235/p2p/QmafZ9oCXCJZX9Wt1nhrGS9FVVq41qhcBRSNWCkVhz3Nvv", }, IPFSSwarmAddresses: []string{ "/ip4/0.0.0.0/tcp/1235/p2p/QmafZ9oCXCJZX9Wt1nhrGS9FVVq41qhcBRSNWCkVhz3Nvv", }, }, }
Envs is a list of environment data for various environments: Deprecated: stop using this, and use the config file.
var MaxStderrFileLength = 1 * datasize.GB
MaxStderrFileLength sets the max size for stderr file during container execution (needed to prevent DoS)
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)
var MaxStdoutFileLength = 1 * datasize.GB
MaxStdoutFileLength sets the max size for stdout file during container execution (needed to prevent DoS)
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)
var Stderr = struct{ io.Writer }{os.Stderr}
var Stdout = struct{ io.Writer }{os.Stdout}
Functions ¶
func AddNodeIDToBaggage ¶
func ConvertToClientID ¶ added in v1.2.1
ConvertToClientID converts a public key to a client ID:
func DecodePublicKey ¶ added in v1.2.1
DecodePublicKey decodes a public key from a string:
func FindJobIDInTestOutput ¶
func FindJobIDInTestOutputLegacy ¶ added in v1.1.0
func GetClientID ¶
func GetClientID() string
GetClientID returns a hash identifying a user based on their ID key. NOTE: must be called after InitConfig() or system will panic.
func GetClientPublicKey ¶
func GetClientPublicKey() string
GetClientPublicKey returns a base64-encoding of the user's public ID key: NOTE: must be called after InitConfig() or system will panic.
func MustParseURL ¶ added in v0.3.25
func NewRootSpan ¶
func PathExists ¶
PathExists returns whether the given file or directory exists
func PublicKeyMatchesID ¶
PublicKeyMatchesID returns true if the given base64-encoded public key and the given client ID correspond to each other:
func ReverseList ¶
func SignForClient ¶
SignForClient signs a message with the user's private ID key. NOTE: must be called after InitConfig() or system will panic.
func Span ¶
func Span(ctx context.Context, spanName string, opts ...oteltrace.SpanStartOption) (context.Context, oteltrace.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 ¶
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 EnvironmentData ¶
type EnvironmentData struct { // APIHost is the hostname of an environment's public API servers. APIHost string // APIPort is the port that an environment serves the public API on. APIPort uint16 // Bootstrap lists the bacalhau addresses for bootstrapping new local nodes. BootstrapAddresses []string // IPFSSwarmAddresses lists the swarm addresses of an environment's IPFS // nodes, for bootstrapping new local nodes. IPFSSwarmAddresses []string }
EnvironmentData captures data for a particular environment.
type FunctionWaiter ¶
type JobLifecycleEventHandler ¶
type JobLifecycleEventHandler struct {
// contains filtered or unexported fields
}
A job event handler that adds lifecycle events to the job tracing span, both for events consumed and events published.
func NewJobLifecycleEventHandler ¶
func NewJobLifecycleEventHandler(nodeID string) *JobLifecycleEventHandler