namespace

package
v1.58.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MPL-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("namespace not found")
	ErrActive   = errors.New("namespace is active")
)

Functions

This section is empty.

Types

type DeletionHandler

type DeletionHandler interface {
	// CanDeleteNamespace is called to determine whether the namespace can be deleted
	// by the component. To signal the namespace cannot be deleted, return a non-nil error.
	CanDeleteNamespace(ctx context.Context, app *apps.Instance, ns *Namespace) error

	// DeleteNamespace is called when a namespace is deleted.
	// Due to the non-atomic nature of many components, failure to handle
	// the deletion cannot be fully rolled back.
	DeleteNamespace(ctx context.Context, app *apps.Instance, ns *Namespace) error
}

DeletionHandler is the interface for components that want to listen for and handle namespace deletion events.

type ID

type ID string

func ParseID added in v1.44.6

func ParseID(s string) (ID, bool)

func (ID) String added in v1.44.0

func (id ID) String() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages namespaces.

func NewManager

func NewManager(db *sql.DB) *Manager

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, app *apps.Instance, name Name) (*Namespace, error)

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, app *apps.Instance, name Name) error

func (*Manager) GetActive

func (m *Manager) GetActive(ctx context.Context, app *apps.Instance) (*Namespace, error)

GetActive returns the active namespace for the given app.

func (*Manager) GetByID

func (m *Manager) GetByID(ctx context.Context, app *apps.Instance, id ID) (*Namespace, error)

func (*Manager) GetByName

func (m *Manager) GetByName(ctx context.Context, app *apps.Instance, name Name) (*Namespace, error)

func (*Manager) List

func (m *Manager) List(ctx context.Context, app *apps.Instance) ([]*Namespace, error)

func (*Manager) RegisterDeletionHandler

func (mgr *Manager) RegisterDeletionHandler(h DeletionHandler)

func (*Manager) Switch

func (m *Manager) Switch(ctx context.Context, app *apps.Instance, name Name) (*Namespace, error)

type Name

type Name string

type Namespace

type Namespace struct {
	ID           ID
	App          *apps.Instance
	Name         Name
	Active       bool
	CreatedAt    time.Time
	LastActiveAt *time.Time
}

func (*Namespace) ToProto

func (ns *Namespace) ToProto() *daemonpb.Namespace

Jump to

Keyboard shortcuts

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