Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
Initial hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
xandkar committed Feb 22, 2014
1 parent 82a316e commit 7b363d6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/
34 changes: 34 additions & 0 deletions riak-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/bash

keys2lines() {
python -c "exec(\" \
\nimport json as j \
\nimport sys as s \
\nfor key in j.loads(s.stdin.read())['keys']: \
\n print key \
\")"
}

main() {
repo_path=$1
hostname=$2
bucket=$3
port=8098
mkdir -p $repo_path/$bucket
cd $repo_path
git init
keys=$(
curl -i http://$hostname:$port/riak/$bucket\?keys\=true 2> /dev/null \
| tail -1 \
| keys2lines
)
for key in $keys;
do
curl -i http://$hostname:$port/riak/$bucket/$key 2> /dev/null \
| tail -1 \
> $bucket/$key
git add . && git commit -m "Update $bucket/$key"
done
}

main $@

0 comments on commit 7b363d6

Please sign in to comment.