tenant

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package tenant is the control plane: which customers exist, and which host belongs to which one.

It is the module the kernel itself depends on. kit/httpx resolves every request's host through the Service here before the request is about anything, and kit/jobs walks the list of tenants it returns. That is why Module hands its service back to main as well as its manifest: main holds the value, because three other things need it.

It imports no other module, and the modules above it reach it through hooks (contracts.Hook) rather than the other way round.

Index

Constants

This section is empty.

Variables

View Source
var Bootstrap = internal.Bootstrap

Bootstrap creates the first tenant of an empty installation, refusing when there already is one. `platformkit bootstrap` is its only caller; it is exported here rather than reached through Service so that "the write with no caller to authorize" is one name a reviewer can grep for.

Functions

func Module

func Module(deps Deps) (contracts.Service, module.Module)

Module is the manifest, and the service it is built on.

It is the one module that returns its implementation as well as its description, and the reason is written in the package comment: the kernel resolves every host through it, the periodic jobs walk its list, and the task module takes it as a dependency, so main has to hold the value. Every other module keeps its implementation to itself.

Types

type Deps

type Deps struct {
	// OnCreate runs inside the transaction that creates a tenant, in order.
	// main fills it: the auth module's role seeding is the one hook today.
	//
	// A hook rather than a subscription, because a tenant.created subscriber
	// runs when the worker gets to it, and the administrator this same
	// transaction creates tries to sign in before that.
	OnCreate []contracts.Hook

	// Invite gives a tenant its first administrator. A composition that wires
	// none does not mount the route, because a control plane that can create a
	// tenant nobody can ever sign in to is a control plane that creates
	// wreckage — and answering 501 to a route that exists is worse than not
	// having it.
	Invite contracts.Inviter
}

Deps is what this module cannot make for itself.

Directories

Path Synopsis
Package contracts is everything another module, an app or a test may know about tenants: the entity, the events, the permission and the Service interface.
Package contracts is everything another module, an app or a test may know about tenants: the entity, the events, the permission and the Service interface.
tenanttest
Package tenanttest is the conformance suite for contracts.Service, and a fake that passes it.
Package tenanttest is the conformance suite for contracts.Service, and a fake that passes it.
Package internal is every implementation of the tenant module.
Package internal is every implementation of the tenant module.

Jump to

Keyboard shortcuts

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