core

package
v0.0.0-...-ef84630 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 37 Imported by: 0

README

Core

This package implements the central business logic of auth proxy for managing connectors and connections. This package wraps the database and redis to efficiently load fully hydrated models that expose method for interacting with the system that will handle appropriate logging an event queuing for background notifications and tasks.

Generally speaking, other packages should not take dependencies on core directly, but rather take dependencies on its iface subpackage that exposes the core interfaces as well as some of the data model used by those interfaces.

Documentation

Index

Constants

View Source
const (
	ProbeOutcomeUnknown = "unknown"
	ProbeOutcomeSuccess = "success"
	ProbeOutcomeError   = "error"
)
View Source
const MigrateMutexKeyName = "connectors-migrate-lock"

MigrateMutexKeyName is the key that can be used when locking to perform a migration in redis.

Variables

View Source
var ErrConnectionNotFound = iface.ErrConnectionNotFound
View Source
var ErrDraftAlreadyExists = iface.ErrDraftAlreadyExists
View Source
var ErrNotDraft = iface.ErrNotDraft
View Source
var ErrNotFound = iface.ErrNotFound
View Source
var ErrProbeNotFound = errors.New("probe not found")
View Source
var ErrProtected = iface.ErrProtected
View Source
var ErrProxyNotImplemented = errors.New("auth type for connection does not implement proxy")

Functions

func GetConnectorVersionIdsForConnections

func GetConnectorVersionIdsForConnections(connections []database.Connection) []iface.ConnectorVersionId

GetConnectorVersionIdsForConnections returns a list of unique connector version ids for the given set of connections. The purpose of this is to support loading connector versions in bulk.

func NewCoreService

func NewCoreService(
	cfg config.C,
	db database.DB,
	encrypt encrypt.E,
	r apredis.Client,
	httpf httpf.F,
	ac apasynq.Client,
	logger *slog.Logger,
) iface.C

NewCoreService creates a new core service

func NewProbe

func NewProbe(cfg *cschema.Probe, s *service, cv *ConnectorVersion, c *connection) iface.Probe

Types

type Connector

type Connector struct {
	ConnectorVersion
	TotalVersions int64
	States        database.ConnectorVersionStates
}

Connector object is returned from queries for connectors, with one record per id. It aggregates some information across all versions for a connector.

func (*Connector) GetNamespace

func (c *Connector) GetNamespace() string

func (*Connector) GetStates

func (c *Connector) GetStates() database.ConnectorVersionStates

func (*Connector) GetTotalVersions

func (c *Connector) GetTotalVersions() int64

type ConnectorVersion

type ConnectorVersion struct {
	database.ConnectorVersion
	// contains filtered or unexported fields
}

ConnectorVersion is a wrapper for the lower level database equivalent that handles things like decrypting the configuration, checking upgradability, etc.

func (*ConnectorVersion) GetAnnotations

func (cv *ConnectorVersion) GetAnnotations() map[string]string

func (*ConnectorVersion) GetCreatedAt

func (cv *ConnectorVersion) GetCreatedAt() time.Time

func (*ConnectorVersion) GetDefinition

func (cv *ConnectorVersion) GetDefinition() *cschema.Connector

func (*ConnectorVersion) GetHash

func (cv *ConnectorVersion) GetHash() string

func (*ConnectorVersion) GetId

func (cv *ConnectorVersion) GetId() apid.ID

func (*ConnectorVersion) GetLabels

func (cv *ConnectorVersion) GetLabels() map[string]string

func (*ConnectorVersion) GetNamespace

func (cv *ConnectorVersion) GetNamespace() string

func (*ConnectorVersion) GetState

func (*ConnectorVersion) GetUpdatedAt

func (cv *ConnectorVersion) GetUpdatedAt() time.Time

func (*ConnectorVersion) GetVersion

func (cv *ConnectorVersion) GetVersion() uint64

func (*ConnectorVersion) Logger

func (cv *ConnectorVersion) Logger() *slog.Logger

func (*ConnectorVersion) SetState

type EncryptionKey

type EncryptionKey struct {
	database.EncryptionKey
	// contains filtered or unexported fields
}

EncryptionKey is the core abstraction around encryption keys.

func (*EncryptionKey) GetAnnotations

func (ek *EncryptionKey) GetAnnotations() map[string]string

func (*EncryptionKey) GetCreatedAt

func (ek *EncryptionKey) GetCreatedAt() time.Time

func (*EncryptionKey) GetId

func (ek *EncryptionKey) GetId() apid.ID

func (*EncryptionKey) GetLabels

func (ek *EncryptionKey) GetLabels() map[string]string

func (*EncryptionKey) GetNamespace

func (ek *EncryptionKey) GetNamespace() string

func (*EncryptionKey) GetState

func (ek *EncryptionKey) GetState() database.EncryptionKeyState

func (*EncryptionKey) GetUpdatedAt

func (ek *EncryptionKey) GetUpdatedAt() time.Time

func (*EncryptionKey) Logger

func (ek *EncryptionKey) Logger() *slog.Logger

type Namespace

type Namespace struct {
	database.Namespace
	// contains filtered or unexported fields
}

Namespace is the core abstraction around namespaces.

func (*Namespace) GetAnnotations

func (ns *Namespace) GetAnnotations() map[string]string

func (*Namespace) GetCreatedAt

func (ns *Namespace) GetCreatedAt() time.Time

func (*Namespace) GetEncryptionKeyId

func (ns *Namespace) GetEncryptionKeyId() *apid.ID

func (*Namespace) GetLabels

func (ns *Namespace) GetLabels() map[string]string

func (*Namespace) GetNamespace

func (ns *Namespace) GetNamespace() string

func (*Namespace) GetPath

func (ns *Namespace) GetPath() string

func (*Namespace) GetState

func (ns *Namespace) GetState() database.NamespaceState

func (*Namespace) GetUpdatedAt

func (ns *Namespace) GetUpdatedAt() time.Time

func (*Namespace) Logger

func (ns *Namespace) Logger() *slog.Logger

type RateLimit

type RateLimit struct {
	database.RateLimit
	// contains filtered or unexported fields
}

RateLimit is the core abstraction wrapping a database.RateLimit.

func (*RateLimit) GetAnnotations

func (r *RateLimit) GetAnnotations() map[string]string

func (*RateLimit) GetCreatedAt

func (r *RateLimit) GetCreatedAt() time.Time

func (*RateLimit) GetDefinition

func (r *RateLimit) GetDefinition() rlschema.RateLimit

func (*RateLimit) GetId

func (r *RateLimit) GetId() apid.ID

func (*RateLimit) GetLabels

func (r *RateLimit) GetLabels() map[string]string

func (*RateLimit) GetNamespace

func (r *RateLimit) GetNamespace() string

func (*RateLimit) GetUpdatedAt

func (r *RateLimit) GetUpdatedAt() time.Time

func (*RateLimit) Logger

func (r *RateLimit) Logger() *slog.Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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