ObjStore-REP-FatTree

 view release on metacpan or  search on metacpan

FatTree.xs  view on Meta::CPAN

void OSPV_fatindex3_cs::moveto(I32 xto) { tc_moveto(&tc, xto); }
void OSPV_fatindex3_cs::step(I32 delta) { tc_step(&tc, delta); }
I32 OSPV_fatindex3_cs::pos() { return tc_pos(&tc); }

void OSPV_fatindex3_cs::keys()
{
  OSSVPV *pv;
  if (dex2tc_fetch(&tc, &pv)) {
    dOSP;
    osp_pathexam *exam = &osp->exam;
    exam->init();
    exam->load_path(conf_slot()->avx(2)->safe_rv());
    exam->load_target('x', pv);
    exam->push_keys();
  }
}

int OSPV_fatindex3_cs::seek(osp_pathexam &exam)
{
  OSSVPV *conf = conf_slot();
  exam.load_path(conf->avx(2)->safe_rv());
  if (exam.get_keycnt() < 1) {
    warn("Seek to where?  No keys given");
    return 0;
  }
  if (exam.get_pathcnt() < 1) {
    warn("Seek with no path.  Is index configured?");
    return 0;
  }
  return dex3tc_seek(&tc, conf->avx(1)->istrue(), exam);
}

void OSPV_fatindex3_cs::at()
{
  OSSVPV *pv;
  if (dex3tc_fetch(&tc, &pv)) {
    SV *ret = osp_thr::ospv_2sv(pv);
    dSP;
    XPUSHs(ret);
    PUTBACK;
  }
}

MODULE = ObjStore::REP::FatTree		PACKAGE = ObjStore::REP::FatTree

PROTOTYPES: DISABLE

BOOT:
  extern _Application_schema_info ObjStore_REP_FatTree_dll_schema_info;
  osp_thr::use("ObjStore::REP::FatTree", OSPERL_API_VERSION);
  osp_thr::register_schema("ObjStore::REP::FatTree",
	&ObjStore_REP_FatTree_dll_schema_info);
  XSTHRBOOT(FatTree);

MODULE = ObjStore::REP::FatTree		PACKAGE = ObjStore::REP::FatTree::AV

static void
OSSVPV::new(seg, sz)
	SV *seg;
	int sz;
	PPCODE:
	SV *CSV = ST(0);
	os_segment *area = osp_thr::sv_2segment(ST(1));
	PUTBACK;
	if (sz < 40) {
	  SERIOUS("ObjStore::REP::FatTree::AV->new(%d): representation not efficient for small arrays", sz);
	}
	OSPV_fattree_av *pv;
	NEW_OS_OBJECT(pv, area, OSPV_fattree_av::get_os_typespec(), OSPV_fattree_av());
	pv->bless(CSV);
	return;

MODULE = ObjStore::REP::FatTree		PACKAGE = ObjStore::REP::FatTree::ObjAV

static void
OSSVPV::new(seg, sz)
	SV *seg;
	int sz;
	PPCODE:
	SV *CSV = ST(0);
	os_segment *area = osp_thr::sv_2segment(ST(1));
	PUTBACK;
	if (sz < 40) {
	  SERIOUS("ObjStore::REP::FatTree::ObjAV->new(%d): representation not efficient for small arrays", sz);
	}
	OSPV_fattree_av2 *pv;
	NEW_OS_OBJECT(pv, area, OSPV_fattree_av2::get_os_typespec(), OSPV_fattree_av2());
	pv->bless(CSV);
	return;

MODULE = ObjStore::REP::FatTree		PACKAGE = ObjStore::REP::FatTree::Index

static void
OSPV_fatindex2::new(seg)
	SV *seg;
	PPCODE:
	os_segment *area = osp_thr::sv_2segment(ST(1));
	PUTBACK;
	OSPV_fatindex2 *pv;
	if (area == os_segment::get_transient_segment())
	  croak("transient indices are too easily corrupted");
	NEW_OS_OBJECT(pv, area, OSPV_fatindex2::get_os_typespec(), OSPV_fatindex2());
	pv->bless(ST(0));
	return;

void
OSPV_fatindex2::_conf_slot(...)
	PPCODE:
	PUTBACK;
	SV *ret = 0;
	if (items == 2) {
	  if (TvFILL(&THIS->tv)) {
	    croak("Configuration of an active index cannot be changed");
	  }
	  ospv_bridge *br = osp_thr::sv_2bridge(ST(1), 1, os_segment::of(THIS));
	  OSSVPV *nconf = br->ospv();
	  nconf->REF_inc();
	  if (THIS->conf_slot) THIS->conf_slot->REF_dec();
	  THIS->conf_slot = nconf;
	} else if (items == 1) {
	  ret = osp_thr::ospv_2sv(THIS->conf_slot);
	} else {
	  croak("OSPV_fatindex2(%p)->_conf_slot: bad args", THIS);
	}
	SPAGAIN;
	if (ret) XPUSHs(ret);

MODULE = ObjStore::REP::FatTree		PACKAGE = ObjStore::REP::FatTree::KCIndex

static void
OSPV_fatindex3::new(seg)
	SV *seg;
	PPCODE:
	os_segment *area = osp_thr::sv_2segment(ST(1));
	PUTBACK;
	OSPV_fatindex3 *pv;
	if (area == os_segment::get_transient_segment())
	  croak("transient indices are too easily corrupted");
	NEW_OS_OBJECT(pv, area, OSPV_fatindex3::get_os_typespec(), OSPV_fatindex3());
	pv->bless(ST(0));
	return;

void
OSPV_fatindex3::_conf_slot(...)
	PPCODE:
	PUTBACK;
	SV *ret = 0;
	if (items == 2) {
	  if (TvFILL(&THIS->tv))
	    croak("Configuration of an active index cannot be changed");
	  ospv_bridge *br = osp_thr::sv_2bridge(ST(1), 1, os_segment::of(THIS));
	  THIS->conf_slot = br->ospv();
	} else if (items == 1) {
	  ret = osp_thr::ospv_2sv(THIS->conf_slot);
	} else {
	  croak("OSPV_fatindex3(%p)->_conf_slot: bad args", THIS);
	}
	SPAGAIN;
	if (ret) XPUSHs(ret);



( run in 1.462 second using v1.01-cache-2.11-cpan-71847e10f99 )