plugin

package
v1.0.0-SNAPSHOT...-0150756 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Overview

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const PluginsAvailable = runtime.GOOS == "darwin" || runtime.GOOS == "linux"

defines whether plugins are available on the current platform

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

represents the context associated with a given plugin we use this instance to simplify the registration of plugin implementations

func (*Context) GetStorageBackend

func (c *Context) GetStorageBackend(id string) StorageBackendFactory

retrieves the storage backend factory for the specified identifier

func (*Context) RegisterStorageBackend

func (c *Context) RegisterStorageBackend(id string, factory StorageBackendFactory) error

registers a new storage backend with the context

type Initializer

type Initializer = func(*Context) error

provides an initializer function for plugins

type Manager

type Manager struct {
	Context *Context
	Plugins []*Plugin
	// contains filtered or unexported fields
}

func NewManager

func NewManager(path string) *Manager

creates a new empty plugin manager with the given base path

func (*Manager) Load

func (m *Manager) Load(path string)

loads a plugin from the specified path

func (*Manager) LoadAll

func (m *Manager) LoadAll() error

loads all plugins in the plugin directory

type Metadata

type Metadata struct {
	Name    string
	Version string
	Authors []string
	Website string
}

represents the metadata associated with a plugin implementation

type Plugin

type Plugin struct {
	Metadata Metadata
	Context  *Context
	// contains filtered or unexported fields
}

represents a loaded plugin instance

func Load

func Load(path string) (*Plugin, error)

loads an arbitrary plugin from the specified location

type StorageBackendFactory

type StorageBackendFactory = func(*server.Config) (storage.StorageBackend, error)

provides a factory for storage backend instances

Jump to

Keyboard shortcuts

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