system

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModuleNotFound       = errors.New("failed to find requested module")
	ErrTenantNotFound       = errors.New("failed to find requested tenant")
	ErrNamespaceNotFound    = errors.New("failed to find requested namespace")
	ErrAuthenticationFailed = errors.New("failed to authenticate")
)

Functions

func ResolveCapabilitiesFromSource

func ResolveCapabilitiesFromSource(source Source, ident, namespace string, log *vlog.Logger) (*capabilities.CapabilityConfig, error)

ResolveCapabilitiesFromSource takes the ident, namespace, and version, and looks up the capabilities for that trio from the Source applying the user overrides over the default configurations.

func TokenHash

func TokenHash(token string) []byte

TokenHash creates a SHA-256 hash of the given string.

Types

type Credential

type Credential interface {
	Scheme() string
	Value() string
}

Credential implementations are used to authenticate entities.

type CredentialSupplier

type CredentialSupplier func(ctx context.Context) (Credential, error)

type Options

type Options interface {
	Logger() *vlog.Logger
}

Options describes the options for an system

type Overview

type Overview struct {
	State
	TenantRefs References `json:"tenantReferences"`
}

Overview is an overview of all the tenants within the system

type References

type References struct {
	// map of all tenant idents to their latest tenant version
	Identifiers map[string]int64 `json:"identifiers"`
}

References are maps of all the available tenants in the system

type Source

type Source interface {
	// Start indicates to the Source that it should prepare for system startup.
	Start(opts Options) error

	// State returns the state of the entire system, used for cache invalidation and sync purposes
	State() (*State, error)

	// Overview returns a the system overview, used for incremental sync of the system's tenants
	Overview() (*Overview, error)

	// TenantOverview returns the overview for the requested tenant
	TenantOverview(ident string) (*TenantOverview, error)

	// GetModule attempts to find the given module by its fqmn, and returns ErrRunnableNotFound if it cannot.
	GetModule(FQMN string) (*tenant.Module, error)

	// Workflows returns the requested workflows for the system.
	Workflows(ident, namespace string, version int64) ([]tenant.Workflow, error)

	// Connections returns the connections needed for the system.
	Connections(ident, namespace string, version int64) ([]tenant.Connection, error)

	// Authentication provides any auth headers or metadata for the system.
	Authentication(ident, namespace string, version int64) (*tenant.Authentication, error)

	// Capabilities provides the tenant's configured capabilities.
	Capabilities(ident, namespace string, version int64) (*capabilities.CapabilityConfig, error)

	// StaticFile is a source of static files for the tenant
	StaticFile(identifier string, tenantVersion int64, path string) ([]byte, error)

	// Queries returns the database queries that should be made available.
	Queries(ident, namespace string, version int64) ([]tenant.DBQuery, error)
}

Source describes how an entire system relays its state to a client

type State

type State struct {
	SystemVersion int64 `json:"systemVersion"`
}

State describes the state of the entire system

type TenantOverview

type TenantOverview struct {
	Identifier string         `json:"identifier"`
	Version    int64          `json:"version"`
	Config     *tenant.Config `json:"config,omitempty"`
}

TenantOverview describes the metadata for a tenant

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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