use slice name and get dir from group
[cloudstore.git] / lib / CloudStore / Store.pm
index 0c05987..83a13c2 100644 (file)
@@ -2,6 +2,9 @@ package CloudStore::Store;
 use warnings;
 use strict;
 
+use lib 'lib';
+use CloudStore::API;
+
 use autodie;
 use JSON::XS;
 use File::Path qw(make_path);
@@ -14,13 +17,14 @@ use TokyoCabinet;
 use WarnColor;
 
 sub new {
-       my $class = shift;
+       my ($class,$group) = @_;
 
-       my $self = {@_};
+       my $self = {
+               api => CloudStore::API->new( $group ),
+       };
        bless $self, $class;
 
-       die "no dir" unless $self->{dir};
-       $self->{md5pool} = $self->{dir} . '/md5';
+       $self->{md5pool} = $self->{api}->{md5}->{dir};
 
        warn "# new ",dump $self if $ENV{DEBUG};