~ubuntu-branches/ubuntu/vivid/swift/vivid-updates

« back to all changes in this revision

Viewing changes to swift/container/backend.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chuck Short, James Page
  • Date: 2014-10-06 10:06:11 UTC
  • mfrom: (1.2.31)
  • Revision ID: package-import@ubuntu.com-20141006100611-wdzkkuoru7ubtlml
Tags: 2.1.0-0ubuntu1
[ Chuck Short ]
* debian/patches/fix-doc-no-network.patch: Refreshed.
* debian/control: Add python-oslosphinx as a build dependency.

[ James Page ]
* New upstream release for OpenStack Juno.
* d/copyright: Add linebreaks to fixup file-without-copyright-
  information warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
328
328
        :param content_type: object content-type
329
329
        :param etag: object etag
330
330
        :param deleted: if True, marks the object as deleted and sets the
331
 
                        deteleted_at timestamp to timestamp
 
331
                        deleted_at timestamp to timestamp
332
332
        :param storage_policy_index: the storage policy index for the object
333
333
        """
334
334
        record = {'name': name, 'created_at': timestamp, 'size': size,
582
582
        :param end_marker: end marker query
583
583
        :param prefix: prefix query
584
584
        :param delimiter: delimiter for query
585
 
        :param path: if defined, will set the prefix and delimter based on
 
585
        :param path: if defined, will set the prefix and delimiter based on
586
586
                     the path
587
587
 
588
588
        :returns: list of tuples of (name, created_at, size, content_type,
679
679
                            break
680
680
                    elif end > 0:
681
681
                        marker = name[:end] + chr(ord(delimiter) + 1)
682
 
                        # we want result to be inclusinve of delim+1
 
682
                        # we want result to be inclusive of delim+1
683
683
                        delim_force_gte = True
684
684
                        dir_name = name[:end + 1]
685
685
                        if dir_name != orig_marker:
696
696
        Merge items into the object table.
697
697
 
698
698
        :param item_list: list of dictionaries of {'name', 'created_at',
699
 
                          'size', 'content_type', 'etag', 'deleted'}
 
699
                          'size', 'content_type', 'etag', 'deleted',
 
700
                          'storage_policy_index'}
700
701
        :param source: if defined, update incoming_sync with the source
701
702
        """
702
703
        def _really_merge_items(conn):
703
704
            max_rowid = -1
 
705
            curs = conn.cursor()
704
706
            for rec in item_list:
705
707
                rec.setdefault('storage_policy_index', 0)  # legacy
706
708
                query = '''
710
712
                '''
711
713
                if self.get_db_version(conn) >= 1:
712
714
                    query += ' AND deleted IN (0, 1)'
713
 
                conn.execute(query, (rec['name'], rec['created_at'],
 
715
                curs.execute(query, (rec['name'], rec['created_at'],
714
716
                                     rec['storage_policy_index']))
715
717
                query = '''
716
718
                    SELECT 1 FROM object WHERE name = ?
718
720
                '''
719
721
                if self.get_db_version(conn) >= 1:
720
722
                    query += ' AND deleted IN (0, 1)'
721
 
                if not conn.execute(query, (
 
723
                if not curs.execute(query, (
722
724
                        rec['name'], rec['storage_policy_index'])).fetchall():
723
 
                    conn.execute('''
 
725
                    curs.execute('''
724
726
                        INSERT INTO object (name, created_at, size,
725
727
                            content_type, etag, deleted, storage_policy_index)
726
728
                        VALUES (?, ?, ?, ?, ?, ?, ?)