Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
ad4f02cb
Unverified
Commit
ad4f02cb
authored
Aug 28, 2019
by
Steven Allen
Committed by
GitHub
Aug 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6576 from ipfs/feat/easier-preload
feat: improve plugin preload logic
parents
f455c8ba
09d51774
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
15 deletions
+22
-15
plugin/loader/loader.go
plugin/loader/loader.go
+7
-0
plugin/loader/preload.go
plugin/loader/preload.go
+5
-6
plugin/loader/preload.sh
plugin/loader/preload.sh
+5
-4
plugin/loader/preload_list
plugin/loader/preload_list
+5
-5
No files found.
plugin/loader/loader.go
View file @
ad4f02cb
...
...
@@ -15,6 +15,13 @@ import (
opentracing
"github.com/opentracing/opentracing-go"
)
var
preloadPlugins
[]
plugin
.
Plugin
// Preload adds one or more plugins to the preload list. This should _only_ be called during init.
func
Preload
(
plugins
...
plugin
.
Plugin
)
{
preloadPlugins
=
append
(
preloadPlugins
,
plugins
...
)
}
var
log
=
logging
.
Logger
(
"plugin/loader"
)
var
loadPluginsFunc
=
func
(
string
)
([]
plugin
.
Plugin
,
error
)
{
...
...
plugin/loader/preload.go
View file @
ad4f02cb
package
loader
import
(
"github.com/ipfs/go-ipfs/plugin"
pluginbadgerds
"github.com/ipfs/go-ipfs/plugin/plugins/badgerds"
pluginflatfs
"github.com/ipfs/go-ipfs/plugin/plugins/flatfs"
pluginipldgit
"github.com/ipfs/go-ipfs/plugin/plugins/git"
...
...
@@ -12,9 +11,9 @@ import (
// This file is being generated as part of plugin build process
// To change it, modify the plugin/loader/preload.sh
var
preloadPlugins
=
[]
plugin
.
Plugin
{
pluginipldgit
.
Plugins
[
0
],
pluginbadgerds
.
Plugins
[
0
],
pluginflatfs
.
Plugins
[
0
],
pluginlevelds
.
Plugins
[
0
],
func
init
()
{
Preload
(
pluginipldgit
.
Plugins
...
)
Preload
(
pluginbadgerds
.
Plugins
...
)
Preload
(
pluginflatfs
.
Plugins
...
)
Preload
(
pluginlevelds
.
Plugins
...
)
}
plugin/loader/preload.sh
View file @
ad4f02cb
...
...
@@ -10,7 +10,6 @@ cat <<EOL
package loader
import (
"github.com/ipfs/go-ipfs/plugin"
EOL
to_preload |
while
read
-r
name path num
;
do
...
...
@@ -25,12 +24,14 @@ cat <<EOL
// This file is being generated as part of plugin build process
// To change it, modify the plugin/loader/preload.sh
var preloadPlugins = []plugin.Plugin
{
func init()
{
EOL
to_preload |
while
read
-r
name path num
;
do
echo
"plugin
$name
.Plugins[
$num
],"
case
"
$num
"
in
'*'
)
echo
" Preload(plugin
$name
.Plugins...)"
;;
# All plugins
*
)
echo
" Preload(plugin
$name
.Plugins[
$num
])"
;;
# A specific plugin
esac
done
echo
"}"
plugin/loader/preload_list
View file @
ad4f02cb
# this file contains plugins to be preloaded
# empty lines or starting with '#' are ignored
#
# name go-path number of the sub-plugin
# name go-path number of the sub-plugin
or *
ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git
0
ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git
*
badgerds github.com/ipfs/go-ipfs/plugin/plugins/badgerds
0
flatfs github.com/ipfs/go-ipfs/plugin/plugins/flatfs
0
levelds github.com/ipfs/go-ipfs/plugin/plugins/levelds
0
badgerds github.com/ipfs/go-ipfs/plugin/plugins/badgerds
*
flatfs github.com/ipfs/go-ipfs/plugin/plugins/flatfs
*
levelds github.com/ipfs/go-ipfs/plugin/plugins/levelds
*
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment