Apophis

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
    unless eval { ExtUtils::MakeMaker->VERSION('6.52'); 1 };
delete $WriteMakefileArgs{MIN_PERL_VERSION}
    unless eval { ExtUtils::MakeMaker->VERSION('6.48'); 1 };
delete $WriteMakefileArgs{LICENSE}
    unless eval { ExtUtils::MakeMaker->VERSION('6.31'); 1 };

# ---- Apophis as an ABI PROVIDER ------------------------------------------ *
# ap_abi.h publishes the content-addressing primitives so a consumer's XS can
# identify, shard and write a blob without a Perl frame. ExtUtils::Depends
# installs the header and records the include path; Apophis::_abi_ptr hands
# over the table's address at runtime.
my $pkg = ExtUtils::Depends->new('Apophis');
$pkg->install('include/ap_abi.h');
mkdir 'Install' unless -d 'Install';
$pkg->save_config('Install/Files.pm');
my %dep = $pkg->get_makefile_vars;

# EU::Depends returns an empty LIBS/LDFROM that would otherwise clobber
# MakeMaker's defaults; Apophis links nothing extra, so drop them.

include/ap_abi.h  view on Meta::CPAN

#ifndef AP_ABI_H
#define AP_ABI_H

/* Apophis's public C ABI - the content-addressing primitives, callable from
 * another XS module without a Perl frame. Everything here is otherwise static
 * inside Apophis's translation unit and reachable only by dispatching a
 * method, which is a Perl call to run a snprintf.
 *
 * Resolved at RUNTIME via Apophis::_abi_ptr - a DBI-style function-pointer
 * table - so there is no link-time symbol coupling and each dist builds and
 * upgrades independently. A consumer reaches this header through
 * ExtUtils::Depends, or vendors a copy pinned at AP_ABI_VERSION, and checks
 * abi_version at boot.
 *
 * The table only ever grows at the end; AP_ABI_VERSION bumps on any append,

lib/Apophis.pm  view on Meta::CPAN

=head2 namespace

    my $ns = $ca->namespace();

Returns the namespace UUID string.

=head1 C ABI

Apophis publishes its content-addressing primitives as a C function-pointer
table, so another XS module can identify, shard and write a blob without a
Perl frame in between. The header is C<ap_abi.h>, installed through
L<ExtUtils::Depends>, and C<Apophis::_abi_ptr> returns the address of the
process-wide table as a UV.

This is for XS authors. Nothing in it is reachable or useful from Perl, and
the Perl API above remains the supported one.

    use ExtUtils::Depends;
    my $pkg = ExtUtils::Depends->new('My::Module', 'Apophis');

    #include "ap_abi.h"

t/12-abi.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use File::Temp qw(tempdir);
use File::Spec;

use Apophis;

# ap_abi.h publishes the content-addressing primitives so a consumer's XS can
# identify, shard and write a blob without a Perl frame between the two.
#
# The assertion worth having is not that the table exists - it is that the C
# path and the Perl path AGREE. Two implementations of one algorithm agreeing
# is something to check, not something to assume, and the failure mode if they
# ever disagree is that blobs written one way become unreachable the other.

my $dir = tempdir(CLEANUP => 1);

# ---------------------------------------------------------------- the table



( run in 1.077 second using v1.01-cache-2.11-cpan-2e0ccfb7a10 )