v1

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoReconciler = errors.New("no reconciler provided")

ErrNoReconciler is returned when no reconciler is provided to the controller.

View Source
var NewSeeder = newSeeder

NewSeeder is a builder function that creates a new FullSubtreeReconciler. It's useful for doing a full reconciler and persistence of the directory tree in an application without having to start the controller.

View Source
var WithClient = withClient

WithClient is an Option that sets the client for the controller.

View Source
var WithFullReconcileInterval = withFullReconcileInterval

WithFullReconcileInterval is an Option that sets the full reconcile interval for the controller. The full reconcile interval is the interval at which the controller will do a full reconcile of the directory tree. The full reconcile interval is a random value between the minimum and maximum interval. The default full reconcile interval is between 5 minutes and 15 minutes.

View Source
var WithReconciler = withReconciler

WithReconciler is an Option that sets the reconciler for the controller. Make sure that the reconciler is idempotent.

View Source
var WithStorage = withStorage

WithStorage is an Option that sets the storage for the tracked directories of the application.

View Source
var WithWatcher = withWatcher

WithWatcher is an Option that sets the watcher for the controller.

Functions

This section is empty.

Types

type AppStorage

type AppStorage interface {
	storage.Writer
	IsDirectoryTracked(ctx context.Context, id apiv1.DirectoryID) (bool, error)
	IsDirectoryInfoUpdated(ctx context.Context, dir *apiv1.Directory) (bool, error)
}

AppStorage is a commodity interface for applications of the tree to be able to track directories.

type Controller

type Controller interface {
	// Run starts the controller.
	Run(context.Context) error
}

Controller is the main controller for a fertilesoil application. It is responsible for watching for changes in the directory tree and reconciling the changes with the application. It also periodically checks for updates to the directory tree. The controller is responsible for persisting the directory tree in the provided storage. Note that while you could run multiple controllers for the same application, you need to make sure that any changes the application reacts to are idempotent. Else, you might end up with multiple instances of the same resource. Instead, you should run a single controller and replicas on stand-by by using leader election.

type ControllerBuilder

type ControllerBuilder func(baseDir apiv1.DirectoryID, opts ...Option) (Controller, error)

ControllerBuilder is a function that builds a controller.

var NewController ControllerBuilder = func(baseDir apiv1.DirectoryID, opts ...Option) (Controller, error) {
	return newController(baseDir, opts...)
}

NewController is the default implementation of ControllerBuilder.

type NoopReconciler added in v0.0.11

type NoopReconciler struct{}

NoopReconciler is a Reconciler that does nothing. This is useful in cases where we just want to persist the directory tree without doing any reconciliation.

func (*NoopReconciler) Reconcile added in v0.0.11

func (r *NoopReconciler) Reconcile(ctx context.Context, de apiv1.DirectoryEvent) error

type Option

type Option func(*controller)

Option is a function that configures the controller.

type Reconciler

type Reconciler interface {
	Reconcile(context.Context, apiv1.DirectoryEvent) error
}

Reconciler is the interface that allows the controller to reconcile the directory tree with the application.

type Seeder added in v0.0.11

type Seeder interface {
	InitializeDirectories(ctx context.Context) error
}

Seeder is an interface which allows to reconcile the full subtree of a directory structure. This is useful when the controller is started and needs to initialize the store with the current state of the directory structure. An HTTP client is required to perform the reconciliation.

Directories

Path Synopsis
sql
migrations
Package migrations provides helpers for building client applications that use a SQL database.
Package migrations provides helpers for building client applications that use a SQL database.

Jump to

Keyboard shortcuts

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