Example #1
0
static
rc_t SRATableLoadMetadata(SRATable *self)
{
    rc_t rc = 0;
    PseudoMeta meta;
    bool readSpotCount = true;

    assert(self && self->curs != NULL);
    assert(self->curs_open == true);

    readSpotCount = self->metavers > 1;
    if (!readSpotCount) {
        rc = ReadSpotSequence_v1(self);
        if (rc != 0)
        {   return rc; }
    }

    rc = PseudoMetaInit(&meta, self->curs, readSpotCount, self->spot_count);
    if (rc != 0)
    {   return rc; }

    rc = PseudoMetaFix(&meta);
    if (rc != 0)
    {   return rc; }

    self->spot_count = meta.SPOT_COUNT.value;
    self->base_count = meta.BASE_COUNT.value;
    self->min_spot_id = meta.MIN_SPOT_ID.value;
    self->max_spot_id = meta.MAX_SPOT_ID.value;

    return rc;
}
Example #2
0
static
rc_t SRATableLoadMetadata(SRATable * self)
{
    rc_t rc = 0;
    PseudoMeta meta;
    bool readSpotCount = true;

    assert(self && self->curs != NULL);
    assert(self->curs_open == true);

    readSpotCount = self->metavers > 1;
    if (!readSpotCount) {
        rc = ReadSpotSequence_v1(self);
        if (rc != 0)
        {   return rc; }
    }

    rc = PseudoMetaInit(&meta, self->curs, readSpotCount, self->spot_count);
    if (rc != 0)
    {   return rc; }

    rc = PseudoMetaFix(&meta);
    if (rc != 0)
    {   return rc; }

    self->spot_count = meta.SPOT_COUNT.value;
    self->base_count = meta.BASE_COUNT.value;
    self->min_spot_id = meta.MIN_SPOT_ID.value;
    self->max_spot_id = meta.MAX_SPOT_ID.value;

    {
	int64_t delta = self->spot_count - (self->max_spot_id-self->min_spot_id+1);
	if(delta>0 && ((uint32_t)delta)==0){/* there was a rollover*/
		self->max_spot_id = self->min_spot_id + self->spot_count - 1;
	}
    }

    return rc;
}