Permalink
Browse files

Added debian packaging structure

  • Loading branch information...
1 parent 1b50eff commit 1e5718f2d75d3c86e40c8120cd5532f55b2d90d6 @fmgoncalves committed Dec 15, 2011
View
@@ -5,6 +5,7 @@ use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Cassandra::Simple',
VERSION_FROM => 'lib/Cassandra/Simple.pm', # finds $VERSION
+ LICENSE => 'perl',
PREREQ_PM => {
'Any::Moose' => '0',
'Data::Dumper' => 0,
@@ -16,6 +17,7 @@ WriteMakefile(
'constant' => '0'
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => 'lib/Cassandra/Simple.pm',
+ (
+ ABSTRACT => '',
AUTHOR => 'Filipe Gonçalves <the.wa.syndrome@gmail.com>') : ()),
);
View
@@ -0,0 +1,22 @@
+use 5.008006;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ NAME => 'Cassandra::Simple',
+ VERSION_FROM => 'lib/Cassandra/Simple.pm', # finds $VERSION
+ LICENSE => 'perl',
+ PREREQ_PM => {
+ 'Any::Moose' => '0',
+ 'Data::Dumper' => 0,
+ 'Class::Accessor' => '0',
+ 'Thrift' => '0',
+ 'Thrift::BinaryProtocol' => '0',
+ 'Thrift::FramedTransport' => '0',
+ 'Thrift::Socket' => '0',
+ 'constant' => '0'
+ }, # e.g., Module::Name => 1.1
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (
+ AUTHOR => 'Filipe Gonçalves <the.wa.syndrome@gmail.com>') : ()),
+);
View
@@ -0,0 +1,5 @@
+libcassandra-simple-perl (0.1-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- filipe <filipe@> Thu, 15 Dec 2011 16:11:32 +0000
View
@@ -0,0 +1 @@
+8
View
@@ -0,0 +1,20 @@
+Source: libcassandra-simple-perl
+Section: perl
+Priority: optional
+Maintainer: filipe <filipe@>
+Build-Depends: debhelper (>= 8)
+Build-Depends-Indep: perl
+Standards-Version: 3.9.2
+Homepage: http://search.cpan.org/dist/Cassandra-Simple/
+
+Package: libcassandra-simple-perl
+Architecture: all
+Depends: ${misc:Depends}, ${perl:Depends}
+Description: Cassandra::Simple
+ Easy to use, Perl oriented client interface to Apache Cassandra.
+ .
+ Cassandra::Simple attempts to abstract the underlying Thrift methods as much
+ as possible to allow any Perl developer a small learning curve when using
+ Cassandra.
+ .
+ This description was automagically extracted from the module by dh-make-perl.
View
@@ -0,0 +1,36 @@
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: Filipe Gonçalves <the.wa.syndrome@gmail>
+Source: http://search.cpan.org/dist/Cassandra-Simple/
+Name: Cassandra-Simple
+DISCLAIMER: This copyright info was automatically extracted
+ from the perl module. It may not be accurate, so you better
+ check the module sources in order to ensure the module for its
+ inclusion in Debian or for general legal information. Please,
+ if licensing information is incorrectly generated, file a bug
+ on dh-make-perl.
+ NOTE: Don't forget to remove this disclaimer once you are happy
+ with this file.
+
+Files: *
+Copyright: Filipe Gonçalves <the.wa.syndrome@gmail>
+License:
+
+Files: debian/*
+Copyright: 2011, filipe <filipe@>
+License: Artistic or GPL-1+
+
+License: Artistic
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
+
+License: GPL-1+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.
@@ -0,0 +1 @@
+README
@@ -0,0 +1 @@
+examples/*
View
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
View
@@ -0,0 +1,2 @@
+version=3
+http://search.cpan.org/dist/Cassandra-Simple/ .*/Cassandra-Simple-v?(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$
@@ -14,9 +14,10 @@ sub println {
my ( $keyspace, $column_family, $composite_column_family) = qw/simple simple simplecomposite/;
-my $conn = Cassandra::Simple->new( server_name => '127.0.0.1',
+my $conn = Cassandra::Simple->new( server_name => hostname(),
keyspace => $keyspace, );
+
my $present =
grep { $_ eq $column_family } @{ [ $conn->list_keyspace_cfs($keyspace) ] };
@@ -148,9 +148,5 @@ sub create_resource {
return new Cassandra::Pool::CassandraServer( $self->{params} );
}
-#TODO implement remaining methods if needed only
-#$factory->info
-#$factory->mk_singleton_key
-#$factory->singleton
1;
@@ -52,6 +52,8 @@ This module attempts to abstract the underlying Thrift methods as much as possib
=cut
+our $VERSION="0.1";
+
use strict;
use warnings;
@@ -236,7 +238,7 @@ sub get {
if ( exists $opt->{columns} )
{ #TODO extra case for when only 1 column is requested, use thrift api's get
- $predicate->{column_names} = [ map { $_ } @{ $opt->{columns} } ];
+ $predicate->{column_names} = $opt->{columns} ;
} else {
my $sliceRange = Cassandra::SliceRange->new($opt);
$sliceRange->{start} = $opt->{column_start} // '';
@@ -1000,6 +1002,42 @@ sub create_column_family {
return $res;
}
+=head2 create_keyspace
+
+Usage C<< create_keyspace($keyspace [, $opt]) >>
+
+C<$opt> is an I<HASH> and can have the following keys:
+
+=over 2
+
+strategy
+
+=back
+
+=cut
+
+sub create_keyspace {
+ my $self = shift;
+
+ my $keyspace = shift;
+ my $opt = shift // {};
+
+ $opt->{strategy} = 'org.apache.cassandra.locator.SimpleStrategy' unless $opt->{strategy};
+ $opt->{cf_defs} = [];
+ $opt->{name} = $keyspace;
+
+ my $ksdef = Cassandra::KsDef->new($opt);
+
+
+ my $cl = $self->pool->get();
+ my $res = eval { $cl->system_add_keyspace($ksdef) };
+ $self->_wait_for_agreement();
+ if ($@) { print Dumper $@; $self->pool->fail($cl) }
+ else { $self->pool->put($cl) }
+
+ return $res;
+}
+
=head2 create_index
Usage: C<< create_index($keyspace, $column_family, $columns, [$validation_class]) >>
@@ -1090,8 +1128,6 @@ Bugs should be reported on github at L<https://github.com/fmgoncalves/p5-cassand
=cut
-#TODO TODOs
-
=head1 TODO
B<Thrift Type Checking and Packing/Unpacking>

0 comments on commit 1e5718f

Please sign in to comment.