ObjStore-REP-Ring

 view release on metacpan or  search on metacpan

Ring.xs  view on Meta::CPAN

      return 1;
    }
  }
  croak("Add failed?");
  return 0;
}

int OSPV_ring_index1::remove(OSSVPV *pv)
{
  if (!conf) croak("Index not configured");
  croak("Not implemented");
  return 0;
}

int OSPV_ring_index1_cs::seek(osp_pathexam &exam)
{
  OSPV_ring_index1 *rp = (OSPV_ring_index1 *) myfocus.resolve();
  if (rp->version != version || !RG_POSITION(this)) {
    // start at the last page if not already positioned
    page = rp->last;
    // let abpos become invalid
    if (!page) return 0;
  }
  OSSVPV *conf = rp->conf;
  if (!conf) croak("Index not configured");
  exam.load_path(conf->avx(1)->safe_rv());
  if (exam.get_keycnt() < 1) {
    warn("Seek to where?  No keys found");
    return 0;
  }

  dTXN;
  int updt = !txn? 1 : txn->can_update(this);

  //int dir = page->qck_cmp(exam);
  // binary search
  // then linear search
  // give up
}

// cope with descending XXX

MODULE = ObjStore::REP::Ring	PACKAGE = ObjStore::REP::Ring

PROTOTYPES: DISABLE

BOOT:
{
  extern _Application_schema_info ObjStore_REP_Ring_dll_schema_info;
  osp_thr::use("ObjStore::REP::Ring", OSPERL_API_VERSION);
  osp_thr::register_schema("ObjStore::REP::Ring",
	&ObjStore_REP_Ring_dll_schema_info);
}

MODULE = ObjStore::REP::Ring	PACKAGE = ObjStore::REP::Ring::Index

static void
new(clsv, seg)
  SV *clsv;
  SV *seg;
	PPCODE:
	os_segment *area = osp_thr::sv_2segment(seg);
	PUTBACK;
	OSPV_ring_index1 *pv;
	NEW_OS_OBJECT(pv, area, OSPV_ring_index1::get_os_typespec(), OSPV_ring_index1());
	pv->bless(ST(0));
	return;

void
OSSVPV::_conf_slot(...)
	PPCODE:
	PUTBACK;
	OSPV_ring_index1 *pv = (OSPV_ring_index1 *) THIS;
	SV *ret=0;
	if (items == 2) {
	  pv->fix_stats();
	  if (pv->fill) croak("Can't reconfigure non-empty index");
	  pv->conf = SvOK(ST(1))? osp_thr::sv_2bridge(ST(1), 1)->ospv() : 0;
	}
	else {
	  ret = osp_thr::ospv_2sv(pv->conf);
	}
	SPAGAIN;
	if (ret) XPUSHs(ret);



( run in 0.802 second using v1.01-cache-2.11-cpan-5511b514fd6 )