Exemple #1
0
static rc_t copy_back_revisions ( const KMetadata *src_meta, VTable *dst_table,
                                  const bool show_meta )
{
    uint32_t max_revision, revision;

    rc_t rc = KMetadataMaxRevision ( src_meta, &max_revision );
    DISP_RC( rc, "copy_back_revisions:KMetadataMaxRevision() failed" );
    if ( rc != 0 ) return rc;
    if ( max_revision == 0 ) return rc;
    for ( revision = 1; revision <= max_revision && rc == 0; ++revision )
    {
        const KMetadata *src_rev_meta;

        if ( show_meta )
            KOutMsg( "+++copy metadata rev. #%u:\n", revision );
        rc = KMetadataOpenRevision ( src_meta, &src_rev_meta, revision );
        DISP_RC( rc, "copy_back_revisions:KMetadataOpenRevision() failed" );
        if ( rc == 0 )
        {
            KMetadata *dst_meta;
            rc = VTableOpenMetadataUpdate ( dst_table, & dst_meta );
            DISP_RC( rc, "copy_table_meta:VTableOpenMetadataUpdate() failed" );
            if ( rc == 0 )
            {
                rc = copy_stray_metadata ( src_rev_meta, dst_meta, NULL, show_meta );
                if ( rc == 0 )
                {
                    rc = KMetadataCommit ( dst_meta );
                    DISP_RC( rc, "copy_back_revisions:KMetadataCommit() failed" );
                    if ( rc == 0 )
                    {
                        rc = KMetadataFreeze ( dst_meta );
                        DISP_RC( rc, "copy_back_revisions:KMetadataFreeze() failed" );
                    }
                }
                KMetadataRelease ( dst_meta );
            }

            KMetadataRelease ( src_rev_meta );
        }
    }
    return rc;
}
Exemple #2
0
/* MaxRevision
 *  returns the maximum revision available
 */
LIB_EXPORT rc_t CC SRATableMaxMetaRevision( const SRATable *self, uint32_t *rslt )
{
    if (self == NULL)
        return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull);
    return KMetadataMaxRevision(self->meta,rslt);
}
Exemple #3
0
 /* MaxRevision
  *  returns the maximum revision available
  */
 inline rc_t MaxRevision ( uint32_t *revision ) const throw()
 { return KMetadataMaxRevision ( this, revision ); }