-
Notifications
You must be signed in to change notification settings - Fork 6
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
Datamon bundle list should include labels #235
Comments
skimmed over some of list labels will get label data and bundle data, put the labels in a map of slices by bundle id, then the listing of bundles will get the label(s) out of the map. sounds like a plan, @kerneltime ? |
@galvare2 what to do in the case of multiple labels referring to the same bundle? although we're not using the exact same format, git
suggests parentheses, so
is one sketch that accounts for zero, one, or two labels. note that the parenthesized list uses a different delimiter than the outer list... ... except we indeed don't want to roll our own serialization format. so perhaps something more like
where we continue to use CSV and have a separate delimiter for labels? note to self: the above will require validation (and coercion for backward-compatibility) of labels to ensure that the labels themselves don't contain the delim char. |
The choice to include labels when listing bundles should be optional. There is a performance implication for it. |
i agree
to describe, iirc: the plan here is to maintain local (and remote?) indices via a db like badger to support more performant join-like (and otherwise) queries on metadata. i've perused some of
i arrived at this suggestion as a way to get the functionality implemented immediately without making this iss dependent on the indexing decision-making. moreover, reading i agree that there are workarounds. here's a stopgap Zsh script to do the non-performant lookup implementation #! /bin/zsh
# cd $DATAMON_REPO && make build-datamon-mac
BIN=out/datamon.mac
repo_name=
while getopts r:l:b: opt; do
case $opt in
(r)
repo_name="$OPTARG"
;;
(\?)
print Bad option, aborting.
exit 1
;;
esac
done
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
if [ -z $repo_name ]; then
repo_name='ransom-datamon-test-repo'
fi
typeset -a bundle_list_lines
typeset -a bundleIDs
typeset -A bundleIDsToListLines
$BIN bundle list --repo $repo_name 2>&1 | \
grep -v '^Using config file' | \
while read bundle_list_line; do
bundle_list_lines=($bundle_list_line $bundle_list_lines)
bundleID=$(print $bundle_list_line | cut -d',' -f 1 | tr -d ' ')
bundleIDs=("$bundleID" $bundleIDs)
bundleIDsToListLines[$bundleID]=$bundle_list_line
done
typeset -A bundleIDsToLabels
$BIN label list --repo $repo_name 2>&1 | \
grep -v '^Using config file' | \
while read label_list_line; do
label=$(print $label_list_line | cut -d',' -f 1 | tr -d ' ')
bundleID=$(print $label_list_line | cut -d',' -f 2 | tr -d ' ')
if [[ -z ${bundleIDsToLabels[$bundleID]} ]]; then
bundleIDsToLabels[$bundleID]="$label"
else
existingLabelList=${bundleIDsToLabels[$bundleID]}
bundleIDsToLabels[$bundleID]="$label;$existingLabelList"
fi
done
for bundleID in $(print "$bundleIDs"); do
bundle_list_line=${bundleIDsToListLines[$bundleID]}
labelList=${bundleIDsToLabels[$bundleID]}
print "$bundle_list_line , $labelList"
done |
@kerneltime this request is more of a "nice to have" than an actual need, as i can get the information from the other cli commands. I guess the use case was just to be able to see all information about bundles and labels for a repo in one place, including bundles with no labels, for example in order to verify that uploads I ran went through correctly. But this should be considered a low priority because label list does almost everything that is needed for this anyway. |
* fixes #235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
* fixes #235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
* fixes #235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
* fixes #235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
* fixes #235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
* fixes oneconcern#235 Signed-off-by: Frederic BIDON <frederic@oneconcern.com>
Right now datamon bundle list returns something like this
I would like to see it return something like this:
The text was updated successfully, but these errors were encountered: