harden Stasis.pm initialization against a wider range of crazy environments (ie: apache modperl and fastcgi). Add TsoftCommit and TforceCommits to the perl binding

This commit is contained in:
Sears Russell 2010-01-19 01:56:40 +00:00
parent 18508fd2f1
commit 417eec45c4

View file

@ -7,6 +7,7 @@ BEGIN {
if(!defined($STASIS_DIR)) { if(!defined($STASIS_DIR)) {
$STASIS_DIR = $INC{"Stasis.pm"}; $STASIS_DIR = $INC{"Stasis.pm"};
$STASIS_DIR =~ s~/lang/perl/Stasis.pm~~g; $STASIS_DIR =~ s~/lang/perl/Stasis.pm~~g;
} }
1; 1;
} }
@ -17,10 +18,15 @@ use Inline C => Config => (LIBS =>
), ),
ENABLE => AUTOWRAP, ENABLE => AUTOWRAP,
TYPEMAPS => "$STASIS_DIR/lang/perl/typemap", TYPEMAPS => "$STASIS_DIR/lang/perl/typemap",
PREFIX => 'stasis_perl_'; PREFIX => 'stasis_perl_',
DIRECTORY => $ENV{STASIS_INLINE_DIRECTORY};
use Inline ( C => 'DATA', use Inline ( C => 'DATA',
INC => "-I $STASIS_DIR" INC => "-I $STASIS_DIR -I $STASIS_DIR/build/"
); );
#warn "running inline init from dir: " . `pwd`;
Inline->init;
#warn "ran inline init\n";
sub version { sub version {
return "Stasis 0.1"; return "Stasis 0.1";
@ -138,7 +144,7 @@ package Stasis::HashHeader;
@ISA = qw(Stasis::Recordid); @ISA = qw(Stasis::Recordid);
package Stasis; package Stasis;
1;
__DATA__ __DATA__
__C__ __C__
#include "stasis/transactional.h" #include "stasis/transactional.h"
@ -147,6 +153,8 @@ int Tinit();
int Tdeinit(); int Tdeinit();
int Tbegin(); int Tbegin();
int Tcommit(int xid); int Tcommit(int xid);
int TsoftCommit(int xid);
void TforceCommits();
int Tabort(int xid); int Tabort(int xid);
int Tprepare(int xid); int Tprepare(int xid);
recordid Talloc(int xid, unsigned long size); recordid Talloc(int xid, unsigned long size);