Internal function to get all the records for one zone and cache the data
169778
protected function fetchRecords($zoneid)
    {
        if (!$zoneid) {
            throw new \Exception('fetchRecords called with blank zone ID');
        }
        $uri = $this->baseuri.'/zones/'.$zoneid.'/dns_records';
        $result = $this->httpGet($uri);

        return $result;
    }
562526
def list_records(self, rtype=None, name=None, content=None):
        """"""
        opts = {}
        if rtype is not None:
            opts['type'] = rtype.upper()
        if name is not None:
            opts['name'] = self._relative_name(name)
        if content is not None:
            opts['value'] = self._txt_encode(content) if opts.get(
                'type', '') == 'TXT' else content

        records = []
        payload = self._api.domain.zone.record.list(
            self._api_key, self._zone_id, 0, opts)
        for record in payload:
            processed_record = {
                'type': record['type'],
                'name': self._full_name(record['name']),
                'ttl': record['ttl'],
                'content': record['value'],
                'id': record['id']
            }

            # Gandi will add quotes to all TXT record strings
            if processed_record['type'] == 'TXT':
                processed_record['content'] = self._txt_decode(
                    processed_record['content'])

            records.append(processed_record)

        LOGGER.debug("list_records: %s", records)
        return records
532607
def get_all(self):
        
        self._lock.acquire()
        try:
            return list(self._cache.values())
        finally:
            self._lock.release()
1160866
def load(self, callback=None, errback=None, reload=False):
        
        if not reload and self.data:
            raise RecordException('record already loaded')

        def success(result, *args):
            self._parseModel(result)
            if callback:
                return callback(self)
            else:
                return self
        return self._rest.retrieve(self.parentZone.zone,
                                   self.domain, self.type,
                                   callback=success, errback=errback)
1213448
def _list_records_in_zone(self, zone, rdtype=None, name=None, content=None):
        
        records = []
        rrsets = zone.iterate_rdatasets() if zone else []
        for rname, rdataset in rrsets:
            rtype = dns.rdatatype.to_text(rdataset.rdtype)
            if ((not rdtype or rdtype == rtype)
                    and (not name or name == rname.to_text())):
                for rdata in rdataset:
                    rdata = rdata.to_text()
                    if not content or self._convert_content(rtype, content) == rdata:
                        raw_rdata = self._clean_TXT_record({'type': rtype,
                                                            'content': rdata})['content']
                        data = {
                            'type': rtype,
                            'name': rname.to_text(True),
                            'ttl': int(rdataset.ttl),
                            'content': raw_rdata,
                            'id': Provider._create_identifier(rtype, rname.to_text(), raw_rdata)
                        }
                        records.append(data)
        return records
544265
def atlasdb_queue_zonefiles( con, db, start_block, zonefile_dir, recover=False, validate=True, end_block=None ):
    
    # populate zonefile queue
    total = 0
    if end_block is None:
        end_block = db.lastblock+1

    ret = []    # map zonefile hash to zfinfo

    for block_height in range(start_block, end_block, 1):
        
        # TODO: can we do this transactionally?
        zonefile_info = db.get_atlas_zonefile_info_at( block_height )
        for name_txid_zfhash in zonefile_info:
            name = str(name_txid_zfhash['name'])
            zfhash = str(name_txid_zfhash['value_hash'])
            txid = str(name_txid_zfhash['txid'])
            tried_storage = 0

            present = is_zonefile_cached( zfhash, zonefile_dir, validate=validate )
            zfinfo = atlasdb_get_zonefile( zfhash, con=con )
            if zfinfo is not None:
                tried_storage = zfinfo['tried_storage']

            if recover and present:
                log.debug('Recover: assume that {} is absent so we will reprocess it'.format(zfhash))
                present = False

            log.debug("Add %s %s %s at %s (present: %s, tried_storage: %s)" % (name, zfhash, txid, block_height, present, tried_storage) )
            atlasdb_add_zonefile_info( name, zfhash, txid, present, tried_storage, block_height, con=con )
            total += 1

            ret.append({
                'name': name,
                'zonefile_hash': zfhash,
                'txid': txid,
                'block_height': block_height,
                'present': present,
                'tried_storage': tried_storage
            })

    log.debug("Queued %s zonefiles from %s-%s" % (total, start_block, db.lastblock))
    return ret
978155
function preCacheQueries(queries) {
  var groupBy = {};
  _.each(queries, function (query) {
    if (!query.queryKey) {
      return;
    }
    var hasAllValues = _.reduce(_.values(query.queryParams), function (acc, val) {
      return acc && (val !== null);
    }, true);
    if (hasAllValues) {
      var cacheKey = _executionCache.getKey(query);
      groupBy[cacheKey] = groupBy[cacheKey] || [];
      groupBy[cacheKey].push(query);
    }
  });

  _.each(groupBy, function (groupedQueries, key) {
    var aggregateShape = _.reduce(_.map(groupedQueries, 'shape'), _.assign, {});
    var query = _.cloneDeep(groupedQueries[0]);
    query.shape = aggregateShape;
    _executionCache.execute(query);
  });
}
292321
def list(cls, zone_id, options=None):
        """"""
        options = options if options else {}
        return cls.call('domain.zone.record.list', zone_id, 0, options)
585285
def atlasdb_get_zonefile_bits( zonefile_hash, con=None, path=None ):
    
    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = "SELECT inv_index FROM zonefiles WHERE zonefile_hash = ?;"
        args = (zonefile_hash,)

        cur = dbcon.cursor()
        res = atlasdb_query_execute( cur, sql, args )

        # NOTE: zero-indexed
        ret = []
        for r in res:
            ret.append( r['inv_index'] - 1 )

    return ret
300575
def get_all(self):
        
        result = cache.lrange(self.key, 0, -1)
        return (json.loads(item.decode('utf-8')) for item in result if
                item) if self.serialize else result
1806
def _get_existing(driver, zone_name, server_name, validation):
    
    if zone_name is None:
        zones = sorted(
            (z for z
             in driver.list_zones()
             if server_name.rstrip(u'.')
                .endswith(u'.' + z.domain.rstrip(u'.'))),
            key=lambda z: len(z.domain),
            reverse=True)
        if len(zones) == 0:
            raise NotInZone(server_name=server_name, zone_name=None)
    else:
        zones = [
            z for z
            in driver.list_zones()
            if z.domain == zone_name]
        if len(zones) == 0:
            raise ZoneNotFound(zone_name=zone_name)
    zone = zones[0]
    subdomain = _split_zone(server_name, zone.domain)
    existing = [
        record for record
        in zone.list_records()
        if record.name == subdomain and
        record.type == 'TXT' and
        record.data == validation]
    return zone, existing, subdomain
474197
public void recordGetAllTime(long timeNS,
                                 int requested,
                                 int returned,
                                 long totalValueBytes,
                                 long totalKeyBytes) {
        recordTime(Tracked.GET_ALL,
                   timeNS,
                   requested - returned,
                   totalValueBytes,
                   totalKeyBytes,
                   requested);
    }
283240
def atlasdb_get_zonefile( zonefile_hash, con=None, path=None ):
    
    ret = None

    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = "SELECT * FROM zonefiles WHERE zonefile_hash = ? ORDER BY inv_index;"
        args = (zonefile_hash,)

        cur = dbcon.cursor()
        res = atlasdb_query_execute( cur, sql, args )

        ret = {
            'zonefile_hash': zonefile_hash,
            'indexes': [],
            'block_heights': [],
            'present': False,
            'tried_storage': False
        }

        for zfinfo in res:
            ret['indexes'].append( zfinfo['inv_index'] )
            ret['block_heights'].append( zfinfo['block_height'] )
            ret['present'] = ret['present'] or zfinfo['present']
            ret['tried_storage'] = ret['tried_storage'] or zfinfo['tried_storage']

    return ret
1111613
def delete_records(self, zone_name, record_type, subdomain):
        
        records = self._client.get('/domain/zone/{}/record'.format(zone_name),
                                   fieldType=record_type, subDomain=subdomain)
        for record in records:
            self.delete_record(zone_name, record)
1331869
protected function fetchRecords($zone)
    {
        if (!$zone) {
            throw new \Exception('fetchRecords called with blank zone');
        }
        /* Sample get zone info call
            <urn2:getZoneInfo_V2>
                <!--You may enter ANY elements at this point-->
                <urn2:domainName>test.com</urn2:domainName>
            </urn2:getZoneInfo_V2>
        */
        $response = $this->soapCall('getZoneInfo_V2', ['domainName' => $zone]);
        if (!$response['callSuccess']) {
            throw new \Exception('SOAP callSuccess false');
        }
        $this->zones[$zone] = $response['primaryZoneInfo'];

        return $response['primaryZoneInfo']['resourceRecord'];
    }
637784
def records(self):
        """"""
        if not self.numRecords:
            self.__dbfHeader()
        records = []
        f = self.__getFileObj(self.dbf)
        f.seek(self.__dbfHeaderLength())
        for i in range(self.numRecords):
            r = self.__record()
            if r:
                records.append(r)
        return records
357864
def _gen_records(self, record, zone_id, creating=False):
        '''
        
        '''
        return _Route53Record.new(self, record, zone_id, creating)