oss_server/explorer/update_db.py
def _get_or_create_datadir(self):
        """
        Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
        We get the last created Datadir to make sure we are updating with latest blk file.
        """
        datadir_all = Datadir.objects.filter(dirname=self.blk_dir).order_by('-create_time')

        if datadir_all.count() == 0:
            datadir = Datadir(dirname=self.blk_dir, blkfile_number=0, blkfile_offset=0)
            datadir.save()
            return datadir
        else:
            return datadir_all[0]

        Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
        We get the last created Datadir to make sure we are updating with latest blk file.
        
Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
We get the last created Datadir to make sure we are updating with latest blk file.
Get the last created Datadir object from self . blk_dir or create one if no Datadir exists . We get the last created Datadir to make sure we are updating with latest blk file .
def _get_or_create_datadir(self):
        datadir_all = Datadir.objects.filter(dirname=self.blk_dir).order_by('-create_time')
        if datadir_all.count() == 0:
            datadir = Datadir(dirname=self.blk_dir, blkfile_number=0, blkfile_offset=0)
            datadir.save()
            return datadir
        else:
            return datadir_all[0]
def _get_or_create_datadir ( self ) : datadir_all = Datadir . objects . filter ( dirname = self . blk_dir ) . order_by ( '-create_time' ) if datadir_all . count ( ) == 0 : datadir = Datadir ( dirname = self . blk_dir , blkfile_number = 0 , blkfile_offset = 0 ) datadir . save ( ) return datadir else : return datadir_all [ 0 ]
Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
Get the last created Datadir object from self . blk_dir or create one if no Datadir exists .
"""
        Get the last created Datadir object from self.blk_dir, or create one if no Datadir exists.
        We get the last created Datadir to make sure we are updating with latest blk file.
        """
self