Documentation
¶
Overview ¶
Package backend composes reusable Community backend components.
Index ¶
- func ModeStrings() []string
- func NewConnectorFactory(cfg *backendconfig.Config, txm postgres.TransactionManager) connector.NewConnectorFunc
- func Run(cfg *backendconfig.Config, mode Mode, createDistribution DistributionFactory) error
- func RunCLI(args []string, stdout, stderr io.Writer) error
- type AccountPolicy
- type Distribution
- type DistributionFactory
- type Extension
- type Mode
- type Resources
- type Services
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 ¶
func NewConnectorFactory(cfg *backendconfig.Config, txm postgres.TransactionManager) connector.NewConnectorFunc
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.
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.
func ModeString ¶
ModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
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.