-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #11 - Add only_files query param to /extract - Test extraction results with only_files Other details: - Add Analyzer interface. Originally this was used to handle game and music zips differently, but now only GameAnalyzer remains. - Rename some args and fields for clarity - Change some structs, namely removing ResourceSpec, which fragmented concerns across domains a bit. Logic which affected outgoing headers was consolidated under the GameAnalyzer implementation. - Add optional Metadata field to API result JSON. - Tests: Replaced assert.NoError() with require.NoError(). The latter stops a test immediatly if the assertion fails, which prevents useless and noisy panic traces in test output. No dependencies added, already part of the testify module. - Removed unnecessary struct literal type names when they can be inferred, per linter. - Log non-OK notification responses
- Loading branch information
Showing
13 changed files
with
355 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package zipserver | ||
|
||
import ( | ||
"errors" | ||
"io" | ||
) | ||
|
||
// ErrSkipped is non-critical and indicates that analysis | ||
// chose to ignore a file. The file should not be uploaded. | ||
var ErrSkipped = errors.New("skipped file") | ||
|
||
// Analyzer analyzes individual files in a zip archive. | ||
// Behavior may change based on the intended workload. | ||
type Analyzer interface { | ||
// Analyze should return info about the contained file. | ||
// It should return ErrSkipped if a file was ignored. | ||
Analyze(r io.Reader, filename string) (AnalyzeResult, error) | ||
} | ||
|
||
type AnalyzeResult struct { | ||
RenameTo string // If non-empty, file should be renamed before uploading | ||
Metadata interface{} | ||
ContentType string | ||
ContentEncoding string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.