Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/refactor not to assume filesystem #35

Merged
merged 31 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7c8ab0a
img: rename image decoder type and function list
jechols Mar 3, 2020
7fee738
server: remove id-to-path plugin hook
jechols Mar 3, 2020
91cb86f
plugins: make decoders just register directly
jechols Mar 5, 2020
ab11928
server: create id-to-URL function
jechols Mar 5, 2020
d95d846
server: skip nil img.Resource errors
jechols Mar 6, 2020
cf7c2c1
server: group resource / info functionality better
jechols Mar 6, 2020
d617f88
server: fix comment
jechols Mar 6, 2020
d8db8b7
server: save cache properly
jechols Mar 6, 2020
af49a26
Use ErrSkipped for img.Decoder errors
jechols Mar 6, 2020
fbc0345
img: improve Decoder registration
jechols Mar 6, 2020
de1db15
Implement Streamer across the codebase!
jechols Mar 6, 2020
aeb0e76
server: make sure Streamers get closed
jechols Mar 6, 2020
393611c
server: allow errors to be wrapped
jechols Mar 31, 2020
3d6fd7d
Fully implement streaming in JP2 decoder
jechols Mar 31, 2020
6116eb4
Remove dead code
jechols Apr 15, 2020
f7f0068
plugins: imagick-decoder: no hard failures
jechols May 13, 2020
8183d47
rais-server: fix local filesystem assumption
jechols May 13, 2020
a1fc2d6
Remove external images plugin
jechols May 13, 2020
61f38fa
Remove s3 plugin
jechols May 19, 2020
20a6c1e
Create and register cloud streamer
jechols Jun 4, 2020
5c60230
Fix image_handler_test.go
jechols Jun 9, 2020
2d93b4e
Remove s3 plugin's configuration settings
jechols Jun 9, 2020
04ad967
imagick-decoder: fix missing Warnf() parameter
jechols Jun 9, 2020
2b86342
Update main README with some S3 info
jechols Jun 9, 2020
8ed90c4
rais-server: remove unnecessary logging
jechols Jun 9, 2020
d0639e4
s3demo: rewrite for streaming from s3
jechols Jun 10, 2020
c081074
img: add more cloud streamer testing
jechols Jun 10, 2020
809334c
img: test even more cloud streamer stuff
jechols Jun 10, 2020
8304182
openjpeg: fix inconsistent Read() returns
jechols Jun 10, 2020
c58c71c
docker: speed up alpine builds
jechols Jun 10, 2020
03acc2c
Update README
jechols Jun 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
server: remove id-to-path plugin hook
  • Loading branch information
jechols committed Jun 9, 2020
commit 7fee73868a20295273519c22b0bd1f0479a456e2
11 changes: 0 additions & 11 deletions src/cmd/rais-server/image_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"net/url"
"rais/src/iiif"
"rais/src/img"
"rais/src/plugins"
"strconv"
"strings"
)
Expand Down Expand Up @@ -201,16 +200,6 @@ func (ih *ImageHandler) isValidBasePath(path string) bool {
}

func (ih *ImageHandler) getIIIFPath(id iiif.ID) string {
for _, idtopath := range idToPathPlugins {
fp, err := idtopath(id)
if err == nil {
return fp
}
if err == plugins.ErrSkipped {
continue
}
Logger.Warnf("Error trying to use plugin to translate iiif.ID: %s", err)
}
return ih.TilePath + "/" + string(id)
}

Expand Down
8 changes: 1 addition & 7 deletions src/cmd/rais-server/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/uoregon-libraries/gopkg/logger"
)

var idToPathPlugins []func(iiif.ID) (string, error)
var wrapHandlerPlugins []func(string, http.Handler) (http.Handler, error)
var teardownPlugins []func()
var purgeCachePlugins []func()
Expand Down Expand Up @@ -116,7 +115,7 @@ func (pw *pluginWrapper) loadPluginFn(name string, obj interface{}) {

// loadPlugin attempts to read the given plugin file and extract known symbols.
// If a plugin exposes Initialize or SetLogger, they're called here once we're
// sure the plugin is valid. IDToPath functions are indexed globally for use
// sure the plugin is valid. All other functions are indexed globally for use
// in the RAIS image serving handler.
func loadPlugin(fullpath string, l *logger.Logger) error {
var pw, err = newPluginWrapper(fullpath)
Expand All @@ -129,15 +128,13 @@ func loadPlugin(fullpath string, l *logger.Logger) error {
var initialize = func() {}

// Simply initialize those functions we only want indexed if they exist
var idToPath func(iiif.ID) (string, error)
var teardown func()
var wrapHandler func(string, http.Handler) (http.Handler, error)
var prgCache func()
var expCachedImg func(iiif.ID)
var imageDecoders func() []img.DecodeFunc

pw.loadPluginFn("SetLogger", &log)
pw.loadPluginFn("IDToPath", &idToPath)
pw.loadPluginFn("Initialize", &initialize)
pw.loadPluginFn("Teardown", &teardown)
pw.loadPluginFn("WrapHandler", &wrapHandler)
Expand Down Expand Up @@ -180,9 +177,6 @@ func loadPlugin(fullpath string, l *logger.Logger) error {
}

// Index remaining functions
if idToPath != nil {
idToPathPlugins = append(idToPathPlugins, idToPath)
}
if teardown != nil {
teardownPlugins = append(teardownPlugins, teardown)
}
Expand Down