backend

package
v0.0.0-...-5106b98 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 139 Imported by: 0

Documentation

Overview

Package backend composes reusable Community backend components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModeStrings

func ModeStrings() []string

ModeStrings returns a slice of all String values of the enum

func NewConnectorFactory

NewConnectorFactory applies provider defaults before distribution-owned transport and tracing adapters.

func Run

func Run(cfg *backendconfig.Config, mode Mode, createDistribution DistributionFactory) error

Run composes the core backend with required distribution-owned policies and routes.

func RunCLI

func RunCLI(args []string, stdout, stderr io.Writer) error

RunCLI loads Community configuration and starts the selected public runtime role.

Types

type AccountPolicy

type AccountPolicy struct {
	RegistrationEnabled bool
	Users               []userssvc.Option
	Members             []memberssvc.Option
	Organizations       []orgsvc.Option
	AccountClosure      []accountclosuresvc.Option
}

Distribution owns deployment policy while core owns service implementation and lifecycle.

type Distribution

type Distribution interface {
	AccountPolicy(workerproducer.EmailProducer) AccountPolicy
	WithOperation(context.Context, slug.Slug, slug.Slug, func(context.Context) error) error
	EncodeOperationError(error) (string, bool)
	DecodeOperationError(string) (error, bool)
	CheckSetup(context.Context, slug.Slug, slug.Slug) error
	CreateRepositorySource(context.Context, projectssvc.RepositorySourceService, slug.Slug, slug.Slug, model.EventActor, *datasourcessvc.CreateParams) (*datasourcessvc.DataSource, error)
	ConnectorFactory() connector.NewConnectorFunc
	WrapAdmission(admissionsvc.Service) (admissionsvc.Service, error)
	WrapDataSources(datasources.Repository) (datasources.Repository, error)
	WrapPipelineRuns(pipelineruns.Repository) (pipelineruns.Repository, error)
	NewExtension(context.Context, Services) (Extension, error)
}

func NewCommunityDistribution

func NewCommunityDistribution(resources Resources) (Distribution, error)

NewCommunityDistribution binds uncapped Community policy to the shared runtime.

type DistributionFactory

type DistributionFactory func(Resources) (Distribution, error)

DistributionFactory binds explicit deployment policy after database initialization.

type Extension

type Extension interface {
	CheckMemberAdmission(context.Context, slug.Slug) error
	Document() (*openapi3.T, error)
	RegisterRoutes(fiber.Router, *corehttp.Server) error
	RunCommand(context.Context, func() error) error
}

Extension registers distribution routes and runs only entrypoint-selected private commands.

type Mode

type Mode uint8

Mode selects the process components; private commands use the required distribution extension.

const (
	ModeAPI Mode = iota
	ModeWorker
	ModeExecutor
	ModeServiceCommand
)

func ModeString

func ModeString(s string) (Mode, error)

ModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ModeValues

func ModeValues() []Mode

ModeValues returns all values of the enum

func (Mode) IsAMode

func (i Mode) IsAMode() bool

IsAMode returns "true" if the value is listed in the enum definition. "false" otherwise

func (Mode) String

func (i Mode) String() string

type Resources

type Resources struct {
	Config             *backendconfig.Config
	Pool               *pgxpool.Pool
	TransactionManager postgres.TransactionManager
}

Resources belong to the process and remain valid until Run returns.

type Services

type Services struct {
	Resources
	Queue          queue.Enqueuer
	Cipher         crypto.AES256
	EncryptionKey  []byte
	Authorization  authorization.Service
	Organizations  orgsvc.Service
	Projects       projectssvc.Service
	Members        memberssvc.Service
	Roles          rolessvc.Service
	DataSources    datasourcessvc.Service
	Queries        queriessvc.Service
	DataSourceRefs datasourcerefssvc.Service
	Pipelines      pipelinesvc.Service
	CompiledPlans  *contractplansvc.Service
}

Services are the existing core graph required by distribution lifecycle composition.

Jump to

Keyboard shortcuts

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