This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
LOG-1772: Canoe: productionise Paddle #2
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
595d01b
Improves README
8bf1d6b
Refactor of get
48fd3a6
Refactor struct to its own file
61c25ae
Better S3 interface + tests
dbd350c
Couple of refactors to commit operation
3309911
Remove redudant return
b4e255d
FilesToKeys as a function
422e487
Simplify hasher with just a random generated string
16ac408
Small improvement
a358f62
Better readme
b2f065e
Release instructions
2f696d0
Fixes typo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tmp | ||
dist | ||
paddle |
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 |
---|---|---|
@@ -1,8 +1,40 @@ | ||
# Paddle | ||
|
||
Paddle is a command line tool for data archival and processing. | ||
Paddle is a command line tool for canoe data archival and processing. | ||
|
||
Work in progress. | ||
## Setup for local development | ||
|
||
Make sure you have Go installed on your machine and that you checkout the repo to | ||
the right folder. By default should be: | ||
|
||
``` | ||
mkdir -p ~/go/src/github.com/deliveroo | ||
cd ~/go/src/github.com/deliveroo | ||
git clone git@github.com:deliveroo/paddle.git | ||
cd paddle | ||
``` | ||
|
||
You will need create a `$HOME/.paddle.yaml` that contains the bucket name, e.g: | ||
|
||
``` | ||
> cat $HOME/.paddle.yaml | ||
bucket: roo-bucket | ||
``` | ||
|
||
You will also need to create a `$HOME/.aws/config` or `$HOME/.aws/credentials` so Paddle can connect to AWS, e.g.: | ||
|
||
``` | ||
> cat $HOME/.aws/credentials | ||
[default] | ||
aws_access_key_id=xxx | ||
aws_secret_access_key=yyy | ||
region=eu-west-1 | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary newline |
||
|
||
``` | ||
$ go build | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should specify that Go must be installed only for development / tests. for actual usage, we'll be generating a binary which we can include instructions in the Readme for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
## Usage | ||
|
||
|
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,36 @@ | ||
package data | ||
|
||
import ( | ||
"github.com/spf13/afero" | ||
"reflect" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestFilesToKeys(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src/a", 0755) | ||
afero.WriteFile(AppFs, "src/a/b", []byte("file c"), 0644) | ||
afero.WriteFile(AppFs, "src/c", []byte("file c"), 0644) | ||
|
||
list := filesToKeys("src") | ||
expectation := []string{ | ||
"src/a/b", | ||
"src/c", | ||
} | ||
|
||
if !reflect.DeepEqual(list, expectation) { | ||
t.Errorf("list is different got: %s, want: %s.", strings.Join(list, ","), strings.Join(expectation, ",")) | ||
} | ||
} | ||
|
||
func TestFilesToKeysWhenEmptyFolder(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src", 0755) | ||
|
||
list := filesToKeys("src") | ||
|
||
if len(list) != 0 { | ||
t.Errorf("expecting empty list but got: %s", strings.Join(list, ",")) | ||
} | ||
} |
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,23 @@ | ||
package data | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
type S3Path struct { | ||
bucket string | ||
path string | ||
} | ||
|
||
func (p *S3Path) Basename() string { | ||
components := strings.Split(p.path, "/") | ||
return components[len(components)-1] | ||
} | ||
|
||
func (p *S3Path) Dirname() string { | ||
components := strings.Split(p.path, "/") | ||
if len(components) == 0 { | ||
return "" | ||
} | ||
return strings.Join(components[:len(components)-1], "/") | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth pointing out that these settings can be configured through ENV as well (e.g. BUCKET).