core

package
v0.0.0-...-c124da1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package core provides common utilities used across gofly subsystems.

Package core provides common utilities used across gofly subsystems.

Index

Constants

View Source
const DefaultHTTPClientTimeout = 30 * time.Second

DefaultHTTPClientTimeout is the fallback HTTP client timeout.

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context) context.Context

Context returns ctx when it is non-nil, otherwise context.TODO().

Library entry points use this helper to keep nil-context compatibility while making the fallback policy explicit and searchable. Application code should still pass a real request, command, or shutdown context whenever possible.

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns a client with bounded timeout, proxy support, sensible idle-connection reuse, and a cloned transport per call.

func NewHTTPClient

func NewHTTPClient(conf HTTPClientConfig) *http.Client

Types

type HTTPClientConfig

type HTTPClientConfig struct {
	Timeout             time.Duration
	TLSHandshakeTimeout time.Duration
	IdleConnTimeout     time.Duration
	MaxIdleConns        int
	MaxIdleConnsPerHost int
	Proxy               func(*http.Request) (*url.URL, error)
	TLSClientConfig     *tls.Config
}

HTTPClientConfig controls the shared default HTTP client used by framework adapters when callers do not provide a client explicitly.

Directories

Path Synopsis
Package auth provides request authentication primitives for gofly services, including bearer-token extraction, static validation and RBAC helpers on a Principal type.
Package auth provides request authentication primitives for gofly services, including bearer-token extraction, static validation and RBAC helpers on a Principal type.
Package bloom provides in-memory and distributed bloom filter implementations for negative caching and set-membership tests.
Package bloom provides in-memory and distributed bloom filter implementations for negative caching and set-membership tests.
Package breaker provides circuit breaker implementations for gofly services, including simple threshold-based and adaptive breakers.
Package breaker provides circuit breaker implementations for gofly services, including simple threshold-based and adaptive breakers.
Package callstats aggregates low-cardinality call phase diagnostics.
Package callstats aggregates low-cardinality call phase diagnostics.
Package config provides layered configuration loading with support for JSON, YAML, environment variables, remote sources, and validation.
Package config provides layered configuration loading with support for JSON, YAML, environment variables, remote sources, and validation.
consulsource
Package consulsource implements a config.RemoteSource backed by the Consul KV store.
Package consulsource implements a config.RemoteSource backed by the Consul KV store.
etcdsource
Package etcdsource implements a config.RemoteSource backed by the official etcd v3 client.
Package etcdsource implements a config.RemoteSource backed by the official etcd v3 client.
nacossource
Package nacossource implements a config.RemoteSource backed by Nacos using the official nacos-sdk-go/v2 client.
Package nacossource implements a config.RemoteSource backed by Nacos using the official nacos-sdk-go/v2 client.
Package controlplane defines versioned snapshots for service discovery, configuration and governance policy distribution.
Package controlplane defines versioned snapshots for service discovery, configuration and governance policy distribution.
Package di provides a lightweight dependency-injection container with lazy singletons, type-keyed resolution and ordered lifecycle cleanup.
Package di provides a lightweight dependency-injection container with lazy singletons, type-keyed resolution and ordered lifecycle cleanup.
Package discovery provides service registration and discovery abstractions for gofly services, including instance metadata, leases, and resolver interfaces.
Package discovery provides service registration and discovery abstractions for gofly services, including instance metadata, leases, and resolver interfaces.
consul
Package consul implements a discovery.Registry backed by the official HashiCorp Consul API.
Package consul implements a discovery.Registry backed by the official HashiCorp Consul API.
etcdv3
Package etcdv3 implements a production-grade discovery.Registry backed by the official etcd v3 client.
Package etcdv3 implements a production-grade discovery.Registry backed by the official etcd v3 client.
Package errors provides structured error types with gRPC-compatible codes for gofly services.
Package errors provides structured error types with gRPC-compatible codes for gofly services.
Package eventbus provides a lightweight in-process publish/subscribe event bus for decoupling components within a single service.
Package eventbus provides a lightweight in-process publish/subscribe event bus for decoupling components within a single service.
Package governance provides request routing rules, rate limiting, circuit breaking, concurrency limiting and canary release policies for gofly services.
Package governance provides request routing rules, rate limiting, circuit breaking, concurrency limiting and canary release policies for gofly services.
kv
Package kv provides a key-value store abstraction for gofly services, supporting get, set, delete, and TTL operations.
Package kv provides a key-value store abstraction for gofly services, supporting get, set, delete, and TTL operations.
redis
Package redis provides a minimal RESP2 Redis client with connection pooling.
Package redis provides a minimal RESP2 Redis client with connection pooling.
Package limit provides rate limiting, concurrency limiting and adaptive overload protection for gofly services.
Package limit provides rate limiting, concurrency limiting and adaptive overload protection for gofly services.
Package llm provides provider-neutral governance primitives for LLM calls: provider abstraction, token budgeting, rate limiting, redaction and audit logging.
Package llm provides provider-neutral governance primitives for LLM calls: provider abstraction, token budgeting, rate limiting, redaction and audit logging.
Package lock provides distributed and in-process locking with lease-based expiration and optional watchdog refresh.
Package lock provides distributed and in-process locking with lease-based expiration and optional watchdog refresh.
Package metadata provides a request-scoped key-value map that propagates through RPC and REST call chains.
Package metadata provides a request-scoped key-value map that propagates through RPC and REST call chains.
mq
Package mq provides message queue abstractions and governance (circuit breaker, rate limit, retry, trace) for Kafka, RabbitMQ and Redis Streams.
Package mq provides message queue abstractions and governance (circuit breaker, rate limit, retry, trace) for Kafka, RabbitMQ and Redis Streams.
kafka
Package kafka provides a core/mq Broker backed by Apache Kafka using github.com/segmentio/kafka-go.
Package kafka provides a core/mq Broker backed by Apache Kafka using github.com/segmentio/kafka-go.
rabbitmq
Package rabbitmq provides a core/mq Broker backed by RabbitMQ using github.com/rabbitmq/amqp091-go.
Package rabbitmq provides a core/mq Broker backed by RabbitMQ using github.com/rabbitmq/amqp091-go.
redisstream
Package redisstream implements the mq.Driver interface using Redis Streams.
Package redisstream implements the mq.Driver interface using Redis Streams.
Package observability provides request tracing, metrics recording, and structured logging helpers for gofly services.
Package observability provides request tracing, metrics recording, and structured logging helpers for gofly services.
metrics
Package metrics provides a Prometheus-compatible metrics registry with counters, gauges, histograms and runtime snapshots for gofly services.
Package metrics provides a Prometheus-compatible metrics registry with counters, gauges, histograms and runtime snapshots for gofly services.
metrics/otel
Package otel bridges the core/metrics Registry to OpenTelemetry, exporting gateway/service metrics over OTLP (gRPC or HTTP) without forcing the core metrics package to depend on the OTel SDK directly.
Package otel bridges the core/metrics Registry to OpenTelemetry, exporting gateway/service metrics over OTLP (gRPC or HTTP) without forcing the core metrics package to depend on the OTel SDK directly.
trace
Package trace provides W3C traceparent propagation and OpenTelemetry tracer lifecycle management for gofly services.
Package trace provides W3C traceparent propagation and OpenTelemetry tracer lifecycle management for gofly services.
trace/exporter
Package exporter provides convenience constructors for OpenTelemetry trace exporters (OTLP over gRPC or HTTP) so callers can wire core/trace.StartAgent without importing the OTLP SDK packages directly.
Package exporter provides convenience constructors for OpenTelemetry trace exporters (OTLP over gRPC or HTTP) so callers can wire core/trace.StartAgent without importing the OTLP SDK packages directly.
Package outbox implements the transactional outbox pattern with pluggable stores (memory, SQL) and a relay that forwards messages to a Publisher.
Package outbox implements the transactional outbox pattern with pluggable stores (memory, SQL) and a relay that forwards messages to a Publisher.
Package proc provides low-level process primitives used by gofly applications: signal-aware contexts, CPU-quota-aware GOMAXPROCS, build-info embedding, and a generic Shutdown coordinator.
Package proc provides low-level process primitives used by gofly applications: signal-aware contexts, CPU-quota-aware GOMAXPROCS, build-info embedding, and a generic Shutdown coordinator.
Package retry provides configurable retry policies with backoff strategies for gofly service calls.
Package retry provides configurable retry policies with backoff strategies for gofly service calls.
Package runtime captures low-cardinality runtime diagnostics for gofly transports and governance components.
Package runtime captures low-cardinality runtime diagnostics for gofly transports and governance components.
Package saga provides a small in-process orchestrator for the saga pattern: a sequence of steps executed in order, each with an optional compensation.
Package saga provides a small in-process orchestrator for the saga pattern: a sequence of steps executed in order, each with an optional compensation.
Package schedule provides a simple in-process job scheduler with interval triggers, optional startup runs, no-overlap guards and panic recovery.
Package schedule provides a simple in-process job scheduler with interval triggers, optional startup runs, no-overlap guards and panic recovery.
Package security provides TLS configuration, local address checking, and security helpers for gofly services.
Package security provides TLS configuration, local address checking, and security helpers for gofly services.
Package storage provides SQL database connectivity with connection pooling, clustering and transaction helpers for gofly services.
Package storage provides SQL database connectivity with connection pooling, clustering and transaction helpers for gofly services.
Package syncx provides concurrency helpers: single-flight groups and cooperative cancellation utilities.
Package syncx provides concurrency helpers: single-flight groups and cooperative cancellation utilities.

Jump to

Keyboard shortcuts

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