namespace

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MPL-2.0 Imports: 5 Imported by: 78

Documentation

Index

Constants

View Source
const (
	RootNamespaceID = "root"
)

Variables

View Source
var (
	ErrNoNamespace error      = errors.New("no namespace")
	RootNamespace  *Namespace = &Namespace{
		ID:             RootNamespaceID,
		Path:           "",
		CustomMetadata: make(map[string]string),
	}
)

Functions

func Canonicalize

func Canonicalize(nsPath string) string

Canonicalize trims any prefix '/' and adds a trailing '/' to the provided string

func ContextWithNamespace

func ContextWithNamespace(ctx context.Context, ns *Namespace) context.Context

func RootContext

func RootContext(ctx context.Context) context.Context

func SplitIDFromString added in v0.11.2

func SplitIDFromString(input string) (string, string)

Types

type MountPathDetails added in v1.10.0

type MountPathDetails struct {
	Namespace *Namespace
	MountPath string
}

MountPathDetails contains the details of a mount's location, consisting of the namespace of the mount and the path of the mount within the namespace

func (*MountPathDetails) GetFullPath added in v1.10.0

func (mpd *MountPathDetails) GetFullPath() string

func (*MountPathDetails) GetRelativePath added in v1.10.0

func (mpd *MountPathDetails) GetRelativePath(currNs *Namespace) string

type Namespace

type Namespace struct {
	ID             string            `json:"id" mapstructure:"id"`
	Path           string            `json:"path" mapstructure:"path"`
	CustomMetadata map[string]string `json:"custom_metadata" mapstructure:"custom_metadata"`
}

func FromContext

func FromContext(ctx context.Context) (*Namespace, error)

FromContext retrieves the namespace from a context, or an error if there is no namespace in the context.

func (*Namespace) HasParent

func (n *Namespace) HasParent(possibleParent *Namespace) bool

func (*Namespace) String added in v1.8.12

func (n *Namespace) String() string

func (*Namespace) TrimmedPath

func (n *Namespace) TrimmedPath(path string) string

Jump to

Keyboard shortcuts

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